diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:50:45 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 16:50:45 +0200 |
commit | eca5f1c8831fd0776e57a174362b0515104174c2 (patch) | |
tree | 5cba4e6c74d1f5c78018eff1b09b1973c5b7604f /ui | |
parent | 1.6 (diff) | |
download | FreeFileSync-eca5f1c8831fd0776e57a174362b0515104174c2.tar.gz FreeFileSync-eca5f1c8831fd0776e57a174362b0515104174c2.tar.bz2 FreeFileSync-eca5f1c8831fd0776e57a174362b0515104174c2.zip |
1.7
Diffstat (limited to 'ui')
-rw-r--r-- | ui/MainDialog.cpp | 388 | ||||
-rw-r--r-- | ui/MainDialog.h | 9 | ||||
-rw-r--r-- | ui/SmallDialogs.cpp | 30 | ||||
-rw-r--r-- | ui/SmallDialogs.h | 16 | ||||
-rw-r--r-- | ui/SyncDialog.cpp | 164 | ||||
-rw-r--r-- | ui/guiGenerated.cpp | 128 | ||||
-rw-r--r-- | ui/guiGenerated.h | 20 |
7 files changed, 400 insertions, 355 deletions
diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp index 1c31fa2a..e1681d13 100644 --- a/ui/MainDialog.cpp +++ b/ui/MainDialog.cpp @@ -43,7 +43,6 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale updateViewFilterButtons(); //set icons for this dialog - m_bpButton11->SetBitmapLabel(*GlobalResources::bitmapAbout); m_bpButton10->SetBitmapLabel(*GlobalResources::bitmapExit); m_bpButtonCompare->SetBitmapLabel(*GlobalResources::bitmapCompare); m_bpButtonSync->SetBitmapLabel(*GlobalResources::bitmapSync); @@ -58,13 +57,13 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale //create a right-click context menu contextMenu = new wxMenu; - contextMenu->Append(contextManualFilter, _("Filter manually")); - contextMenu->Append(contextCopyClipboard, _("Copy to clipboard\tCTRL+C")); + contextMenu->Append(CONTEXT_MANUAL_FILTER, _("Filter manually")); + contextMenu->Append(CONTEXT_CLIPBOARD, _("Copy to clipboard\tCTRL+C")); #ifdef FFS_WIN - contextMenu->Append(contextOpenExplorer, _("Open with Explorer\tD-Click")); + contextMenu->Append(CONTEXT_EXPLORER, _("Open with Explorer\tD-Click")); #endif contextMenu->AppendSeparator(); - contextMenu->Append(contextDeleteFiles, _("Delete files\tDEL")); + contextMenu->Append(CONTEXT_DELETE_FILES, _("Delete files\tDEL")); contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::onContextMenuSelection), NULL, this); @@ -150,10 +149,10 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName, CustomLocale writeGrid(currentGridData); //load list of last used configuration files - cfgFileHistory = new wxConfig("FreeFileSync"); + cfgFileHistory = new wxConfig(wxT("FreeFileSync")); for (int i = CfgHistroyLength - 1; i >= 0; --i) //put files in reverse order to history { - const wxString key = "Selection" + numberToWxString(i); + const wxString key = wxString(wxT("Selection")) + numberToWxString(i); wxString value; if (cfgFileHistory->Read(key, &value)) @@ -247,7 +246,7 @@ MainDialog::~MainDialog() int vectorSize = cfgFileNames.size(); for (int i = 0; i < CfgHistroyLength; ++i) { - const wxString key = "Selection" + numberToWxString(i); + const wxString key = wxString(wxT("Selection")) + numberToWxString(i); if (i < vectorSize) cfgFileHistory->Write(key, cfgFileNames[i]); @@ -259,11 +258,11 @@ MainDialog::~MainDialog() } delete cfgFileHistory; - writeConfigurationToHD(FreeFileSync::FFS_LastConfigFile); //don't trow exceptions in destructors + writeConfigurationToHD(FreeFileSync::FfsLastConfigFile); //don't trow exceptions in destructors if (restartOnExit) { //create new dialog - MainDialog* frame = new MainDialog(0L, FreeFileSync::FFS_LastConfigFile, programLanguage); + MainDialog* frame = new MainDialog(0L, FreeFileSync::FfsLastConfigFile, programLanguage); frame->SetIcon(*GlobalResources::programIcon); //set application icon frame->Show(); } @@ -665,13 +664,13 @@ void MainDialog::deleteFilesOnGrid(const set<int>& rowsToDeleteOnUI) { const FileCompareLine& currentCmpLine = currentGridData[*i]; - if (currentCmpLine.fileDescrLeft.objType != isNothing) - filesToDelete+= currentCmpLine.fileDescrLeft.filename + "\n"; + if (currentCmpLine.fileDescrLeft.objType != TYPE_NOTHING) + filesToDelete+= currentCmpLine.fileDescrLeft.filename + wxT("\n"); - if (currentCmpLine.fileDescrRight.objType != isNothing) - filesToDelete+= currentCmpLine.fileDescrRight.filename + "\n"; + if (currentCmpLine.fileDescrRight.objType != TYPE_NOTHING) + filesToDelete+= currentCmpLine.fileDescrRight.filename + wxT("\n"); - filesToDelete+= "\n"; + filesToDelete+= wxT("\n"); } DeleteDialog* confirmDeletion = new DeleteDialog(headerText, filesToDelete, this); //no destruction needed; attached to main window @@ -720,27 +719,27 @@ void MainDialog::openWithFileBrowser(int rowNumber, int gridNr) #ifdef FFS_WIN if (gridNr == 1) { - wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); //default + wxString command = wxString(wxT("explorer ")) + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); //default if (0 <= rowNumber && rowNumber < int(gridRefUI.size())) { wxString filename = currentGridData[gridRefUI[rowNumber]].fileDescrLeft.filename; if (!filename.IsEmpty()) - command = "explorer /select," + filename; + command = wxString(wxT("explorer /select,")) + filename; } wxExecute(command); } else if (gridNr == 2) { - wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); //default + wxString command = wxString(wxT("explorer ")) + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); //default if (0 <= rowNumber && rowNumber < int(gridRefUI.size())) { wxString filename = currentGridData[gridRefUI[rowNumber]].fileDescrRight.filename; if (!filename.IsEmpty()) - command = "explorer /select," + filename; + command = wxString(wxT("explorer /select,")) + filename; } wxExecute(command); } @@ -774,22 +773,19 @@ void MainDialog::onResizeMainWindow(wxEvent& event) { if (!IsMaximized()) { - int width = 0; + int width = 0; int height = 0; - int x = 0; - int y = 0; + int x = 0; + int y = 0; GetSize(&width, &height); GetPosition(&x, &y); - if (width > 0 && height > 0) - { + if (width > 0 && height > 0 && x >= 0 && y >= 0) //test ALL parameters at once, since width/height are invalid if + { //the window is minimized (eg x,y == -32000; height = 28, width = 160) widthNotMaximized = width; heightNotMaximized = height; - } - if (x >= 0 && y >= 0) //might be < 0 under some strange circumstances - { posXNotMaximized = x; posYNotMaximized = y; } @@ -847,22 +843,22 @@ void MainDialog::OnOpenContextMenu( wxGridEvent& event ) //enable/disable context menu entries if (selection.size() > 0) { - contextMenu->Enable(contextManualFilter, true); - contextMenu->Enable(contextCopyClipboard, true); - contextMenu->Enable(contextDeleteFiles, true); + contextMenu->Enable(CONTEXT_MANUAL_FILTER, true); + contextMenu->Enable(CONTEXT_CLIPBOARD, true); + contextMenu->Enable(CONTEXT_DELETE_FILES, true); } else { - contextMenu->Enable(contextManualFilter, false); - contextMenu->Enable(contextCopyClipboard, false); - contextMenu->Enable(contextDeleteFiles, false); + contextMenu->Enable(CONTEXT_MANUAL_FILTER, false); + contextMenu->Enable(CONTEXT_CLIPBOARD, false); + contextMenu->Enable(CONTEXT_DELETE_FILES, false); } #ifdef FFS_WIN if ((leadingPanel == 1 || leadingPanel == 2) && selection.size() <= 1) - contextMenu->Enable(contextOpenExplorer, true); + contextMenu->Enable(CONTEXT_EXPLORER, true); else - contextMenu->Enable(contextOpenExplorer, false); + contextMenu->Enable(CONTEXT_EXPLORER, false); #endif //show context menu @@ -877,15 +873,15 @@ void MainDialog::onContextMenuSelection(wxCommandEvent& event) switch (event.GetId()) { - case contextManualFilter: + case CONTEXT_MANUAL_FILTER: filterRangeManual(getSelectedRows()); break; - case contextCopyClipboard: + case CONTEXT_CLIPBOARD: copySelectionToClipboard(getSelectedRows(), leadingPanel); break; - case contextOpenExplorer: + case CONTEXT_EXPLORER: selection = getSelectedRows(); if (leadingPanel == 1 || leadingPanel == 2) @@ -897,7 +893,7 @@ void MainDialog::onContextMenuSelection(wxCommandEvent& event) } break; - case contextDeleteFiles: + case CONTEXT_DELETE_FILES: deleteFilesOnGrid(getSelectedRows()); break; } @@ -961,7 +957,7 @@ void MainDialog::OnDirChangedPanel2(wxFileDirPickerEvent& event) wxString getFormattedHistoryElement(const wxString& filename) { wxString output = wxFileName(filename).GetFullName(); - if (output.EndsWith(".ffs")) + if (output.EndsWith(wxT(".ffs"))) output = output.BeforeLast('.'); return output; } @@ -986,7 +982,7 @@ bool sameFileSpecified(const wxString& file1, const wxString& file2) void MainDialog::addCfgFileToHistory(const wxString& filename) { //the default configFile should not be in the history - if (sameFileSpecified(FreeFileSync::FFS_LastConfigFile, filename)) + if (sameFileSpecified(FreeFileSync::FfsLastConfigFile, filename)) return; @@ -1078,7 +1074,7 @@ bool FileDropEvent::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filen void MainDialog::OnSaveConfig(wxCommandEvent& event) { - wxString defaultFileName = "SyncSettings.ffs"; + wxString defaultFileName = wxT("SyncSettings.ffs"); //try to use last selected configuration file as default int selectedItem; @@ -1088,7 +1084,7 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event) defaultFileName = cfgFileNames[selectedItem - 1]; - wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, wxString(_("FreeFileSync configuration")) + " (*.ffs)|*.ffs", wxFD_SAVE); + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs)|*.ffs"), wxFD_SAVE); if (filePicker->ShowModal() == wxID_OK) { @@ -1096,7 +1092,7 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event) if (wxFileExists(newFileName)) { - wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString("\"") + newFileName + "\"" + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); + wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString(wxT("\"")) + newFileName + wxT("\"") + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); if (messageDlg->ShowModal() != wxID_OK) { @@ -1126,10 +1122,10 @@ void MainDialog::OnLoadConfiguration(wxCommandEvent& event) switch (selectedItem) { case 0: //load config from file - filePicker = new wxFileDialog(this, "", "", "", wxString(_("FreeFileSync configuration")) + " (*.ffs)|*.ffs", wxFD_OPEN); + filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxString(_("FreeFileSync configuration")) + wxT(" (*.ffs)|*.ffs"), wxFD_OPEN); if (filePicker->ShowModal() == wxID_OK) - newCfgFile = filePicker->GetFilename(); + newCfgFile = filePicker->GetPath(); break; default: @@ -1179,14 +1175,14 @@ void MainDialog::OnChoiceKeyEvent(wxKeyEvent& event) void MainDialog::OnCompareByTimeSize(wxCommandEvent& event) { - cfg.compareVar = compareByTimeAndSize; + cfg.compareVar = CMP_BY_TIME_SIZE; updateCompareButtons(); } void MainDialog::OnCompareByContent(wxCommandEvent& event) { - cfg.compareVar = compareByContent; + cfg.compareVar = CMP_BY_CONTENT; updateCompareButtons(); } @@ -1206,17 +1202,17 @@ void MainDialog::OnQuit(wxCommandEvent &event) void MainDialog::loadDefaultConfiguration() { //default values - cfg.syncConfiguration.exLeftSideOnly = syncDirRight; - cfg.syncConfiguration.exRightSideOnly = syncDirRight; - cfg.syncConfiguration.leftNewer = syncDirRight; - cfg.syncConfiguration.rightNewer = syncDirRight; - cfg.syncConfiguration.different = syncDirRight; + cfg.syncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; + cfg.syncConfiguration.exRightSideOnly = SYNC_DIR_RIGHT; + cfg.syncConfiguration.leftNewer = SYNC_DIR_RIGHT; + cfg.syncConfiguration.rightNewer = SYNC_DIR_RIGHT; + cfg.syncConfiguration.different = SYNC_DIR_RIGHT; - cfg.compareVar = compareByTimeAndSize; //compare algorithm + cfg.compareVar = CMP_BY_TIME_SIZE; //compare algorithm updateCompareButtons(); - cfg.includeFilter = "*"; //include all files/folders - cfg.excludeFilter = ""; //exlude nothing + cfg.includeFilter = wxT("*"); //include all files/folders + cfg.excludeFilter = wxEmptyString; //exlude nothing //set status of filter button cfg.filterIsActive = false; //do not filter by default @@ -1246,15 +1242,15 @@ void MainDialog::readConfigurationFromHD(const wxString& filename, bool programS if (programStartup) loadDefaultConfiguration(); else - wxMessageBox(wxString(_("Could not read configuration file ")) + "\"" + filename + "\"", _("An exception occured!"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("Could not read configuration file ")) + wxT("\"") + filename + wxT("\""), _("An exception occured!"), wxOK | wxICON_ERROR); return; } //read FFS identifier - config.get(bigBuffer, FreeFileSync::FFS_ConfigFileID.Len() + 1); + config.get(bigBuffer, FreeFileSync::FfsConfigFileID.size() + 1); - if (wxString(bigBuffer) != FreeFileSync::FFS_ConfigFileID) + if (string(bigBuffer) != FreeFileSync::FfsConfigFileID) { wxMessageBox(_("The selected file does not contain a valid configuration!"), _("Warning"), wxOK); config.close(); @@ -1354,7 +1350,7 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) ofstream config(filename.c_str()); if (!config) { - wxMessageBox(wxString(_("Could not write to ")) + "\"" + filename + "\"", _("An exception occured!"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("Could not write to ")) + wxT("\"") + filename + wxT("\""), _("An exception occured!"), wxOK | wxICON_ERROR); return; } @@ -1362,7 +1358,7 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) addCfgFileToHistory(filename); //write FFS identifier - config<<FreeFileSync::FFS_ConfigFileID.c_str(); + config<<FreeFileSync::FfsConfigFileID.c_str(); //write sync configuration config<<char(cfg.syncConfiguration.exLeftSideOnly) @@ -1410,14 +1406,6 @@ void MainDialog::writeConfigurationToHD(const wxString& filename) } -void MainDialog::OnAbout(wxCommandEvent &event) -{ - AboutDlg* aboutDlg = new AboutDlg(this); - aboutDlg->ShowModal(); - event.Skip(); -} - - void MainDialog::OnShowHelpDialog(wxCommandEvent &event) { HelpDlg* helpDlg = new HelpDlg(this); @@ -1445,11 +1433,11 @@ void MainDialog::OnFilterButton(wxCommandEvent &event) void MainDialog::OnHideFilteredButton(wxCommandEvent &event) { //toggle showing filtered rows cfg.hideFiltered = !cfg.hideFiltered; + //make sure, checkbox and "hideFiltered" are in sync + m_checkBoxHideFilt->SetValue(cfg.hideFiltered); writeGrid(currentGridData); - //make sure, checkbox and "hideFiltered" are in sync - m_checkBoxHideFilt->SetValue(cfg.hideFiltered); event.Skip(); } @@ -1465,7 +1453,7 @@ void MainDialog::OnConfigureFilter(wxHyperlinkEvent &event) if (beforeImage != afterImage) //if filter settings are changed: set filtering to "on" { - if (afterImage == (wxString("*") + wxChar(1))) //default + if (afterImage == (wxString(wxT("*")) + wxChar(1))) //default { cfg.filterIsActive = false; FreeFileSync::removeFilterOnCurrentGridData(currentGridData); @@ -1536,34 +1524,34 @@ void MainDialog::OnEqualFiles(wxCommandEvent& event) void MainDialog::updateViewFilterButtons() { if (leftOnlyFilesActive) - m_bpButton20->SetBitmapLabel(*GlobalResources::bitmapLeftOnly); + m_bpButtonLeftOnly->SetBitmapLabel(*GlobalResources::bitmapLeftOnly); else - m_bpButton20->SetBitmapLabel(*GlobalResources::bitmapLeftOnlyDeact); + m_bpButtonLeftOnly->SetBitmapLabel(*GlobalResources::bitmapLeftOnlyDeact); if (leftNewerFilesActive) - m_bpButton21->SetBitmapLabel(*GlobalResources::bitmapLeftNewer); + m_bpButtonLeftNewer->SetBitmapLabel(*GlobalResources::bitmapLeftNewer); + else + m_bpButtonLeftNewer->SetBitmapLabel(*GlobalResources::bitmapLeftNewerDeact); + + if (equalFilesActive) + m_bpButtonEqual->SetBitmapLabel(*GlobalResources::bitmapEqual); else - m_bpButton21->SetBitmapLabel(*GlobalResources::bitmapLeftNewerDeact); + m_bpButtonEqual->SetBitmapLabel(*GlobalResources::bitmapEqualDeact); if (differentFilesActive) - m_bpButton22->SetBitmapLabel(*GlobalResources::bitmapDifferent); + m_bpButtonDifferent->SetBitmapLabel(*GlobalResources::bitmapDifferent); else - m_bpButton22->SetBitmapLabel(*GlobalResources::bitmapDifferentDeact); + m_bpButtonDifferent->SetBitmapLabel(*GlobalResources::bitmapDifferentDeact); if (rightNewerFilesActive) - m_bpButton23->SetBitmapLabel(*GlobalResources::bitmapRightNewer); + m_bpButtonRightNewer->SetBitmapLabel(*GlobalResources::bitmapRightNewer); else - m_bpButton23->SetBitmapLabel(*GlobalResources::bitmapRightNewerDeact); + m_bpButtonRightNewer->SetBitmapLabel(*GlobalResources::bitmapRightNewerDeact); if (rightOnlyFilesActive) - m_bpButton24->SetBitmapLabel(*GlobalResources::bitmapRightOnly); + m_bpButtonRightOnly->SetBitmapLabel(*GlobalResources::bitmapRightOnly); else - m_bpButton24->SetBitmapLabel(*GlobalResources::bitmapRightOnlyDeact); - - if (equalFilesActive) - m_bpButton25->SetBitmapLabel(*GlobalResources::bitmapEqual); - else - m_bpButton25->SetBitmapLabel(*GlobalResources::bitmapEqualDeact); + m_bpButtonRightOnly->SetBitmapLabel(*GlobalResources::bitmapRightOnlyDeact); } @@ -1586,19 +1574,11 @@ void MainDialog::updateCompareButtons() { switch (cfg.compareVar) { - case compareByTimeAndSize: + case CMP_BY_TIME_SIZE: m_radioBtnSizeDate->SetValue(true); - - m_bpButton21->Show(); //show or hide filter buttons depending on selected compare variant - m_bpButton23->Show(); - bSizer59->Layout(); break; - case compareByContent: + case CMP_BY_CONTENT: m_radioBtnContent->SetValue(true); - - m_bpButton21->Hide(); - m_bpButton23->Hide(); - bSizer59->Layout(); break; default: assert (false); @@ -1737,21 +1717,24 @@ void MainDialog::OnSync(wxCommandEvent& event) SyncDialog* syncDlg = new SyncDialog(this, currentGridData, cfg, synchronizationEnabled); if (syncDlg->ShowModal() == SyncDialog::StartSynchronizationProcess) { - //check if there are files/folders that can be synced - bool nothingToSync = true; - for (FileCompareResult::const_iterator i = currentGridData.begin(); i != currentGridData.end(); ++i) - if (i->cmpResult != filesEqual) - { - nothingToSync = false; - break; - } - - if (nothingToSync) + //check if there are files/folders to be sync'ed at all + int objectsToCreate = 0; + int objectsToOverwrite = 0; + int objectsToDelete = 0; + double dataToProcess = 0; + FreeFileSync::calcTotalBytesToSync(objectsToCreate, + objectsToOverwrite, + objectsToDelete, + dataToProcess, + currentGridData, + cfg.syncConfiguration); + if (objectsToCreate + objectsToOverwrite + objectsToDelete == 0) { - wxMessageBox(_("Nothing to synchronize. Both directories seem to contain the same data!"), _("Information"), wxICON_WARNING); + wxMessageBox(_("Nothing to synchronize. Both directories adhere to the sync-configuration!"), _("Information"), wxICON_WARNING); return; } + wxBeginBusyCursor(); clearStatusBar(); @@ -1846,24 +1829,24 @@ bool sortGridLeft(const GridViewLine a, const GridViewLine b) { case 0: //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == isNothing) + if (gridDataLineA.objType == TYPE_NOTHING) return false; //empty rows always last - else if (gridDataLineB.objType == isNothing) + else if (gridDataLineB.objType == TYPE_NOTHING) return true; //empty rows always last - else if (gridDataLineA.objType == isDirectory) + else if (gridDataLineA.objType == TYPE_DIRECTORY) return false; - else if (gridDataLineB.objType == isDirectory) + else if (gridDataLineB.objType == TYPE_DIRECTORY) return true; else return cmpString(gridDataLineA.relFilename.AfterLast(GlobalResources::fileNameSeparator), gridDataLineB.relFilename.AfterLast(GlobalResources::fileNameSeparator)); case 1: - if (gridDataLineA.objType == isDirectory) + if (gridDataLineA.objType == TYPE_DIRECTORY) stringA = gridDataLineA.relFilename; else stringA = gridDataLineA.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - if (gridDataLineB.objType == isDirectory) + if (gridDataLineB.objType == TYPE_DIRECTORY) stringB = gridDataLineB.relFilename; else stringB = gridDataLineB.relFilename.BeforeLast(GlobalResources::fileNameSeparator); @@ -1872,13 +1855,13 @@ bool sortGridLeft(const GridViewLine a, const GridViewLine b) case 2: //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == isNothing) + if (gridDataLineA.objType == TYPE_NOTHING) return false; //empty rows always last - else if (gridDataLineB.objType == isNothing) + else if (gridDataLineB.objType == TYPE_NOTHING) return true; //empty rows always last - else if (gridDataLineA.objType == isDirectory) + else if (gridDataLineA.objType == TYPE_DIRECTORY) return false; - else if (gridDataLineB.objType == isDirectory) + else if (gridDataLineB.objType == TYPE_DIRECTORY) return true; else //use unformatted filesizes and sort by size return cmpLargeInt(gridDataLineA.fileSize, gridDataLineB.fileSize); @@ -1905,25 +1888,25 @@ bool sortGridRight(const GridViewLine a, const GridViewLine b) { case 0: //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == isNothing) + if (gridDataLineA.objType == TYPE_NOTHING) return false; //empty rows always last - else if (gridDataLineB.objType == isNothing) + else if (gridDataLineB.objType == TYPE_NOTHING) return true; //empty rows always last - else if (gridDataLineA.objType == isDirectory) + else if (gridDataLineA.objType == TYPE_DIRECTORY) return false; - else if (gridDataLineB.objType == isDirectory) + else if (gridDataLineB.objType == TYPE_DIRECTORY) return true; else return cmpString(gridDataLineA.relFilename.AfterLast(GlobalResources::fileNameSeparator), gridDataLineB.relFilename.AfterLast(GlobalResources::fileNameSeparator)); case 1: - if (gridDataLineA.objType == isDirectory) + if (gridDataLineA.objType == TYPE_DIRECTORY) stringA = gridDataLineA.relFilename; else stringA = gridDataLineA.relFilename.BeforeLast(GlobalResources::fileNameSeparator); - if (gridDataLineB.objType == isDirectory) + if (gridDataLineB.objType == TYPE_DIRECTORY) stringB = gridDataLineB.relFilename; else stringB = gridDataLineB.relFilename.BeforeLast(GlobalResources::fileNameSeparator); @@ -1932,13 +1915,13 @@ bool sortGridRight(const GridViewLine a, const GridViewLine b) case 2: //presort types: first files, then directories then empty rows - if (gridDataLineA.objType == isNothing) + if (gridDataLineA.objType == TYPE_NOTHING) return false; //empty rows always last - else if (gridDataLineB.objType == isNothing) + else if (gridDataLineB.objType == TYPE_NOTHING) return true; //empty rows always last - else if (gridDataLineA.objType == isDirectory) + else if (gridDataLineA.objType == TYPE_DIRECTORY) return false; - else if (gridDataLineB.objType == isDirectory) + else if (gridDataLineB.objType == TYPE_DIRECTORY) return true; else //use unformatted filesizes and sort by size return cmpLargeInt(gridDataLineA.fileSize, gridDataLineB.fileSize); @@ -2040,13 +2023,13 @@ void MainDialog::updateStatusInformation(const GridView& visibleGrid) const FileCompareLine& refLine = currentGridData[*i]; //calculate total number of bytes for each sied - if (refLine.fileDescrLeft.objType != isNothing) + if (refLine.fileDescrLeft.objType != TYPE_NOTHING) { filesizeLeftView+= refLine.fileDescrLeft.fileSize; ++objectsOnLeftView; } - if (refLine.fileDescrRight.objType != isNothing) + if (refLine.fileDescrRight.objType != TYPE_NOTHING) { filesizeRightView+= refLine.fileDescrRight.fileSize; ++objectsOnRightView; @@ -2094,28 +2077,38 @@ void MainDialog::mapGridDataToUI(GridView& output, const FileCompareResult& file { output.clear(); + //show only those view filter buttons that really need to be displayed + bool leftOnly, rightOnly, leftNewer, rightNewer, different, equal; + leftOnly = rightOnly = leftNewer = rightNewer = different = equal = false; + unsigned int currentRow = 0; for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); ++i, ++currentRow) { //process UI filter settings switch (i->cmpResult) { - case fileOnLeftSideOnly: + case FILE_LEFT_SIDE_ONLY: + leftOnly = true; if (!leftOnlyFilesActive) continue; break; - case fileOnRightSideOnly: + case FILE_RIGHT_SIDE_ONLY: + rightOnly = true; if (!rightOnlyFilesActive) continue; break; - case rightFileNewer: - if (!rightNewerFilesActive) continue; - break; - case leftFileNewer: + case FILE_LEFT_NEWER: + leftNewer = true; if (!leftNewerFilesActive) continue; break; - case filesDifferent: + case FILE_RIGHT_NEWER: + rightNewer = true; + if (!rightNewerFilesActive) continue; + break; + case FILE_DIFFERENT: + different = true; if (!differentFilesActive) continue; break; - case filesEqual: + case FILE_EQUAL: + equal = true; if (!equalFilesActive) continue; break; default: @@ -2129,6 +2122,47 @@ void MainDialog::mapGridDataToUI(GridView& output, const FileCompareResult& file output.push_back(currentRow); } + //hide or enable view filter buttons + if (leftOnly) + m_bpButtonLeftOnly->Show(); + else + m_bpButtonLeftOnly->Hide(); + + if (rightOnly) + m_bpButtonRightOnly->Show(); + else + m_bpButtonRightOnly->Hide(); + + if (leftNewer) + m_bpButtonLeftNewer->Show(); + else + m_bpButtonLeftNewer->Hide(); + + if (rightNewer) + m_bpButtonRightNewer->Show(); + else + m_bpButtonRightNewer->Hide(); + + if (different) + m_bpButtonDifferent->Show(); + else + m_bpButtonDifferent->Hide(); + + if (equal) + m_bpButtonEqual->Show(); + else + m_bpButtonEqual->Hide(); + + if (leftOnly || rightOnly || leftNewer || rightNewer || different || equal) + { + m_panel12->Show(); + m_panel12->Layout(); + } + else + m_panel12->Hide(); + + bSizer3->Layout(); + //sorting is expensive: do performance measurements before implementing here! } //######################################################################################################## @@ -2150,12 +2184,12 @@ CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg) : mainDialog->m_dirPicker1->Disable(); mainDialog->m_dirPicker2->Disable(); mainDialog->m_bpButtonSwap->Disable(); - mainDialog->m_bpButton20->Disable(); - mainDialog->m_bpButton21->Disable(); - mainDialog->m_bpButton22->Disable(); - mainDialog->m_bpButton23->Disable(); - mainDialog->m_bpButton24->Disable(); - mainDialog->m_bpButton25->Disable(); + mainDialog->m_bpButtonLeftOnly->Disable(); + mainDialog->m_bpButtonLeftNewer->Disable(); + mainDialog->m_bpButtonEqual->Disable(); + mainDialog->m_bpButtonDifferent->Disable(); + mainDialog->m_bpButtonRightNewer->Disable(); + mainDialog->m_bpButtonRightOnly->Disable(); mainDialog->m_panel1->Disable(); mainDialog->m_panel2->Disable(); mainDialog->m_panel3->Disable(); @@ -2197,12 +2231,12 @@ CompareStatusUpdater::~CompareStatusUpdater() mainDialog->m_dirPicker1->Enable(); mainDialog->m_dirPicker2->Enable(); mainDialog->m_bpButtonSwap->Enable(); - mainDialog->m_bpButton20->Enable(); - mainDialog->m_bpButton21->Enable(); - mainDialog->m_bpButton22->Enable(); - mainDialog->m_bpButton23->Enable(); - mainDialog->m_bpButton24->Enable(); - mainDialog->m_bpButton25->Enable(); + mainDialog->m_bpButtonLeftOnly->Enable(); + mainDialog->m_bpButtonLeftNewer->Enable(); + mainDialog->m_bpButtonEqual->Enable(); + mainDialog->m_bpButtonDifferent->Enable(); + mainDialog->m_bpButtonRightNewer->Enable(); + mainDialog->m_bpButtonRightOnly->Enable(); mainDialog->m_panel1->Enable(); mainDialog->m_panel2->Enable(); mainDialog->m_panel3->Enable(); @@ -2323,24 +2357,29 @@ SyncStatusUpdater::~SyncStatusUpdater() { result = wxString(_("Warning: Synchronization failed for ")) + numberToWxString(failedItems) + _(" item(s):\n\n"); for (unsigned int j = 0; j < failedItems; ++j) - result+= unhandledErrors[j] + "\n"; - result+= "\n"; + result+= unhandledErrors[j] + wxT("\n"); + result+= wxT("\n"); } - if (failedItems) - result+= _("Not all items have been synchronized! You may try to synchronize the remaining items again (WITHOUT having to re-compare)!"); - else if (abortionRequested) - result+= _("Synchronization aborted: You may try to synchronize remaining items again (WITHOUT having to re-compare)!"); - - syncStatusFrame->setStatusText_NoUpdate(result); - //notify to syncStatusFrame that current process has ended if (abortionRequested) - syncStatusFrame->processHasFinished(SyncStatus::statusAborted); //enable okay and close events - else if (failedItems) - syncStatusFrame->processHasFinished(SyncStatus::statusCompletedWithErrors); + { + result+= wxString(_("Synchronization aborted!")) + _(" You may try to synchronize remaining items again (WITHOUT having to re-compare)!"); + syncStatusFrame->setStatusText_NoUpdate(result); + syncStatusFrame->processHasFinished(SyncStatus::ABORTED); //enable okay and close events + } + else if (failedItems) + { + result+= wxString(_("Synchronization completed with errors!")) + _(" You may try to synchronize remaining items again (WITHOUT having to re-compare)!"); + syncStatusFrame->setStatusText_NoUpdate(result); + syncStatusFrame->processHasFinished(SyncStatus::FINISHED_WITH_ERROR); + } else - syncStatusFrame->processHasFinished(SyncStatus::statusCompletedWithSuccess); + { + result+= _("Synchronization completed successfully."); + syncStatusFrame->setStatusText_NoUpdate(result); + syncStatusFrame->processHasFinished(SyncStatus::FINISHED_WITH_SUCCESS); + } } @@ -2356,7 +2395,7 @@ void SyncStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, int p assert (processID == FreeFileSync::synchronizeFilesProcess); syncStatusFrame->resetGauge(objectsTotal, dataTotal); - syncStatusFrame->setCurrentStatus(SyncStatus::statusSynchronizing); + syncStatusFrame->setCurrentStatus(SyncStatus::SYNCHRONIZING); } @@ -2375,14 +2414,12 @@ int SyncStatusUpdater::reportError(const wxString& text) return StatusUpdater::continueNext; } - syncStatusFrame->updateStatusDialogNow(); - wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?"); - ErrorDlg* errorDlg = new ErrorDlg(errorMessage, continueError); + syncStatusFrame->updateStatusDialogNow(); int rv = errorDlg->ShowModal(); - errorDlg->Destroy(); + errorDlg->Destroy(); //dialog is not connected to any window => needs to be deleted manually switch (rv) { @@ -2399,18 +2436,17 @@ int SyncStatusUpdater::reportError(const wxString& text) } default: assert (false); + return StatusUpdater::continueNext; } - - return StatusUpdater::continueNext; //dummy return value } void SyncStatusUpdater::triggerUI_Refresh() { if (abortionRequested) - throw AbortThisProcess(); //abort can be triggered by syncStatusFrame + throw AbortThisProcess(); //abort can be triggered by syncStatusFrame - if (updateUI_IsAllowed()) //test if specific time span between ui updates is over + if (updateUI_IsAllowed()) //test if specific time span between ui updates is over syncStatusFrame->updateStatusDialogNow(); } @@ -2421,15 +2457,15 @@ void SyncStatusUpdater::triggerUI_Refresh() void MainDialog::OnMenuExportFileList(wxCommandEvent& event) { //get a filename - wxString fileName = "FileList.csv"; //proposal - wxFileDialog* filePicker = new wxFileDialog(this, "", "", fileName, wxString(_("Comma separated list")) + " (*.csv)|*.csv", wxFD_SAVE); + wxString fileName = wxT("FileList.csv"); //proposal + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, fileName, wxString(_("Comma separated list")) + wxT(" (*.csv)|*.csv"), wxFD_SAVE); if (filePicker->ShowModal() == wxID_OK) { fileName = filePicker->GetPath(); if (wxFileExists(fileName)) { - wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString("\"") + fileName + "\"" + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); + wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString(wxT("\"")) + fileName + wxT("\"") + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); if (messageDlg->ShowModal() != wxID_OK) { @@ -2474,7 +2510,7 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) } else { - wxMessageBox(wxString(_("Could not write to ")) + "\"" + fileName + "\"", _("An exception occured!"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("Could not write to ")) + wxT("\"") + fileName + wxT("\""), _("An exception occured!"), wxOK | wxICON_ERROR); } } diff --git a/ui/MainDialog.h b/ui/MainDialog.h index d60c489d..3bc4c590 100644 --- a/ui/MainDialog.h +++ b/ui/MainDialog.h @@ -26,10 +26,10 @@ using namespace std; //IDs for context menu items enum ContextItem { - contextManualFilter = 10, - contextCopyClipboard, - contextOpenExplorer, - contextDeleteFiles + CONTEXT_MANUAL_FILTER = 10, + CONTEXT_CLIPBOARD, + CONTEXT_EXPLORER, + CONTEXT_DELETE_FILES }; extern int leadingPanel; @@ -128,7 +128,6 @@ private: void OnSync( wxCommandEvent& event); void OnClose( wxCloseEvent& event); void OnQuit( wxCommandEvent& event); - void OnAbout( wxCommandEvent& event); //menu events void OnMenuExportFileList( wxCommandEvent& event); diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp index 36c5cae4..3961e28a 100644 --- a/ui/SmallDialogs.cpp +++ b/ui/SmallDialogs.cpp @@ -13,8 +13,14 @@ AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window) m_bitmap11->SetBitmap(*GlobalResources::bitmapLogo); m_bitmap13->SetBitmap(*GlobalResources::bitmapGPL); - //build - wxString build = wxString(_("(Build: ")) + __TDATE__ + ")"; + //build information + wxString build = wxString(_("(Build: ")) + __TDATE__; +#if wxUSE_UNICODE + build+= wxT(" - Unicode"); +#else + build+= wxT(" - ANSI"); +#endif //wxUSE_UNICODE + build+= + wxT(")"); m_build->SetLabel(build); m_animationControl1->SetAnimation(*GlobalResources::animationMoney); @@ -219,9 +225,9 @@ RemainingTime::~RemainingTime() ofstream output("test.txt"); for (unsigned i = 0; i < x.size(); ++i) { - output<<x[i]<<" "<<f[i]<<endl; + output<<x[i]<<" "<<f[i]<<'\n'; } - output<<endl<<z_1<<" "<<z_2<<endl; + output<<'\n'<<z_1<<" "<<z_2<<'\n'; output.close(); } @@ -363,7 +369,7 @@ void SyncStatus::updateStatusDialogNow() //support for pause button while (processPaused && currentProcessIsRunning) { - wxMilliSleep(uiUpdateInterval); + wxMilliSleep(UI_UPDATE_INTERVAL); updateUI_Now(); } } @@ -373,37 +379,37 @@ void SyncStatus::setCurrentStatus(SyncStatusID id) { switch (id) { - case statusAborted: + case ABORTED: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusError); m_staticTextStatus->SetLabel(_("Aborted")); break; - case statusCompletedWithSuccess: + case FINISHED_WITH_SUCCESS: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSuccess); m_staticTextStatus->SetLabel(_("Completed")); break; - case statusCompletedWithErrors: + case FINISHED_WITH_ERROR: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusWarning); m_staticTextStatus->SetLabel(_("Completed")); break; - case statusPause: + case PAUSE: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusPause); m_staticTextStatus->SetLabel(_("Pause")); break; - case statusScanning: + case SCANNING: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing); m_staticTextStatus->SetLabel(_("Scanning...")); break; - case statusComparing: + case COMPARING: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing); m_staticTextStatus->SetLabel(_("Comparing...")); break; - case statusSynchronizing: + case SYNCHRONIZING: m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSyncing); m_staticTextStatus->SetLabel(_("Synchronizing...")); break; diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h index c6495c83..127947f6 100644 --- a/ui/SmallDialogs.h +++ b/ui/SmallDialogs.h @@ -86,18 +86,18 @@ private: class SyncStatus : public SyncStatusDlgGenerated { public: - SyncStatus(StatusUpdater* updater, wxWindow* parentWindow = 0); + SyncStatus(StatusUpdater* updater, wxWindow* parentWindow = NULL); ~SyncStatus(); enum SyncStatusID { - statusAborted, - statusCompletedWithSuccess, - statusCompletedWithErrors, - statusPause, - statusScanning, - statusComparing, - statusSynchronizing + ABORTED, + FINISHED_WITH_SUCCESS, + FINISHED_WITH_ERROR, + PAUSE, + SCANNING, + COMPARING, + SYNCHRONIZING }; void resetGauge(int totalObjectsToProcess, double totalDataToProcess); diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp index c138544e..efe85553 100644 --- a/ui/SyncDialog.cpp +++ b/ui/SyncDialog.cpp @@ -2,8 +2,10 @@ #include "../library/globalFunctions.h" #include "../library/resources.h" #include <wx/msgdlg.h> -#include <wx/file.h> #include <wx/stdpaths.h> +#include <fstream> + +using namespace std; SyncDialog::SyncDialog(wxWindow* window, const FileCompareResult& gridDataRef, @@ -41,18 +43,18 @@ SyncDialog::SyncDialog(wxWindow* window, } //set radiobutton - if (localSyncConfiguration.exLeftSideOnly == syncDirRight && - localSyncConfiguration.exRightSideOnly == syncDirRight && - localSyncConfiguration.leftNewer == syncDirRight && - localSyncConfiguration.rightNewer == syncDirRight && - localSyncConfiguration.different == syncDirRight) + if (localSyncConfiguration.exLeftSideOnly == SYNC_DIR_RIGHT && + localSyncConfiguration.exRightSideOnly == SYNC_DIR_RIGHT && + localSyncConfiguration.leftNewer == SYNC_DIR_RIGHT && + localSyncConfiguration.rightNewer == SYNC_DIR_RIGHT && + localSyncConfiguration.different == SYNC_DIR_RIGHT) m_radioBtn1->SetValue(true); //one way -> - else if (localSyncConfiguration.exLeftSideOnly == syncDirRight && - localSyncConfiguration.exRightSideOnly == syncDirLeft && - localSyncConfiguration.leftNewer == syncDirRight && - localSyncConfiguration.rightNewer == syncDirLeft && - localSyncConfiguration.different == syncDirNone) + else if (localSyncConfiguration.exLeftSideOnly == SYNC_DIR_RIGHT && + localSyncConfiguration.exRightSideOnly == SYNC_DIR_LEFT && + localSyncConfiguration.leftNewer == SYNC_DIR_RIGHT && + localSyncConfiguration.rightNewer == SYNC_DIR_LEFT && + localSyncConfiguration.different == SYNC_DIR_NONE) m_radioBtn2->SetValue(true); //two way <-> else @@ -73,81 +75,81 @@ void SyncDialog::updateConfigIcons(wxBitmapButton* button1, wxBitmapButton* button5, const SyncConfiguration& syncConfig) { - if (syncConfig.exLeftSideOnly == syncDirRight) + if (syncConfig.exLeftSideOnly == SYNC_DIR_RIGHT) { button1->SetBitmapLabel(*GlobalResources::bitmapRightArrow); button1->SetToolTip(_("Copy from left to right")); } - else if (syncConfig.exLeftSideOnly == syncDirLeft) + else if (syncConfig.exLeftSideOnly == SYNC_DIR_LEFT) { button1->SetBitmapLabel(*GlobalResources::bitmapDelete); button1->SetToolTip(_("Delete files/folders existing on left side only")); } - else if (syncConfig.exLeftSideOnly == syncDirNone) + else if (syncConfig.exLeftSideOnly == SYNC_DIR_NONE) { button1->SetBitmapLabel(*GlobalResources::bitmapNoArrow); button1->SetToolTip(_("Do nothing")); } - if (syncConfig.exRightSideOnly == syncDirRight) + if (syncConfig.exRightSideOnly == SYNC_DIR_RIGHT) { button2->SetBitmapLabel(*GlobalResources::bitmapDelete); button2->SetToolTip(_("Delete files/folders existing on right side only")); } - else if (syncConfig.exRightSideOnly == syncDirLeft) + else if (syncConfig.exRightSideOnly == SYNC_DIR_LEFT) { button2->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); button2->SetToolTip(_("Copy from right to left")); } - else if (syncConfig.exRightSideOnly == syncDirNone) + else if (syncConfig.exRightSideOnly == SYNC_DIR_NONE) { button2->SetBitmapLabel(*GlobalResources::bitmapNoArrow); button2->SetToolTip(_("Do nothing")); } - if (syncConfig.leftNewer == syncDirRight) + if (syncConfig.leftNewer == SYNC_DIR_RIGHT) { button3->SetBitmapLabel(*GlobalResources::bitmapRightArrow); button3->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.leftNewer == syncDirLeft) + else if (syncConfig.leftNewer == SYNC_DIR_LEFT) { button3->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); button3->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.leftNewer == syncDirNone) + else if (syncConfig.leftNewer == SYNC_DIR_NONE) { button3->SetBitmapLabel(*GlobalResources::bitmapNoArrow); button3->SetToolTip(_("Do nothing")); } - if (syncConfig.rightNewer == syncDirRight) + if (syncConfig.rightNewer == SYNC_DIR_RIGHT) { button4->SetBitmapLabel(*GlobalResources::bitmapRightArrow); button4->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.rightNewer == syncDirLeft) + else if (syncConfig.rightNewer == SYNC_DIR_LEFT) { button4->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); button4->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.rightNewer == syncDirNone) + else if (syncConfig.rightNewer == SYNC_DIR_NONE) { button4->SetBitmapLabel(*GlobalResources::bitmapNoArrow); button4->SetToolTip(_("Do nothing")); } - if (syncConfig.different == syncDirRight) + if (syncConfig.different == SYNC_DIR_RIGHT) { button5->SetBitmapLabel(*GlobalResources::bitmapRightArrow); button5->SetToolTip(_("Copy from left to right overwriting")); } - else if (syncConfig.different == syncDirLeft) + else if (syncConfig.different == SYNC_DIR_LEFT) { button5->SetBitmapLabel(*GlobalResources::bitmapLeftArrow); button5->SetToolTip(_("Copy from right to left overwriting")); } - else if (syncConfig.different == syncDirNone) + else if (syncConfig.different == SYNC_DIR_NONE) { button5->SetBitmapLabel(*GlobalResources::bitmapNoArrow); button5->SetToolTip(_("Do nothing")); @@ -233,11 +235,11 @@ void SyncDialog::OnSelectRecycleBin(wxCommandEvent& event) void SyncDialog::OnSyncLeftToRight(wxCommandEvent& event) { - localSyncConfiguration.exLeftSideOnly = syncDirRight; - localSyncConfiguration.exRightSideOnly = syncDirRight; - localSyncConfiguration.leftNewer = syncDirRight; - localSyncConfiguration.rightNewer = syncDirRight; - localSyncConfiguration.different = syncDirRight; + localSyncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; + localSyncConfiguration.exRightSideOnly = SYNC_DIR_RIGHT; + localSyncConfiguration.leftNewer = SYNC_DIR_RIGHT; + localSyncConfiguration.rightNewer = SYNC_DIR_RIGHT; + localSyncConfiguration.different = SYNC_DIR_RIGHT; updateConfigIcons(m_bpButton5, m_bpButton6, m_bpButton7, m_bpButton8, m_bpButton9, localSyncConfiguration); calculatePreview(); @@ -249,11 +251,11 @@ void SyncDialog::OnSyncLeftToRight(wxCommandEvent& event) void SyncDialog::OnSyncBothSides(wxCommandEvent& event) { - localSyncConfiguration.exLeftSideOnly = syncDirRight; - localSyncConfiguration.exRightSideOnly = syncDirLeft; - localSyncConfiguration.leftNewer = syncDirRight; - localSyncConfiguration.rightNewer = syncDirLeft; - localSyncConfiguration.different = syncDirNone; + localSyncConfiguration.exLeftSideOnly = SYNC_DIR_RIGHT; + localSyncConfiguration.exRightSideOnly = SYNC_DIR_LEFT; + localSyncConfiguration.leftNewer = SYNC_DIR_RIGHT; + localSyncConfiguration.rightNewer = SYNC_DIR_LEFT; + localSyncConfiguration.different = SYNC_DIR_NONE; updateConfigIcons(m_bpButton5, m_bpButton6, m_bpButton7, m_bpButton8, m_bpButton9, localSyncConfiguration); calculatePreview(); @@ -265,12 +267,12 @@ void SyncDialog::OnSyncBothSides(wxCommandEvent& event) void toggleSyncDirection(SyncDirection& current) { - if (current == syncDirRight) - current = syncDirLeft; - else if (current == syncDirLeft) - current = syncDirNone; - else if (current== syncDirNone) - current = syncDirRight; + if (current == SYNC_DIR_RIGHT) + current = SYNC_DIR_LEFT; + else if (current == SYNC_DIR_LEFT) + current = SYNC_DIR_NONE; + else if (current== SYNC_DIR_NONE) + current = SYNC_DIR_RIGHT; else assert (false); } @@ -338,10 +340,10 @@ BatchDialog::BatchDialog(wxWindow* window, switch (config.compareVar) { - case compareByTimeAndSize: + case CMP_BY_TIME_SIZE: m_radioBtnSizeDate->SetValue(true); break; - case compareByContent: + case CMP_BY_CONTENT: m_radioBtnContent->SetValue(true); break; default: @@ -459,13 +461,32 @@ void BatchDialog::OnCancel(wxCommandEvent& event) void BatchDialog::OnCreateJob(wxCommandEvent& event) { + if (m_directoryPanel1->GetValue().IsEmpty() || m_directoryPanel2->GetValue().IsEmpty()) + { + wxMessageBox(_("Please select both left and right directories!"), _("Information")); + return; + } + + //check if directories exist if loaded by config file + if (!wxDirExists(m_directoryPanel1->GetValue())) + { + wxMessageBox(_("Left directory does not exist. Please select a new one!"), _("Warning"), wxICON_WARNING); + return; + } + else if (!wxDirExists(m_directoryPanel2->GetValue())) + { + wxMessageBox(_("Right directory does not exist. Please select a new one!"), _("Warning"), wxICON_WARNING); + return; + } + + //get a filename #ifdef FFS_WIN - wxString fileName = "SyncJob.cmd"; //proposal - wxFileDialog* filePicker = new wxFileDialog(this, "", "", fileName, wxString(_("Command file")) + " (*.cmd)|*.cmd", wxFD_SAVE); + wxString fileName = wxT("SyncJob.cmd"); //proposal + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, fileName, wxString(_("Command file")) + wxT(" (*.cmd)|*.cmd"), wxFD_SAVE); #elif defined FFS_LINUX - wxString fileName = "SyncJob.sh"; //proposal - wxFileDialog* filePicker = new wxFileDialog(this, "", "", fileName, wxString(_("Shell script")) + " (*.sh)|*.sh", wxFD_SAVE); + wxString fileName = wxT("SyncJob.sh"); //proposal + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, fileName, wxString(_("Shell script")) + wxT(" (*.sh)|*.sh"), wxFD_SAVE); #else assert(false); #endif @@ -475,7 +496,7 @@ void BatchDialog::OnCreateJob(wxCommandEvent& event) fileName = filePicker->GetPath(); if (wxFileExists(fileName)) { - wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString("\"") + fileName + "\"" + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); + wxMessageDialog* messageDlg = new wxMessageDialog(this, wxString(wxT("\"")) + fileName + wxT("\"") + _(" already exists. Overwrite?"), _("Warning") , wxOK | wxCANCEL); if (messageDlg->ShowModal() != wxID_OK) { @@ -488,19 +509,19 @@ void BatchDialog::OnCreateJob(wxCommandEvent& event) wxString outputString = parseConfiguration(); //write export file - wxFile output(fileName, wxFile::write); - if (output.IsOpened()) + ofstream output(fileName.c_str()); + if (output) { - output.Write(outputString); + output<<outputString.c_str(); EndModal(batchFileCreated); } else - wxMessageBox(wxString(_("Could not write to ")) + "\"" + fileName + "\"", _("An exception occured!"), wxOK | wxICON_ERROR); + wxMessageBox(wxString(_("Could not write to ")) + wxT("\"") + fileName + wxT("\""), _("An exception occured!"), wxOK | wxICON_ERROR); } #ifdef FFS_LINUX //for linux the batch file needs the executable flag - wxExecute(wxString("chmod +x ") + fileName); + wxExecute(wxString(wxT("chmod +x ")) + fileName); #endif // FFS_LINUX event.Skip(); @@ -509,11 +530,11 @@ void BatchDialog::OnCreateJob(wxCommandEvent& event) wxString getFormattedSyncDirection(const SyncDirection direction) { - if (direction == syncDirRight) + if (direction == SYNC_DIR_RIGHT) return 'R'; - else if (direction == syncDirLeft) + else if (direction == SYNC_DIR_LEFT) return 'L'; - else if (direction == syncDirNone) + else if (direction == SYNC_DIR_NONE) return 'N'; else { @@ -526,15 +547,14 @@ wxString getFormattedSyncDirection(const SyncDirection direction) wxString BatchDialog::parseConfiguration() { wxString output; - #ifdef FFS_LINUX //shell script identifier - output+= "#!/bin/bash\n"; + output+= wxT("#!/bin/bash\n"); #endif - output+= "\"" + wxStandardPaths::Get().GetExecutablePath() + "\""; + output+= wxString(wxT("\"")) + wxStandardPaths::Get().GetExecutablePath() + wxT("\""); - output+= wxString(" -") + GlobalResources::paramCompare + " "; + output+= wxString(wxT(" -")) + GlobalResources::paramCompare + wxT(" "); if (m_radioBtnSizeDate->GetValue()) output+= GlobalResources::valueSizeDate; else if (m_radioBtnContent->GetValue()) @@ -542,7 +562,7 @@ wxString BatchDialog::parseConfiguration() else assert(false); - output+= wxString(" -") + GlobalResources::paramCfg + " " + + output+= wxString(wxT(" -")) + GlobalResources::paramCfg + wxT(" ") + getFormattedSyncDirection(localSyncConfiguration.exLeftSideOnly) + getFormattedSyncDirection(localSyncConfiguration.exRightSideOnly) + getFormattedSyncDirection(localSyncConfiguration.leftNewer) + @@ -551,26 +571,26 @@ wxString BatchDialog::parseConfiguration() if (filterIsActive) { - output+= wxString(" -") + GlobalResources::paramInclude + " " + - "\"" + m_textCtrlInclude->GetValue() + "\""; + output+= wxString(wxT(" -")) + GlobalResources::paramInclude + wxT(" ") + + wxT("\"") + m_textCtrlInclude->GetValue() + wxT("\""); - output+= wxString(" -") + GlobalResources::paramExclude + " " + - "\"" + m_textCtrlExclude->GetValue() + "\""; + output+= wxString(wxT(" -")) + GlobalResources::paramExclude + wxT(" ") + + wxT("\"") + m_textCtrlExclude->GetValue() + wxT("\""); } if (m_checkBoxUseRecycler->GetValue()) - output+= wxString(" -") + GlobalResources::paramRecycler; + output+= wxString(wxT(" -")) + GlobalResources::paramRecycler; if (m_checkBoxContinueError->GetValue()) - output+= wxString(" -") + GlobalResources::paramContinueError; + output+= wxString(wxT(" -")) + GlobalResources::paramContinueError; if (m_checkBoxSilent->GetValue()) - output+= wxString(" -") + GlobalResources::paramSilent; + output+= wxString(wxT(" -")) + GlobalResources::paramSilent; - output+= wxString(" ") + "\"" + m_directoryPanel1->GetValue() + "\""; - output+= wxString(" ") + "\"" + m_directoryPanel2->GetValue() + "\""; + output+= wxString(wxT(" ")) + wxT("\"") + wxDir(m_directoryPanel1->GetValue()).GetName() + wxT("\""); //directory WITHOUT trailing path separator + output+= wxString(wxT(" ")) + wxT("\"") + wxDir(m_directoryPanel2->GetValue()).GetName() + wxT("\""); //needed since e.g. "C:\" isn't parsed correctly by commandline - output+= "\n"; + output+= wxT("\n"); return output; } diff --git a/ui/guiGenerated.cpp b/ui/guiGenerated.cpp index 56feba35..be1db069 100644 --- a/ui/guiGenerated.cpp +++ b/ui/guiGenerated.cpp @@ -72,7 +72,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit bSizer6 = new wxBoxSizer( wxHORIZONTAL ); - bSizer6->Add( 40, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer6->Add( 15, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxBoxSizer* bSizer30; bSizer30 = new wxBoxSizer( wxHORIZONTAL ); @@ -145,7 +145,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_hyperlinkCfgFilter->SetNormalColour( wxColour( 0, 0, 255 ) ); m_hyperlinkCfgFilter->SetVisitedColour( wxColour( 0, 0, 255 ) ); - m_hyperlinkCfgFilter->SetBackgroundColour( wxColour( 128, 128, 150 ) ); + m_hyperlinkCfgFilter->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) ); bSizer23->Add( m_hyperlinkCfgFilter, 0, wxALL, 5 ); @@ -172,7 +172,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit bSizer6->Add( m_bpButtonSync, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - bSizer6->Add( 40, 0, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer6->Add( 15, 0, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); m_panel71->SetSizer( bSizer6 ); m_panel71->Layout(); @@ -340,16 +340,6 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_panel4 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); bSizer3 = new wxBoxSizer( wxHORIZONTAL ); - m_bpButton11 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 50,50 ), wxBU_AUTODRAW ); - m_bpButton11->SetToolTip( _("About") ); - - m_bpButton11->SetToolTip( _("About") ); - - bSizer3->Add( m_bpButton11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - - bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); - wxBoxSizer* bSizer58; bSizer58 = new wxBoxSizer( wxVERTICAL ); @@ -371,85 +361,87 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit sbSizer16->Add( m_choiceLoad, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer58->Add( sbSizer16, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer58->Add( sbSizer16, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); bSizer58->Add( 0, 4, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer3->Add( bSizer58, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + bSizer3->Add( bSizer58, 1, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); - - bSizer59 = new wxBoxSizer( wxVERTICAL ); + m_panel12 = new wxPanel( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer64; + bSizer64 = new wxBoxSizer( wxVERTICAL ); wxStaticBoxSizer* sbSizer31; - sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( m_panel4, wxID_ANY, _("Filter view") ), wxHORIZONTAL ); - - m_bpButton20 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton20->SetToolTip( _("Files that exist on left view only") ); - - m_bpButton20->SetToolTip( _("Files that exist on left view only") ); + sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( m_panel12, wxID_ANY, _("Filter view") ), wxHORIZONTAL ); - sbSizer31->Add( m_bpButton20, 0, wxALIGN_CENTER_VERTICAL, 5 ); + sbSizer31->SetMinSize( wxSize( 100,-1 ) ); - m_bpButton21 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton21->SetToolTip( _("Files that are newer on left") ); + sbSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bpButton21->SetToolTip( _("Files that are newer on left") ); + m_bpButtonLeftOnly = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonLeftOnly->SetToolTip( _("Show files that exist on left side only") ); - sbSizer31->Add( m_bpButton21, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonLeftOnly->SetToolTip( _("Show files that exist on left side only") ); - m_bpButton25 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton25->SetToolTip( _("Files that are equal") ); + sbSizer31->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButton25->SetToolTip( _("Files that are equal") ); + m_bpButtonLeftNewer = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonLeftNewer->SetToolTip( _("Show files that are newer on left") ); - sbSizer31->Add( m_bpButton25, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonLeftNewer->SetToolTip( _("Show files that are newer on left") ); - m_bpButton22 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton22->SetToolTip( _("Files that are different") ); + sbSizer31->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButton22->SetToolTip( _("Files that are different") ); + m_bpButtonEqual = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonEqual->SetToolTip( _("Show files that are equal") ); - sbSizer31->Add( m_bpButton22, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonEqual->SetToolTip( _("Show files that are equal") ); - m_bpButton23 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton23->SetToolTip( _("Files that are newer on right") ); + sbSizer31->Add( m_bpButtonEqual, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButton23->SetToolTip( _("Files that are newer on right") ); + m_bpButtonDifferent = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonDifferent->SetToolTip( _("Show files that are different") ); - sbSizer31->Add( m_bpButton23, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonDifferent->SetToolTip( _("Show files that are different") ); - m_bpButton24 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); - m_bpButton24->SetToolTip( _("Files that exist on right view only") ); + sbSizer31->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_bpButton24->SetToolTip( _("Files that exist on right view only") ); + m_bpButtonRightNewer = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonRightNewer->SetToolTip( _("Show files that are newer on right") ); - sbSizer31->Add( m_bpButton24, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonRightNewer->SetToolTip( _("Show files that are newer on right") ); - bSizer59->Add( sbSizer31, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizer31->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bpButtonRightOnly = new wxBitmapButton( m_panel12, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW ); + m_bpButtonRightOnly->SetToolTip( _("Show files that exist on right side only") ); - bSizer59->Add( 0, 4, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + m_bpButtonRightOnly->SetToolTip( _("Show files that exist on right side only") ); - bSizer3->Add( bSizer59, 0, wxALIGN_CENTER_VERTICAL, 5 ); + sbSizer31->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + sbSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer64->Add( sbSizer31, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer3->Add( 185, 0, 0, wxALL, 5 ); + m_panel12->SetSizer( bSizer64 ); + m_panel12->Layout(); + bSizer64->Fit( m_panel12 ); + bSizer3->Add( m_panel12, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 4 ); - - bSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); + wxBoxSizer* bSizer66; + bSizer66 = new wxBoxSizer( wxVERTICAL ); m_bpButton10 = new wxBitmapButton( m_panel4, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 50,50 ), wxBU_AUTODRAW ); m_bpButton10->SetToolTip( _("Quit") ); m_bpButton10->SetToolTip( _("Quit") ); - bSizer3->Add( m_bpButton10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + bSizer66->Add( m_bpButton10, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + + bSizer3->Add( bSizer66, 1, wxALIGN_CENTER_VERTICAL, 5 ); m_panel4->SetSizer( bSizer3 ); m_panel4->Layout(); @@ -552,16 +544,15 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); m_grid2->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); - m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); m_bpButton201->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); m_choiceLoad->Connect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); m_choiceLoad->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( GuiGenerated::OnLoadConfiguration ), NULL, this ); - m_bpButton20->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButton21->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButton25->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); - m_bpButton22->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); - m_bpButton23->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButton24->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButtonEqual->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); + m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); + m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); m_bpButton10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnQuit ), NULL, this ); } @@ -596,16 +587,15 @@ GuiGenerated::~GuiGenerated() m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this ); m_grid2->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this ); m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this ); - m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this ); m_bpButton201->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this ); m_choiceLoad->Disconnect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this ); m_choiceLoad->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( GuiGenerated::OnLoadConfiguration ), NULL, this ); - m_bpButton20->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); - m_bpButton21->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); - m_bpButton25->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); - m_bpButton22->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); - m_bpButton23->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); - m_bpButton24->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); + m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftOnlyFiles ), NULL, this ); + m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnLeftNewerFiles ), NULL, this ); + m_bpButtonEqual->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnEqualFiles ), NULL, this ); + m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnDifferentFiles ), NULL, this ); + m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightNewerFiles ), NULL, this ); + m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnRightOnlyFiles ), NULL, this ); m_bpButton10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnQuit ), NULL, this ); } @@ -1245,7 +1235,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr bSizer20->Add( 0, 5, 0, wxEXPAND, 5 ); - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, _("Compare by \"File size and date\"\n----------------------------------------\nThis compare variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time. For the latter the system's UTC time (coordinated word time) is used internally, although the local file time is displayed on the result list. So there are no problems concerning different time zones or daylight saving time.\n\nWhen \"Compare\" is triggered with this option set the following decision tree is processed:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n _________|_____________\n | | |\n left newer right newer different (but same date)\n\nAs a result 6 different status can be returned to categorize all files:\n\n- exists left only\n- exists right only\n- left newer\n- right newer\n- different (but same date)\n- equal\n\n\nCompare by \"File content\"\n----------------------------------------\nAs the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n\nAs a result the files are separated into the following categories:\n\n- exists left only\n- exists right only\n- different\n- equal"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, _("Compare by \"File size and date\"\n----------------------------------------\nThis variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time. (Notice that the file time may deviate up to 2 seconds.)\n\nWhen \"Compare\" is triggered with this option set the following decision tree is processed:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n _________|_____________\n | | |\n left newer right newer different (but same date)\n\nAs a result 6 different status can be returned to categorize all files:\n\n- exists left only\n- exists right only\n- left newer\n- right newer\n- different (but same date)\n- equal\n\n\nCompare by \"File content\"\n----------------------------------------\nAs the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n\nAs a result the files are separated into the following categories:\n\n- exists left only\n- exists right only\n- different\n- equal"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); m_textCtrl8->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) ); bSizer20->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); diff --git a/ui/guiGenerated.h b/ui/guiGenerated.h index de725c92..d46d2959 100644 --- a/ui/guiGenerated.h +++ b/ui/guiGenerated.h @@ -89,22 +89,17 @@ class GuiGenerated : public wxFrame CustomGrid* m_grid2; wxPanel* m_panel4; wxBoxSizer* bSizer3; - wxBitmapButton* m_bpButton11; - wxBitmapButton* m_bpButton201; wxChoice* m_choiceLoad; + wxPanel* m_panel12; - wxBoxSizer* bSizer59; - wxBitmapButton* m_bpButton20; - wxBitmapButton* m_bpButton21; - wxBitmapButton* m_bpButton25; - wxBitmapButton* m_bpButton22; - wxBitmapButton* m_bpButton23; - wxBitmapButton* m_bpButton24; - - - + wxBitmapButton* m_bpButtonLeftOnly; + wxBitmapButton* m_bpButtonLeftNewer; + wxBitmapButton* m_bpButtonEqual; + wxBitmapButton* m_bpButtonDifferent; + wxBitmapButton* m_bpButtonRightNewer; + wxBitmapButton* m_bpButtonRightOnly; wxBitmapButton* m_bpButton10; wxPanel* m_panel7; @@ -148,7 +143,6 @@ class GuiGenerated : public wxFrame virtual void OnDirChangedPanel2( wxFileDirPickerEvent& event ){ event.Skip(); } virtual void OnRightGridDoubleClick( wxGridEvent& event ){ event.Skip(); } virtual void OnSortRightGrid( wxGridEvent& event ){ event.Skip(); } - virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } virtual void OnSaveConfig( wxCommandEvent& event ){ event.Skip(); } virtual void OnChoiceKeyEvent( wxKeyEvent& event ){ event.Skip(); } virtual void OnLoadConfiguration( wxCommandEvent& event ){ event.Skip(); } |