diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/MainDialog.cpp | 539 | ||||
-rw-r--r-- | ui/MainDialog.h | 50 | ||||
-rw-r--r-- | ui/SmallDialogs.cpp | 116 | ||||
-rw-r--r-- | ui/SmallDialogs.h | 10 | ||||
-rw-r--r-- | ui/batchConfig.cpp | 802 | ||||
-rw-r--r-- | ui/batchConfig.h | 96 | ||||
-rw-r--r-- | ui/batchStatusHandler.cpp | 35 | ||||
-rw-r--r-- | ui/batchStatusHandler.h | 4 | ||||
-rw-r--r-- | ui/folderPair.h | 33 | ||||
-rw-r--r-- | ui/gridView.cpp | 8 | ||||
-rw-r--r-- | ui/gridView.h | 4 | ||||
-rw-r--r-- | ui/guiGenerated.cpp | 739 | ||||
-rw-r--r-- | ui/guiGenerated.h | 132 | ||||
-rw-r--r-- | ui/guiStatusHandler.cpp | 49 | ||||
-rw-r--r-- | ui/guiStatusHandler.h | 2 | ||||
-rw-r--r-- | ui/isNullFilter.h | 24 | ||||
-rw-r--r-- | ui/messagePopup.cpp | 12 | ||||
-rw-r--r-- | ui/messagePopup.h | 8 | ||||
-rw-r--r-- | ui/progressIndicator.cpp | 20 | ||||
-rw-r--r-- | ui/search.cpp | 1 | ||||
-rw-r--r-- | ui/settingsDialog.cpp | 1389 | ||||
-rw-r--r-- | ui/switchToGui.cpp | 27 | ||||
-rw-r--r-- | ui/switchToGui.h | 29 | ||||
-rw-r--r-- | ui/syncConfig.cpp | 477 | ||||
-rw-r--r-- | ui/syncConfig.h (renamed from ui/settingsDialog.h) | 100 |
25 files changed, 2271 insertions, 2435 deletions
diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp index 9c5e0f46..976b9bdb 100644 --- a/ui/MainDialog.cpp +++ b/ui/MainDialog.cpp @@ -18,13 +18,16 @@ #include "../comparison.h" #include "../synchronization.h" #include "../algorithm.h" +#include "../shared/appMain.h" #include "../shared/util.h" #include "checkVersion.h" #include "guiStatusHandler.h" -#include "settingsDialog.h" +#include "syncConfig.h" #include "../shared/localization.h" #include "../shared/stringConv.h" #include "smallDialogs.h" +#include "mouseMoveWindow.h" +#include "progressIndicator.h" #include "messagePopup.h" #include "../shared/dragAndDrop.h" #include "../library/filter.h" @@ -43,6 +46,8 @@ #include <wx/sound.h> #include "search.h" #include "../shared/helpProvider.h" +#include "isNullFilter.h" +#include "batchConfig.h" using namespace FreeFileSync; using FreeFileSync::CustomLocale; @@ -80,7 +85,7 @@ public: } //disable the sync button - mainDlg_.syncPreview.enableSynchronization(false); + mainDlg_.syncPreview->enableSynchronization(false); //clear grids mainDlg_.gridDataView->clearAllRows(); @@ -249,29 +254,88 @@ struct DirNotFound //################################################################################################################################## -MainDialog::MainDialog(wxFrame* frame, - const wxString& cfgFileName, - xmlAccess::XmlGlobalSettings& settings) : - MainDialogGenerated(frame), - globalSettings(settings), - gridDataView(new FreeFileSync::GridView()), - contextMenu(new wxMenu), //initialize right-click context menu; will be dynamically re-created on each R-mouse-click - compareStatus(*this), - cleanedUp(false), - lastSortColumn(-1), - lastSortGrid(NULL), -#ifdef FFS_WIN - updateFileIcons(new IconUpdater(m_gridLeft, m_gridRight)), - moveWholeWindow(this), -#endif - syncPreview(this) +MainDialog::MainDialog(const wxString& cfgFileName, xmlAccess::XmlGlobalSettings& settings) : + MainDialogGenerated(NULL) +{ + xmlAccess::XmlGuiConfig guiCfg; //structure to receive gui settings, already defaulted!! + + const wxString actualConfigFile = cfgFileName.empty() ? lastConfigFileName() : cfgFileName; + + bool loadCfgSuccess = false; + if (!cfgFileName.empty() || fileExists(wxToZ(lastConfigFileName()))) + { + //load XML + try + { + xmlAccess::readGuiOrBatchConfig(actualConfigFile, guiCfg); //allow reading batch configurations also + loadCfgSuccess = true; + } + catch (const xmlAccess::XmlError& error) + { + if (error.getSeverity() == xmlAccess::XmlError::WARNING) + wxMessageBox(error.show(), _("Warning"), wxOK | wxICON_WARNING); + else + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); + } + } + + init(guiCfg, + settings, + !cfgFileName.empty() && loadCfgSuccess); + + setLastUsedConfig(actualConfigFile, loadCfgSuccess ? guiCfg : xmlAccess::XmlGuiConfig()); //simulate changed config on parsing errors +} + + +MainDialog::MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, + xmlAccess::XmlGlobalSettings& settings, + bool startComparison) : + MainDialogGenerated(NULL) +{ + init(guiCfg, + settings, + startComparison); +} + + +MainDialog::~MainDialog() +{ + //keep non-inline destructor for std::auto_ptr to work with forward declaration + + cleanUp(true); //do NOT include any other code here! cleanUp() is re-used when switching languages +} + + +void MainDialog::init(const xmlAccess::XmlGuiConfig guiCfg, + xmlAccess::XmlGlobalSettings& settings, + bool startComparison) { wxWindowUpdateLocker dummy(this); //avoid display distortion -//avoid mirroring this dialog in RTL languages like Hebrew or Arabic + globalSettings = &settings; + gridDataView.reset(new FreeFileSync::GridView); + contextMenu.reset(new wxMenu); //initialize right-click context menu; will be dynamically re-created on each R-mouse-click + + compareStatus.reset(new CompareStatus(*this)); + cleanedUp = false; + lastSortColumn = -1; + lastSortGrid = NULL; +#ifdef FFS_WIN + updateFileIcons.reset(new IconUpdater(m_gridLeft, m_gridRight)); + moveWholeWindow.reset(new MouseMoveWindow(this)); +#endif + syncPreview.reset(new SyncPreview(this)); + + SetTitle(wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")); + + //avoid mirroring this dialog in RTL languages like Hebrew or Arabic SetLayoutDirection(wxLayout_LeftToRight); m_panelStatusBar->SetLayoutDirection(wxLayout_LeftToRight); + SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + + //notify about (logical) application main window => program won't quit, but stay on this dialog + FreeFileSync::AppMainWindow::setMainWindow(this); //init handling of first folder pair firstFolderPair.reset(new FirstFolderPairCfg(*this)); @@ -280,12 +344,7 @@ MainDialog::MainDialog(wxFrame* frame, //initialize and load configuration readGlobalSettings(); - - bool loadCfgSuccess = false; - if (cfgFileName.empty()) - loadCfgSuccess = readConfigurationFromXml(lastConfigFileName(), true); - else - loadCfgSuccess = readConfigurationFromXml(cfgFileName, true); + setCurrentConfiguration(guiCfg); //set icons for this dialog m_bpButton10->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("exit"))); @@ -321,9 +380,9 @@ MainDialog::MainDialog(wxFrame* frame, #ifdef FFS_WIN //allow moving main dialog by clicking (nearly) anywhere... - moveWholeWindow.connectSourceWindow(m_panel71); - moveWholeWindow.connectSourceWindow(m_panelBottom); - moveWholeWindow.connectSourceWindow(m_panelStatusBar); + moveWholeWindow->connectSourceWindow(m_panel71); + moveWholeWindow->connectSourceWindow(m_panelBottom); + moveWholeWindow->connectSourceWindow(m_panelStatusBar); #endif #ifdef FFS_LINUX @@ -354,6 +413,8 @@ MainDialog::MainDialog(wxFrame* frame, Connect(wxEVT_SIZE, wxSizeEventHandler(MainDialog::OnResize), NULL, this); Connect(wxEVT_MOVE, wxSizeEventHandler(MainDialog::OnResize), NULL, this); + m_bpButtonFilter->Connect(wxEVT_RIGHT_DOWN, wxCommandEventHandler(MainDialog::OnGlobalFilterOpenContext), NULL, this); + //calculate witdh of folder pair manually (if scrollbars are visible) m_scrolledWindowFolderPairs->Connect(wxEVT_SIZE, wxSizeEventHandler(MainDialog::OnResizeFolderPairs), NULL, this); @@ -367,15 +428,15 @@ MainDialog::MainDialog(wxFrame* frame, m_gridRight ->initSettings(m_gridLeft, m_gridMiddle, m_gridRight, gridDataView.get()); //disable sync button as long as "compare" hasn't been triggered. - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //mainly to update row label sizes... updateGuiGrid(); //integrate the compare status panel (in hidden state) - bSizer1->Insert(1, compareStatus.getAsWindow(), 0, wxEXPAND | wxBOTTOM, 5 ); + bSizer1->Insert(1, compareStatus->getAsWindow(), 0, wxEXPAND | wxBOTTOM, 5 ); Layout(); //avoid screen flicker when panel is shown later - compareStatus.getAsWindow()->Hide(); + compareStatus->getAsWindow()->Hide(); //correct width of swap button above middle grid const wxSize source = m_gridMiddle->GetSize(); @@ -392,7 +453,7 @@ MainDialog::MainDialog(wxFrame* frame, //---------------------------------------------------------------------------------------------------------------------------------------------------------------- //some convenience: if FFS is started with a *.ffs_gui file as commandline parameter AND all directories contained exist, comparison shall be started right off - if (!cfgFileName.empty() && loadCfgSuccess) + if (startComparison) { const FreeFileSync::MainConfiguration currMainCfg = getCurrentConfiguration().mainCfg; const bool allFoldersExist = !DirNotFound()(currMainCfg.firstPair) && @@ -408,15 +469,7 @@ MainDialog::MainDialog(wxFrame* frame, } -MainDialog::~MainDialog() -{ - //keep non-inline destructor for std::auto_ptr to work with forward declaration - - cleanUp(); //do NOT include any other code here! cleanUp() is re-used when switching languages -} - - -void MainDialog::cleanUp() +void MainDialog::cleanUp(bool saveLastUsedConfig) { if (!cleanedUp) { @@ -425,7 +478,8 @@ void MainDialog::cleanUp() //no need for wxEventHandler::Disconnect() here; done automatically when window is destoyed! //save configuration - writeConfigurationToXml(lastConfigFileName()); //don't throw exceptions in destructors + if (saveLastUsedConfig) + writeConfigurationToXml(lastConfigFileName()); //don't throw exceptions in destructors writeGlobalSettings(); } } @@ -434,10 +488,10 @@ void MainDialog::cleanUp() void MainDialog::readGlobalSettings() { //apply window size and position at program startup ONLY - widthNotMaximized = globalSettings.gui.widthNotMaximized; - heightNotMaximized = globalSettings.gui.heightNotMaximized; - posXNotMaximized = globalSettings.gui.posXNotMaximized; - posYNotMaximized = globalSettings.gui.posYNotMaximized; + widthNotMaximized = globalSettings->gui.widthNotMaximized; + heightNotMaximized = globalSettings->gui.heightNotMaximized; + posXNotMaximized = globalSettings->gui.posXNotMaximized; + posYNotMaximized = globalSettings->gui.posYNotMaximized; //apply window size and position if ( widthNotMaximized != wxDefaultCoord && @@ -448,68 +502,68 @@ void MainDialog::readGlobalSettings() else Centre(); - Maximize(globalSettings.gui.isMaximized); + Maximize(globalSettings->gui.isMaximized); //set column attributes - m_gridLeft->setColumnAttributes(globalSettings.gui.columnAttribLeft); - m_gridRight->setColumnAttributes(globalSettings.gui.columnAttribRight); + m_gridLeft->setColumnAttributes(globalSettings->gui.columnAttribLeft); + m_gridRight->setColumnAttributes(globalSettings->gui.columnAttribRight); //load list of last used configuration files (in reverse order) - for (std::vector<wxString>::reverse_iterator i = globalSettings.gui.cfgFileHistory.rbegin(); - i != globalSettings.gui.cfgFileHistory.rend(); + for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.cfgFileHistory.rbegin(); + i != globalSettings->gui.cfgFileHistory.rend(); ++i) addFileToCfgHistory(*i); //load list of last used folders - for (std::vector<wxString>::reverse_iterator i = globalSettings.gui.folderHistoryLeft.rbegin(); - i != globalSettings.gui.folderHistoryLeft.rend(); + for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.folderHistoryLeft.rbegin(); + i != globalSettings->gui.folderHistoryLeft.rend(); ++i) addLeftFolderToHistory(*i); - for (std::vector<wxString>::reverse_iterator i = globalSettings.gui.folderHistoryRight.rbegin(); - i != globalSettings.gui.folderHistoryRight.rend(); + for (std::vector<wxString>::reverse_iterator i = globalSettings->gui.folderHistoryRight.rbegin(); + i != globalSettings->gui.folderHistoryRight.rend(); ++i) addRightFolderToHistory(*i); //show/hide file icons #ifdef FFS_WIN - m_gridLeft->enableFileIcons(globalSettings.gui.showFileIconsLeft); - m_gridRight->enableFileIcons(globalSettings.gui.showFileIconsRight); + m_gridLeft->enableFileIcons(globalSettings->gui.showFileIconsLeft); + m_gridRight->enableFileIcons(globalSettings->gui.showFileIconsRight); #endif //set selected tab - m_notebookBottomLeft->ChangeSelection(globalSettings.gui.selectedTabBottomLeft); + m_notebookBottomLeft->ChangeSelection(globalSettings->gui.selectedTabBottomLeft); } void MainDialog::writeGlobalSettings() { //write global settings to (global) variable stored in application instance - globalSettings.gui.widthNotMaximized = widthNotMaximized; - globalSettings.gui.heightNotMaximized = heightNotMaximized; - globalSettings.gui.posXNotMaximized = posXNotMaximized; - globalSettings.gui.posYNotMaximized = posYNotMaximized; - globalSettings.gui.isMaximized = IsMaximized(); + globalSettings->gui.widthNotMaximized = widthNotMaximized; + globalSettings->gui.heightNotMaximized = heightNotMaximized; + globalSettings->gui.posXNotMaximized = posXNotMaximized; + globalSettings->gui.posYNotMaximized = posYNotMaximized; + globalSettings->gui.isMaximized = IsMaximized(); //retrieve column attributes - globalSettings.gui.columnAttribLeft = m_gridLeft->getColumnAttributes(); - globalSettings.gui.columnAttribRight = m_gridRight->getColumnAttributes(); + globalSettings->gui.columnAttribLeft = m_gridLeft->getColumnAttributes(); + globalSettings->gui.columnAttribRight = m_gridRight->getColumnAttributes(); //write list of last used configuration files - globalSettings.gui.cfgFileHistory = cfgFileNames; + globalSettings->gui.cfgFileHistory = cfgFileNames; //write list of last used folders - globalSettings.gui.folderHistoryLeft.clear(); + globalSettings->gui.folderHistoryLeft.clear(); const wxArrayString leftFolderHistory = m_directoryLeft->GetStrings(); for (unsigned i = 0; i < leftFolderHistory.GetCount(); ++i) - globalSettings.gui.folderHistoryLeft.push_back(leftFolderHistory[i]); + globalSettings->gui.folderHistoryLeft.push_back(leftFolderHistory[i]); - globalSettings.gui.folderHistoryRight.clear(); + globalSettings->gui.folderHistoryRight.clear(); const wxArrayString rightFolderHistory = m_directoryRight->GetStrings(); for (unsigned i = 0; i < rightFolderHistory.GetCount(); ++i) - globalSettings.gui.folderHistoryRight.push_back(rightFolderHistory[i]); + globalSettings->gui.folderHistoryRight.push_back(rightFolderHistory[i]); //get selected tab - globalSettings.gui.selectedTabBottomLeft = m_notebookBottomLeft->GetSelection(); + globalSettings->gui.selectedTabBottomLeft = m_notebookBottomLeft->GetSelection(); } @@ -743,11 +797,11 @@ void MainDialog::deleteSelectedFiles() if (FreeFileSync::showDeleteDialog(compRefLeft, compRefRight, - globalSettings.gui.deleteOnBothSides, - globalSettings.gui.useRecyclerForManualDeletion, + globalSettings->gui.deleteOnBothSides, + globalSettings->gui.useRecyclerForManualDeletion, totalDeleteCount) == DefaultReturnCode::BUTTON_OKAY) { - if (globalSettings.gui.useRecyclerForManualDeletion && !FreeFileSync::recycleBinExists()) + if (globalSettings->gui.useRecyclerForManualDeletion && !FreeFileSync::recycleBinExists()) { wxMessageBox(_("Recycle Bin not yet supported for this system!")); return; @@ -761,8 +815,8 @@ void MainDialog::deleteSelectedFiles() FreeFileSync::deleteFromGridAndHD(gridDataView->getDataTentative(), compRefLeft, compRefRight, - globalSettings.gui.deleteOnBothSides, - globalSettings.gui.useRecyclerForManualDeletion, + globalSettings->gui.deleteOnBothSides, + globalSettings->gui.useRecyclerForManualDeletion, getCurrentConfiguration().mainCfg, &statusHandler); } @@ -1023,7 +1077,7 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) break; case 'F': //CTRL + F - FreeFileSync::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings.gui.textSearchRespectCase); + FreeFileSync::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); break; case WXK_NUMPAD_ADD: //CTRL + '+' @@ -1082,7 +1136,7 @@ void MainDialog::onGridLeftButtonEvent(wxKeyEvent& event) case WXK_F3: //F3 case WXK_NUMPAD_F3: // - FreeFileSync::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings.gui.textSearchRespectCase); + FreeFileSync::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); break; } @@ -1121,7 +1175,7 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) break; case 'F': //CTRL + F - FreeFileSync::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings.gui.textSearchRespectCase); + FreeFileSync::startFind(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); break; case WXK_NUMPAD_ADD: //CTRL + '+' @@ -1180,7 +1234,7 @@ void MainDialog::onGridRightButtonEvent(wxKeyEvent& event) case WXK_F3: //F3 case WXK_NUMPAD_F3: // - FreeFileSync::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings.gui.textSearchRespectCase); + FreeFileSync::findNext(*this, *m_gridLeft, *m_gridRight, globalSettings->gui.textSearchRespectCase); break; } @@ -1245,9 +1299,9 @@ void MainDialog::OnContextRim(wxGridEvent& event) const std::set<size_t> selectionRight = getSelectedRows(m_gridRight); const size_t selectionBegin = selectionLeft.size() + selectionRight.size() == 0 ? 0 : - selectionLeft.size() == 0 ? *selectionRight.begin() : - selectionRight.size() == 0 ? *selectionLeft.begin() : - std::min(*selectionLeft.begin(), *selectionRight.begin()); + selectionLeft.size() == 0 ? *selectionRight.begin() : + selectionRight.size() == 0 ? *selectionLeft.begin() : + std::min(*selectionLeft.begin(), *selectionRight.begin()); const FileSystemObject* fsObj = gridDataView->getObject(selectionBegin); @@ -1256,7 +1310,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) //re-create context menu contextMenu.reset(new wxMenu); - if (syncPreview.previewIsEnabled() && + if (syncPreview->previewIsEnabled() && fsObj && fsObj->getSyncOperation() != SO_EQUAL) { if (selectionLeft.size() + selectionRight.size() > 0) @@ -1374,7 +1428,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) //CONTEXT_EXTERNAL_APP - if (!globalSettings.gui.externelApplications.empty()) + if (!globalSettings->gui.externelApplications.empty()) { contextMenu->AppendSeparator(); @@ -1382,8 +1436,8 @@ void MainDialog::OnContextRim(wxGridEvent& event) (selectionLeft.size() + selectionRight.size() == 1); int newID = externalAppIDFirst; - for (xmlAccess::ExternalApps::iterator i = globalSettings.gui.externelApplications.begin(); - i != globalSettings.gui.externelApplications.end(); + for (xmlAccess::ExternalApps::iterator i = globalSettings->gui.externelApplications.begin(); + i != globalSettings->gui.externelApplications.end(); ++i, ++newID) { //some trick to translate default external apps on the fly: 1. "open in explorer" 2. "start directly" @@ -1391,7 +1445,7 @@ void MainDialog::OnContextRim(wxGridEvent& event) if (description.empty()) description = wxT(" "); //wxWidgets doesn't like empty items - if (i == globalSettings.gui.externelApplications.begin()) + if (i == globalSettings->gui.externelApplications.begin()) contextMenu->Append(newID, description + wxT("\t") + wxString(_("D-Click")) + wxT("; ENTER")); else contextMenu->Append(newID, description); @@ -1452,12 +1506,13 @@ void MainDialog::OnContextExcludeExtension(wxCommandEvent& event) SelectedExtension* selExtension = dynamic_cast<SelectedExtension*>(event.m_callbackUserData); if (selExtension) { - if (!currentCfg.mainCfg.excludeFilter.empty() && !currentCfg.mainCfg.excludeFilter.EndsWith(DefaultStr(";"))) - currentCfg.mainCfg.excludeFilter += DefaultStr("\n"); + Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; + + if (!excludeFilter.empty() && !excludeFilter.EndsWith(DefaultStr(";"))) + excludeFilter += DefaultStr("\n"); - currentCfg.mainCfg.excludeFilter += Zstring(DefaultStr("*.")) + selExtension->extension + DefaultStr(";"); //';' is appended to 'mark' that next exclude extension entry won't write to new line + excludeFilter += Zstring(DefaultStr("*.")) + selExtension->extension + DefaultStr(";"); //';' is appended to 'mark' that next exclude extension entry won't write to new line - m_checkBoxActivateFilter->SetValue(true); updateFilterButtons(); applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative()); @@ -1482,16 +1537,17 @@ void MainDialog::OnContextExcludeObject(wxCommandEvent& event) { for (std::vector<FilterObject>::const_iterator i = objCont->selectedObjects.begin(); i != objCont->selectedObjects.end(); ++i) { - if (!currentCfg.mainCfg.excludeFilter.empty() && !currentCfg.mainCfg.excludeFilter.EndsWith(DefaultStr("\n"))) - currentCfg.mainCfg.excludeFilter += DefaultStr("\n"); + Zstring& excludeFilter = currentCfg.mainCfg.globalFilter.excludeFilter; + + if (!excludeFilter.empty() && !excludeFilter.EndsWith(DefaultStr("\n"))) + excludeFilter += DefaultStr("\n"); if (!i->isDir) - currentCfg.mainCfg.excludeFilter += Zstring() + globalFunctions::FILE_NAME_SEPARATOR + i->relativeName; + excludeFilter += Zstring() + globalFunctions::FILE_NAME_SEPARATOR + i->relativeName; else - currentCfg.mainCfg.excludeFilter += Zstring() + globalFunctions::FILE_NAME_SEPARATOR + i->relativeName + globalFunctions::FILE_NAME_SEPARATOR; + excludeFilter += Zstring() + globalFunctions::FILE_NAME_SEPARATOR + i->relativeName + globalFunctions::FILE_NAME_SEPARATOR; } - m_checkBoxActivateFilter->SetValue(true); updateFilterButtons(); applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative()); @@ -1529,8 +1585,8 @@ void MainDialog::OnContextOpenWith(wxCommandEvent& event) const int index = event.GetId() - externalAppIDFirst; if ( selection.size() == 1 && - 0 <= index && static_cast<size_t>(index) < globalSettings.gui.externelApplications.size()) - openExternalApplication(*selection.begin(), m_gridLeft->isLeadGrid(), globalSettings.gui.externelApplications[index].second); + 0 <= index && static_cast<size_t>(index) < globalSettings->gui.externelApplications.size()) + openExternalApplication(*selection.begin(), m_gridLeft->isLeadGrid(), globalSettings->gui.externelApplications[index].second); } } @@ -1574,7 +1630,7 @@ void MainDialog::OnContextRimLabelLeft(wxGridEvent& event) wxMenuItem* itemAutoAdjust = new wxMenuItem(contextMenu.get(), CONTEXT_AUTO_ADJUST_COLUMN_LEFT, _("Auto-adjust columns"), wxEmptyString, wxITEM_CHECK); contextMenu->Append(itemAutoAdjust); - itemAutoAdjust->Check(globalSettings.gui.autoAdjustColumnsLeft); + itemAutoAdjust->Check(globalSettings->gui.autoAdjustColumnsLeft); contextMenu->Connect(CONTEXT_CUSTOMIZE_COLUMN_LEFT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextCustColumnLeft), NULL, this); contextMenu->Connect(CONTEXT_AUTO_ADJUST_COLUMN_LEFT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextAutoAdjustLeft), NULL, this); @@ -1592,7 +1648,7 @@ void MainDialog::OnContextRimLabelRight(wxGridEvent& event) wxMenuItem* itemAutoAdjust = new wxMenuItem(contextMenu.get(), CONTEXT_AUTO_ADJUST_COLUMN_RIGHT, _("Auto-adjust columns"), wxEmptyString, wxITEM_CHECK); contextMenu->Append(itemAutoAdjust); - itemAutoAdjust->Check(globalSettings.gui.autoAdjustColumnsRight); + itemAutoAdjust->Check(globalSettings->gui.autoAdjustColumnsRight); contextMenu->Connect(CONTEXT_CUSTOMIZE_COLUMN_RIGHT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextCustColumnRight), NULL, this); contextMenu->Connect(CONTEXT_AUTO_ADJUST_COLUMN_RIGHT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnContextAutoAdjustRight), NULL, this); @@ -1633,14 +1689,14 @@ void MainDialog::OnContextCustColumnRight(wxCommandEvent& event) void MainDialog::OnContextAutoAdjustLeft(wxCommandEvent& event) { - globalSettings.gui.autoAdjustColumnsLeft = !globalSettings.gui.autoAdjustColumnsLeft; + globalSettings->gui.autoAdjustColumnsLeft = !globalSettings->gui.autoAdjustColumnsLeft; updateGuiGrid(); } void MainDialog::OnContextAutoAdjustRight(wxCommandEvent& event) { - globalSettings.gui.autoAdjustColumnsRight = !globalSettings.gui.autoAdjustColumnsRight; + globalSettings->gui.autoAdjustColumnsRight = !globalSettings->gui.autoAdjustColumnsRight; updateGuiGrid(); } @@ -1672,7 +1728,7 @@ void MainDialog::OnContextMiddleLabel(wxGridEvent& event) wxMenuItem* itemSyncPreview = new wxMenuItem(contextMenu.get(), CONTEXT_SYNC_PREVIEW, _("Synchronization Preview")); wxMenuItem* itemCmpResult = new wxMenuItem(contextMenu.get(), CONTEXT_COMPARISON_RESULT, _("Comparison Result")); - if (syncPreview.previewIsEnabled()) + if (syncPreview->previewIsEnabled()) itemSyncPreview->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("syncViewSmall"))); else itemCmpResult->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("cmpViewSmall"))); @@ -1703,13 +1759,13 @@ void MainDialog::OnContextExcludeAll(wxCommandEvent& event) void MainDialog::OnContextComparisonView(wxCommandEvent& event) { - syncPreview.enablePreview(false); //change view + syncPreview->enablePreview(false); //change view } void MainDialog::OnContextSyncView(wxCommandEvent& event) { - syncPreview.enablePreview(true); //change view + syncPreview->enablePreview(true); //change view } @@ -1718,7 +1774,7 @@ void MainDialog::OnDirSelected(wxFileDirPickerEvent& event) //left and right directory text-control and dirpicker are synchronized by MainFolderDragDrop automatically //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); @@ -1756,7 +1812,7 @@ private: void MainDialog::addFileToCfgHistory(const wxString& filename) { //only (still) existing files should be included in the list - if (!wxFileExists(filename)) + if (!fileExists(wxToZ(filename))) return; std::vector<wxString>::const_iterator i = find_if(cfgFileNames.begin(), cfgFileNames.end(), FindDuplicates(wxToZ(filename))); @@ -1779,24 +1835,24 @@ void MainDialog::addFileToCfgHistory(const wxString& filename) } //keep maximal size of history list - if (cfgFileNames.size() > globalSettings.gui.cfgHistoryMax) + if (cfgFileNames.size() > globalSettings->gui.cfgHistoryMax) { //delete last rows cfgFileNames.pop_back(); - m_choiceHistory->Delete(globalSettings.gui.cfgHistoryMax); + m_choiceHistory->Delete(globalSettings->gui.cfgHistoryMax); } } void MainDialog::addLeftFolderToHistory(const wxString& leftFolder) { - m_directoryLeft->addPairToFolderHistory(leftFolder, globalSettings.gui.folderHistLeftMax); + m_directoryLeft->addPairToFolderHistory(leftFolder, globalSettings->gui.folderHistLeftMax); } void MainDialog::addRightFolderToHistory(const wxString& rightFolder) { - m_directoryRight->addPairToFolderHistory(rightFolder, globalSettings.gui.folderHistRightMax); + m_directoryRight->addPairToFolderHistory(rightFolder, globalSettings->gui.folderHistRightMax); } @@ -1876,11 +1932,11 @@ void MainDialog::OnLoadFromHistory(wxCommandEvent& event) bool MainDialog::saveOldConfig() //return false on user abort { //notify user about changed settings - if (globalSettings.optDialogs.popupOnConfigChange && !currentConfigFileName.empty()) //only if check is active and non-default config file loaded + if (globalSettings->optDialogs.popupOnConfigChange && !currentConfigFileName.empty()) //only if check is active and non-default config file loaded { if (lastConfigurationSaved != getCurrentConfiguration()) { - bool dontShowAgain = !globalSettings.optDialogs.popupOnConfigChange; + bool dontShowAgain = !globalSettings->optDialogs.popupOnConfigChange; QuestionDlg* notifyChangeDlg = new QuestionDlg(this, QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_NO | QuestionDlg::BUTTON_CANCEL, @@ -1894,7 +1950,7 @@ bool MainDialog::saveOldConfig() //return false on user abort return false; break; case QuestionDlg::BUTTON_NO: - globalSettings.optDialogs.popupOnConfigChange = !dontShowAgain; + globalSettings->optDialogs.popupOnConfigChange = !dontShowAgain; break; case QuestionDlg::BUTTON_CANCEL: return false; @@ -1995,37 +2051,37 @@ void MainDialog::OnSetSyncDirection(FFSSyncDirectionEvent& event) } -bool MainDialog::readConfigurationFromXml(const wxString& filename, bool programStartup) +bool MainDialog::readConfigurationFromXml(const wxString& filename) { //load XML xmlAccess::XmlGuiConfig newGuiCfg; //structure to receive gui settings, already defaulted!! - bool parsingError = false; + bool parsingError = true; try { xmlAccess::readGuiOrBatchConfig(filename, newGuiCfg); //allow reading batch configurations also + parsingError = false; } catch (const xmlAccess::XmlError& error) { - if (programStartup && filename == lastConfigFileName() && !wxFileExists(filename)) //do not show error message in this case - ; + if (error.getSeverity() == xmlAccess::XmlError::WARNING) + wxMessageBox(error.show(), _("Warning"), wxOK | wxICON_WARNING); else { - parsingError = true; - - if (error.getSeverity() == xmlAccess::XmlError::WARNING) - wxMessageBox(error.show(), _("Warning"), wxOK | wxICON_WARNING); - else - { - wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); - if (!programStartup) - return false; - } + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); + return false; } } setCurrentConfiguration(newGuiCfg); - //########################################################### + setLastUsedConfig(filename, parsingError ? xmlAccess::XmlGuiConfig() : newGuiCfg); //simulate changed config on parsing errors + + return !parsingError; +} + + +void MainDialog::setLastUsedConfig(const wxString& filename, const xmlAccess::XmlGuiConfig& guiConfig) +{ addFileToCfgHistory(filename); //put filename on list of last used config files //set title @@ -2038,11 +2094,9 @@ bool MainDialog::readConfigurationFromXml(const wxString& filename, bool program { SetTitle(wxString(wxT("FreeFileSync - ")) + filename); currentConfigFileName = filename; - - lastConfigurationSaved = parsingError ? xmlAccess::XmlGuiConfig() : currentCfg; //simulate changed config on parsing errors } - return !parsingError; + lastConfigurationSaved = guiConfig; } @@ -2061,21 +2115,7 @@ bool MainDialog::writeConfigurationToXml(const wxString& filename) return false; } - //########################################################### - addFileToCfgHistory(filename); //put filename on list of last used config files - - lastConfigurationSaved = guiCfg; - - if (filename == lastConfigFileName()) //set title - { - SetTitle(wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")); - currentConfigFileName.clear(); - } - else - { - SetTitle(wxString(wxT("FreeFileSync - ")) + filename); - currentConfigFileName = filename; - } + setLastUsedConfig(filename, guiCfg); return true; } @@ -2088,7 +2128,7 @@ void MainDialog::setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCf //evaluate new settings... //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); @@ -2097,7 +2137,6 @@ void MainDialog::setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCf //(re-)set view filter buttons initViewFilterButtons(); - m_checkBoxActivateFilter->SetValue(currentCfg.mainCfg.filterIsActive); updateFilterButtons(); //set first folder pair @@ -2119,7 +2158,7 @@ void MainDialog::setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCf //read GUI layout m_checkBoxHideFilt->SetValue(currentCfg.hideFilteredElements); - syncPreview.enablePreview(currentCfg.syncPreviewEnabled); + syncPreview->enablePreview(currentCfg.syncPreviewEnabled); //########################################################### //update compare variant name @@ -2158,11 +2197,8 @@ xmlAccess::XmlGuiConfig MainDialog::getCurrentConfiguration() const std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(), std::back_inserter(guiCfg.mainCfg.additionalPairs), getEnahncedPair); - //filter active status - guiCfg.mainCfg.filterIsActive = m_checkBoxActivateFilter->GetValue(); - //sync preview - guiCfg.syncPreviewEnabled = syncPreview.previewIsEnabled(); + guiCfg.syncPreviewEnabled = syncPreview->previewIsEnabled(); return guiCfg; } @@ -2196,15 +2232,6 @@ void MainDialog::refreshGridAfterFilterChange(const int delay) } -void MainDialog::OnFilterButton(wxCommandEvent &event) -{ - //make sure, button-appearance and "m_checkBoxActivateFilter" are in sync. - updateFilterButtons(); - - updateFilterConfig(); //refresh filtering -} - - void MainDialog::OnHideFilteredButton(wxCommandEvent &event) { //toggle showing filtered rows @@ -2223,9 +2250,8 @@ void MainDialog::OnHideFilteredButton(wxCommandEvent &event) void MainDialog::OnConfigureFilter(wxCommandEvent &event) { if (showFilterDialog(true, //is main filter dialog - currentCfg.mainCfg.includeFilter, - currentCfg.mainCfg.excludeFilter, - m_checkBoxActivateFilter->GetValue()) == DefaultReturnCode::BUTTON_OKAY) + currentCfg.mainCfg.globalFilter.includeFilter, + currentCfg.mainCfg.globalFilter.excludeFilter) == DefaultReturnCode::BUTTON_OKAY) { updateFilterButtons(); //refresh global filter icon updateFilterConfig(); //re-apply filter @@ -2235,6 +2261,29 @@ void MainDialog::OnConfigureFilter(wxCommandEvent &event) } +void MainDialog::OnGlobalFilterOpenContext(wxCommandEvent& event) +{ + const int menuId = 1234; + contextMenu.reset(new wxMenu); //re-create context menu + contextMenu->Append(menuId, _("Clear filter settings")); + contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::OnGlobalFilterRemConfirm), NULL, this); + + if (isNullFilter(currentCfg.mainCfg.globalFilter)) + contextMenu->Enable(menuId, false); //disable menu item, if clicking wouldn't make sense anyway + + PopupMenu(contextMenu.get()); //show context menu +} + + +void MainDialog::OnGlobalFilterRemConfirm(wxCommandEvent& event) +{ + currentCfg.mainCfg.globalFilter = FilterConfig(); + + updateFilterButtons(); //refresh global filter icon + updateFilterConfig(); //re-apply filter +} + + void MainDialog::OnLeftOnlyFiles(wxCommandEvent& event) { m_bpButtonLeftOnly->toggle(); @@ -2438,35 +2487,22 @@ void MainDialog::updateFilterButtons() m_notebookBottomLeft->AssignImageList(panelIcons); //pass ownership } - //global filter - if (m_checkBoxActivateFilter->GetValue()) //filter active? + //global filter: test for Null-filter + if (isNullFilter(currentCfg.mainCfg.globalFilter)) { - //test for Null-filter - const bool isNullFilter = NameFilter(currentCfg.mainCfg.includeFilter, currentCfg.mainCfg.excludeFilter).isNull(); - if (isNullFilter) - { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); - m_bpButtonFilter->SetToolTip(_("No filter selected")); - - //additional filter icon - m_notebookBottomLeft->SetPageImage(1, 1); - } - else - { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); - m_bpButtonFilter->SetToolTip(_("Filter has been selected")); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); + m_bpButtonFilter->SetToolTip(_("No filter selected")); - //show filter icon - m_notebookBottomLeft->SetPageImage(1, 0); - } + //additional filter icon + m_notebookBottomLeft->SetPageImage(1, 1); } else { - m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); - m_bpButtonFilter->SetToolTip(_("Filtering is deactivated")); + m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); + m_bpButtonFilter->SetToolTip(_("Filter is active")); - //additional filter icon - m_notebookBottomLeft->SetPageImage(1, 1); + //show filter icon + m_notebookBottomLeft->SetPageImage(1, 0); } //update main local filter @@ -2499,10 +2535,11 @@ void MainDialog::OnCompare(wxCommandEvent &event) CompareStatusHandler statusHandler(this); //begin comparison - FreeFileSync::CompareProcess comparison(currentCfg.mainCfg.hidden.traverseDirectorySymlinks, + FreeFileSync::CompareProcess comparison(currentCfg.mainCfg.processSymlinks, + currentCfg.mainCfg.traverseDirectorySymlinks, currentCfg.mainCfg.hidden.fileTimeTolerance, - globalSettings.ignoreOneHourDiff, - globalSettings.optDialogs, + globalSettings->ignoreOneHourDiff, + globalSettings->optDialogs, &statusHandler); //technical representation of comparison data @@ -2528,14 +2565,14 @@ void MainDialog::OnCompare(wxCommandEvent &event) if (aborted) { //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); m_buttonCompare->SetFocus(); updateGuiGrid(); //refresh grid in ANY case! (also on abort) } else { //once compare is finished enable the sync button - syncPreview.enableSynchronization(true); + syncPreview->enableSynchronization(true); m_buttonStartSync->SetFocus(); //hide sort direction indicator on GUI grids @@ -2583,19 +2620,19 @@ void MainDialog::updateGuiGrid() if (nrOfRows >= 0) { #ifdef FFS_WIN - const unsigned int digitWidth = 8; + const size_t digitWidth = 8; #elif defined FFS_LINUX - const unsigned int digitWidth = 10; + const size_t digitWidth = 10; #endif - const unsigned int nrOfDigits = globalFunctions::getDigitCount(static_cast<unsigned int>(nrOfRows)); - m_gridLeft ->SetRowLabelSize(nrOfDigits * digitWidth + 4); - m_gridRight->SetRowLabelSize(nrOfDigits * digitWidth + 4); + const size_t nrOfDigits = globalFunctions::getDigitCount(static_cast<size_t>(nrOfRows)); + m_gridLeft ->SetRowLabelSize(static_cast<int>(nrOfDigits * digitWidth + 4)); + m_gridRight->SetRowLabelSize(static_cast<int>(nrOfDigits * digitWidth + 4)); } //support for column auto adjustment - if (globalSettings.gui.autoAdjustColumnsLeft) + if (globalSettings->gui.autoAdjustColumnsLeft) m_gridLeft->autoSizeColumns(); - if (globalSettings.gui.autoAdjustColumnsRight) + if (globalSettings->gui.autoAdjustColumnsRight) m_gridRight->autoSizeColumns(); //update sync preview statistics @@ -2626,7 +2663,7 @@ void MainDialog::calculatePreview() void MainDialog::OnSwitchView(wxCommandEvent& event) { //toggle view - syncPreview.enablePreview(!syncPreview.previewIsEnabled()); + syncPreview->enablePreview(!syncPreview->previewIsEnabled()); } @@ -2647,45 +2684,42 @@ void MainDialog::OnSyncSettings(wxCommandEvent& event) void MainDialog::OnCmpSettings(wxCommandEvent& event) { - CompareVariant newCmpVariant = currentCfg.mainCfg.compareVar; - //show window right next to the compare-config button wxPoint windowPos = m_bpButtonCmpConfig->GetScreenPosition(); windowPos.x += m_bpButtonCmpConfig->GetSize().GetWidth() + 5; - if (FreeFileSync::showCompareCfgDialog(windowPos, newCmpVariant) == DefaultReturnCode::BUTTON_OKAY) + if (FreeFileSync::showCompareCfgDialog(windowPos, + currentCfg.mainCfg.compareVar, + currentCfg.mainCfg.processSymlinks, + currentCfg.mainCfg.traverseDirectorySymlinks, + currentCfg.mainCfg.copyFileSymlinks) == DefaultReturnCode::BUTTON_OKAY) { - if (currentCfg.mainCfg.compareVar != newCmpVariant) - { - currentCfg.mainCfg.compareVar = newCmpVariant; - - //update compare variant name - m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(currentCfg.mainCfg.compareVar) + wxT(")")); - bSizer6->Layout(); //adapt layout for variant text + //update compare variant name + m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(currentCfg.mainCfg.compareVar) + wxT(")")); + bSizer6->Layout(); //adapt layout for variant text - //disable the sync button - syncPreview.enableSynchronization(false); + //disable the sync button + syncPreview->enableSynchronization(false); - //clear grids - gridDataView->clearAllRows(); - updateGuiGrid(); + //clear grids + gridDataView->clearAllRows(); + updateGuiGrid(); - m_buttonCompare->SetFocus(); - } + m_buttonCompare->SetFocus(); } } void MainDialog::OnStartSync(wxCommandEvent& event) { - if (!syncPreview.synchronizationIsEnabled()) + if (!syncPreview->synchronizationIsEnabled()) { pushStatusInformation(_("Please run a Compare first before synchronizing!")); return; } //show sync preview screen - if (globalSettings.optDialogs.showSummaryBeforeSync) + if (globalSettings->optDialogs.showSummaryBeforeSync) { bool dontShowAgain = false; @@ -2695,7 +2729,7 @@ void MainDialog::OnStartSync(wxCommandEvent& event) dontShowAgain) != DefaultReturnCode::BUTTON_OKAY) return; - globalSettings.optDialogs.showSummaryBeforeSync = !dontShowAgain; + globalSettings->optDialogs.showSummaryBeforeSync = !dontShowAgain; } //check if there are files/folders to be sync'ed at all @@ -2717,11 +2751,11 @@ void MainDialog::OnStartSync(wxCommandEvent& event) //start synchronization and mark all elements processed FreeFileSync::SyncProcess synchronization( - currentCfg.mainCfg.hidden.copyFileSymlinks, - currentCfg.mainCfg.hidden.traverseDirectorySymlinks, - globalSettings.optDialogs, + currentCfg.mainCfg.copyFileSymlinks, + currentCfg.mainCfg.traverseDirectorySymlinks, + globalSettings->optDialogs, currentCfg.mainCfg.hidden.verifyFileCopy, - globalSettings.copyLockedFiles, + globalSettings->copyLockedFiles, statusHandler); const std::vector<FreeFileSync::FolderPairSyncCfg> syncProcessCfg = FreeFileSync::extractSyncCfg(getCurrentConfiguration().mainCfg); @@ -2756,16 +2790,16 @@ void MainDialog::OnStartSync(wxCommandEvent& event) void MainDialog::OnLeftGridDoubleClick(wxGridEvent& event) { - if (!globalSettings.gui.externelApplications.empty()) - openExternalApplication(event.GetRow(), true, globalSettings.gui.externelApplications[0].second); + if (!globalSettings->gui.externelApplications.empty()) + openExternalApplication(event.GetRow(), true, globalSettings->gui.externelApplications[0].second); // event.Skip(); } void MainDialog::OnRightGridDoubleClick(wxGridEvent& event) { - if (!globalSettings.gui.externelApplications.empty()) - openExternalApplication(event.GetRow(), false, globalSettings.gui.externelApplications[0].second); + if (!globalSettings->gui.externelApplications.empty()) + openExternalApplication(event.GetRow(), false, globalSettings->gui.externelApplications[0].second); // event.Skip(); } @@ -2834,7 +2868,7 @@ void MainDialog::OnSortMiddleGrid(wxGridEvent& event) lastSortGrid = m_gridMiddle; //start sort - if (syncPreview.previewIsEnabled()) + if (syncPreview->previewIsEnabled()) gridDataView->sortView(GridView::SORT_BY_SYNC_DIRECTION, true, sortAscending); else gridDataView->sortView(GridView::SORT_BY_CMP_RESULT, true, sortAscending); @@ -2974,7 +3008,7 @@ void MainDialog::updateGridViewData() - if (syncPreview.previewIsEnabled()) + if (syncPreview->previewIsEnabled()) { const GridView::StatusSyncPreview result = gridDataView->updateSyncPreview(currentCfg.hideFilteredElements, m_bpButtonSyncCreateLeft-> isActive(), @@ -3194,7 +3228,7 @@ void MainDialog::OnAddFolderPair(wxCommandEvent& event) cfgEmpty.localFilter); //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); @@ -3204,16 +3238,8 @@ void MainDialog::OnAddFolderPair(wxCommandEvent& event) void MainDialog::updateFilterConfig() { - if (m_checkBoxActivateFilter->GetValue()) - { - applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative()); - refreshGridAfterFilterChange(400); - } - else - { - FreeFileSync::setActiveStatus(true, gridDataView->getDataTentative()); - refreshGridAfterFilterChange(0); - } + applyFiltering(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative()); + refreshGridAfterFilterChange(400); } @@ -3247,7 +3273,7 @@ void MainDialog::updateSyncConfig() private: bool& warningSyncDatabase_; wxWindow* parent_; - } redetCallback(globalSettings.optDialogs.warningSyncDatabase, this); + } redetCallback(globalSettings->optDialogs.warningSyncDatabase, this); FreeFileSync::redetermineSyncDirection(getCurrentConfiguration().mainCfg, gridDataView->getDataTentative(), &redetCallback); updateGuiGrid(); @@ -3271,7 +3297,7 @@ void MainDialog::OnRemoveTopFolderPair(wxCommandEvent& event) //------------------------------------------------------------------ //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); @@ -3290,7 +3316,7 @@ void MainDialog::OnRemoveFolderPair(wxCommandEvent& event) //------------------------------------------------------------------ //disable the sync button - syncPreview.enableSynchronization(false); + syncPreview->enableSynchronization(false); //clear grids gridDataView->clearAllRows(); @@ -3394,7 +3420,7 @@ void MainDialog::addFolderPair(const std::vector<FolderPairEnh>& newPairs, bool } -void MainDialog::removeAddFolderPair(const unsigned int pos) +void MainDialog::removeAddFolderPair(size_t pos) { wxWindowUpdateLocker dummy(this); //avoid display distortion @@ -3439,7 +3465,7 @@ void MainDialog::clearAddFolderPairs() //menu events void MainDialog::OnMenuGlobalSettings(wxCommandEvent& event) { - FreeFileSync::showGlobalSettingsDlg(globalSettings); + FreeFileSync::showGlobalSettingsDlg(*globalSettings); //event.Skip(); } @@ -3470,7 +3496,7 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) wxString exportString; //write legend exportString += wxString(_("Legend")) + wxT('\n'); - if (syncPreview.previewIsEnabled()) + if (syncPreview->previewIsEnabled()) { exportString += wxString(wxT("\"")) + getDescription(SO_CREATE_NEW_LEFT) + wxT("\";") + getSymbol(SO_CREATE_NEW_LEFT) + wxT('\n'); exportString += wxString(wxT("\"")) + getDescription(SO_CREATE_NEW_RIGHT) + wxT("\";") + getSymbol(SO_CREATE_NEW_RIGHT) + wxT('\n'); @@ -3584,7 +3610,7 @@ void MainDialog::OnRegularUpdateCheck(wxIdleEvent& event) //execute just once per startup! Disconnect(wxEVT_IDLE, wxIdleEventHandler(MainDialog::OnRegularUpdateCheck), NULL, this); - FreeFileSync::checkForUpdatePeriodically(globalSettings.gui.lastUpdateCheck); + FreeFileSync::checkForUpdatePeriodically(globalSettings->gui.lastUpdateCheck); } @@ -3628,14 +3654,15 @@ void MainDialog::OnMenuQuit(wxCommandEvent& event) //language selection void MainDialog::switchProgramLanguage(const int langID) { + //create new dialog with respect to new language CustomLocale::getInstance().setLanguage(langID); //language is a global attribute - //create new main window and delete old one - cleanUp(); //destructor's code: includes writing settings to HD + const xmlAccess::XmlGuiConfig currentGuiCfg = getCurrentConfiguration(); - //create new dialog with respect to new language - MainDialog* frame = new MainDialog(NULL, wxEmptyString, globalSettings); - frame->SetIcon(*GlobalResources::getInstance().programIcon); //set application icon + cleanUp(false); //destructor's code: includes updating global settings + + //create new main window and delete old one + MainDialog* frame = new MainDialog(currentGuiCfg, *globalSettings, false); frame->Show(); Destroy(); diff --git a/ui/MainDialog.h b/ui/MainDialog.h index 5f28b36c..3142cab8 100644 --- a/ui/MainDialog.h +++ b/ui/MainDialog.h @@ -13,8 +13,6 @@ #include <memory> #include <map> #include <set> -#include "mouseMoveWindow.h" -#include "progressIndicator.h" class CompareStatusHandler; class MainFolderDragDrop; @@ -25,17 +23,30 @@ class IconUpdater; class ManualDeletionHandler; class FolderPairPanel; class FirstFolderPairCfg; +class CompareStatus; namespace FreeFileSync { class CustomLocale; class GridView; +class MouseMoveWindow; } class MainDialog : public MainDialogGenerated { +public: + MainDialog(const wxString& cfgFileName, + xmlAccess::XmlGlobalSettings& settings); + + MainDialog(const xmlAccess::XmlGuiConfig& guiCfg, + xmlAccess::XmlGlobalSettings& settings, + bool startComparison); + + ~MainDialog(); + +private: friend class CompareStatusHandler; friend class ManualDeletionHandler; friend class MainFolderDragDrop; @@ -76,20 +87,18 @@ class MainDialog : public MainDialogGenerated CONTEXT_SYNC_PREVIEW }; + MainDialog(); -public: - MainDialog(wxFrame* frame, - const wxString& cfgFileName, - xmlAccess::XmlGlobalSettings& settings); - - ~MainDialog(); + void init(const xmlAccess::XmlGuiConfig guiCfg, + xmlAccess::XmlGlobalSettings& settings, + bool startComparison); -private: - void cleanUp(); +void cleanUp(bool saveLastUsedConfig); //configuration load/save - bool readConfigurationFromXml(const wxString& filename, bool programStartup = false); + bool readConfigurationFromXml(const wxString& filename); bool writeConfigurationToXml(const wxString& filename); + void setLastUsedConfig(const wxString& filename, const xmlAccess::XmlGuiConfig& guiConfig); xmlAccess::XmlGuiConfig getCurrentConfiguration() const; void setCurrentConfiguration(const xmlAccess::XmlGuiConfig& newGuiCfg); @@ -111,7 +120,7 @@ private: void addRightFolderToHistory(const wxString& rightFolder); void addFolderPair(const std::vector<FreeFileSync::FolderPairEnh>& newPairs, bool addFront = false); - void removeAddFolderPair(const unsigned int pos); + void removeAddFolderPair(size_t pos); void clearAddFolderPairs(); void updateGuiForFolderPair(); //helper method: add usability by showing/hiding buttons related to folder pairs @@ -213,7 +222,6 @@ private: void OnResize( wxSizeEvent& event); void OnResizeFolderPairs( wxSizeEvent& event); - void OnFilterButton( wxCommandEvent& event); void OnHideFilteredButton( wxCommandEvent& event); void OnConfigureFilter( wxCommandEvent& event); void OnSwapSides( wxCommandEvent& event); @@ -225,6 +233,9 @@ private: void OnClose( wxCloseEvent& event); void OnQuit( wxCommandEvent& event); + void OnGlobalFilterOpenContext(wxCommandEvent& event); + void OnGlobalFilterRemConfirm(wxCommandEvent& event); + void calculatePreview(); void OnAddFolderPair( wxCommandEvent& event); @@ -254,7 +265,7 @@ private: //application variables are stored here: //global settings used by GUI and batch mode - xmlAccess::XmlGlobalSettings& globalSettings; + xmlAccess::XmlGlobalSettings* globalSettings; //always bound //UI view of FolderComparison structure std::auto_ptr<FreeFileSync::GridView> gridDataView; @@ -283,14 +294,14 @@ private: std::stack<wxString> stackObjects; //compare status panel (hidden on start, shown when comparing) - CompareStatus compareStatus; + std::auto_ptr<CompareStatus> compareStatus; //always bound + +bool cleanedUp; //save the last used config filename history std::vector<wxString> cfgFileNames; - bool cleanedUp; //determines if destructor code was already executed - //remember last sort executed (for determination of sort order) int lastSortColumn; const wxGrid* lastSortGrid; @@ -300,7 +311,7 @@ private: std::auto_ptr<IconUpdater> updateFileIcons; //enable moving window by clicking on sub-windows instead of header line - FreeFileSync::MouseMoveWindow moveWholeWindow; + std::auto_ptr<FreeFileSync::MouseMoveWindow> moveWholeWindow; #endif //encapsulation of handling of sync preview @@ -319,7 +330,8 @@ private: MainDialog* mainDlg_; bool syncPreviewEnabled; //toggle to display configuration preview instead of comparison result bool synchronizationEnabled; //determines whether synchronization should be allowed - } syncPreview; + }; + std::auto_ptr<SyncPreview> syncPreview; //always bound }; #endif // MAINDIALOG_H diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp index bd90f14d..04456024 100644 --- a/ui/SmallDialogs.cpp +++ b/ui/SmallDialogs.cpp @@ -185,8 +185,7 @@ public: FilterDlg(wxWindow* window, bool isGlobalFilter, Zstring& filterIncl, - Zstring& filterExcl, - bool filterActive); + Zstring& filterExcl); ~FilterDlg() {} enum @@ -210,8 +209,7 @@ private: FilterDlg::FilterDlg(wxWindow* window, bool isGlobalFilter, //global or local filter dialog? Zstring& filterIncl, - Zstring& filterExcl, - bool filterActive) : + Zstring& filterExcl) : FilterDlgGenerated(window), isGlobalFilter_(isGlobalFilter), includeFilter(filterIncl), @@ -228,14 +226,11 @@ FilterDlg::FilterDlg(wxWindow* window, m_panel13->Hide(); m_button10->SetFocus(); - if (filterActive) - m_staticTextFilteringInactive->Hide(); - //adapt header for global/local dialog if (isGlobalFilter_) - m_staticTexHeader->SetLabel(_("Global filter")); + m_staticTexHeader->SetLabel(_("Filter: All pairs")); else - m_staticTexHeader->SetLabel(_("Local filter")); + m_staticTexHeader->SetLabel(_("Filter: Single pair")); Fit(); } @@ -299,15 +294,13 @@ void FilterDlg::OnClose(wxCloseEvent& event) DefaultReturnCode::Response FreeFileSync::showFilterDialog(bool isGlobalFilter, Zstring& filterIncl, - Zstring& filterExcl, - bool filterActive) + Zstring& filterExcl) { DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; FilterDlg* filterDlg = new FilterDlg(NULL, isGlobalFilter, //is main filter dialog filterIncl, - filterExcl, - filterActive); + filterExcl); if (filterDlg->ShowModal() == FilterDlg::BUTTON_APPLY) rv = DefaultReturnCode::BUTTON_OKAY; @@ -687,7 +680,12 @@ DefaultReturnCode::Response FreeFileSync::showSyncPreviewDlg( class CompareCfgDialog : public CmpCfgDlgGenerated { public: - CompareCfgDialog(wxWindow* parentWindow, const wxPoint& position, FreeFileSync::CompareVariant& cmpVar); + CompareCfgDialog(wxWindow* parentWindow, + const wxPoint& position, + FreeFileSync::CompareVariant& cmpVar, + bool& processSymlinks, + bool& traverseDirectorySymlinks, + bool& copyFileSymlinks); enum { @@ -695,19 +693,35 @@ public: }; private: + void OnOkay(wxCommandEvent& event); void OnClose(wxCloseEvent& event); void OnCancel(wxCommandEvent& event); void OnTimeSize(wxCommandEvent& event); void OnContent(wxCommandEvent& event); + void OnIncludeSymlinks(wxCommandEvent& event); + void OnTraverseDirSymlink(wxCommandEvent& event); void OnShowHelp(wxCommandEvent& event); - FreeFileSync::CompareVariant& m_cmpVar; + void updateView(); + + FreeFileSync::CompareVariant& cmpVarOut; + bool& processSymlinksOut; + bool& traverseDirectorySymlinksOut; + bool& copyFileSymlinksOut; }; -CompareCfgDialog::CompareCfgDialog(wxWindow* parentWindow, const wxPoint& position, CompareVariant& cmpVar) : +CompareCfgDialog::CompareCfgDialog(wxWindow* parentWindow, + const wxPoint& position, + CompareVariant& cmpVar, + bool& processSymlinks, + bool& traverseDirectorySymlinks, + bool& copyFileSymlinks) : CmpCfgDlgGenerated(parentWindow), - m_cmpVar(cmpVar) + cmpVarOut(cmpVar), + processSymlinksOut(processSymlinks), + traverseDirectorySymlinksOut(traverseDirectorySymlinks), + copyFileSymlinksOut(copyFileSymlinks) { //move dialog up so that compare-config button and first config-variant are on same level Move(wxPoint(position.x, std::max(0, position.y - (m_buttonTimeSize->GetScreenPosition() - GetScreenPosition()).y))); @@ -727,9 +741,49 @@ CompareCfgDialog::CompareCfgDialog(wxWindow* parentWindow, const wxPoint& positi m_buttonTimeSize->SetFocus(); //set focus on the other button break; } + + m_checkBoxIncludeSymlinks->SetValue(processSymlinksOut); +// m_checkBoxTraverseDirSymlink->SetValue(traverseDirectorySymlinksOut); +// m_checkBoxCopyFileSymlink->SetValue(copyFileSymlinksOut); + + updateView(); +} + +void CompareCfgDialog::updateView() +{ Fit(); } +void CompareCfgDialog::OnOkay(wxCommandEvent& event) +{ + if (m_radioBtnContent->GetValue()) + cmpVarOut = CMP_BY_CONTENT; + else + cmpVarOut = CMP_BY_TIME_SIZE; + + processSymlinksOut = m_checkBoxIncludeSymlinks->GetValue(); +// traverseDirectorySymlinksOut = m_checkBoxTraverseDirSymlink->GetValue(); +// copyFileSymlinksOut = m_checkBoxCopyFileSymlink->GetValue(); + + //simplify GUI: set reasonable default values for "traverseDirectorySymlinks" and "copyFileSymlinks" + traverseDirectorySymlinksOut = true; + copyFileSymlinksOut = false; + + EndModal(BUTTON_OKAY); +} + +void CompareCfgDialog::OnIncludeSymlinks(wxCommandEvent& event) +{ + updateView(); + event.Skip(); +} + +void CompareCfgDialog::OnTraverseDirSymlink(wxCommandEvent& event) +{ + updateView(); + event.Skip(); +} + void CompareCfgDialog::OnClose(wxCloseEvent& event) { @@ -745,15 +799,15 @@ void CompareCfgDialog::OnCancel(wxCommandEvent& event) void CompareCfgDialog::OnTimeSize(wxCommandEvent& event) { - m_cmpVar = CMP_BY_TIME_SIZE; - EndModal(BUTTON_OKAY); + m_radioBtnSizeDate->SetValue(true); + OnOkay(event); } void CompareCfgDialog::OnContent(wxCommandEvent& event) { - m_cmpVar = CMP_BY_CONTENT; - EndModal(BUTTON_OKAY); + m_radioBtnContent->SetValue(true); + OnOkay(event); } @@ -764,17 +818,18 @@ void CompareCfgDialog::OnShowHelp(wxCommandEvent& event) } -DefaultReturnCode::Response FreeFileSync::showCompareCfgDialog(const wxPoint& position, CompareVariant& cmpVar) +DefaultReturnCode::Response FreeFileSync::showCompareCfgDialog( + const wxPoint& position, + CompareVariant& cmpVar, + bool& processSymlinks, + bool& traverseDirectorySymlinks, + bool& copyFileSymlinks) { - DefaultReturnCode::Response rv = DefaultReturnCode::BUTTON_CANCEL; + CompareCfgDialog syncDlg(NULL, position, cmpVar, processSymlinks, traverseDirectorySymlinks, copyFileSymlinks); - CompareCfgDialog* syncDlg = new CompareCfgDialog(NULL, position, cmpVar); - if (syncDlg->ShowModal() == CompareCfgDialog::BUTTON_OKAY) - rv = DefaultReturnCode::BUTTON_OKAY; - - syncDlg->Destroy(); - - return rv; + return syncDlg.ShowModal() == CompareCfgDialog::BUTTON_OKAY ? + DefaultReturnCode::BUTTON_OKAY : + DefaultReturnCode::BUTTON_CANCEL; } //######################################################################################## @@ -818,7 +873,6 @@ GlobalSettingsDlg::GlobalSettingsDlg(wxWindow* window, xmlAccess::XmlGlobalSetti m_checkBoxCopyLocked->SetValue(globalSettings.copyLockedFiles); #ifndef FFS_WIN - m_staticTextCopyLocked->Hide(); m_checkBoxCopyLocked->Hide(); #endif diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h index 73e4d13a..74c12f33 100644 --- a/ui/SmallDialogs.h +++ b/ui/SmallDialogs.h @@ -30,8 +30,7 @@ void showHelpDialog(); DefaultReturnCode::Response showFilterDialog(bool isGlobalFilter, Zstring& filterIncl, - Zstring& filterExcl, - bool filterActive); + Zstring& filterExcl); DefaultReturnCode::Response showDeleteDialog( const std::vector<FileSystemObject*>& rowsOnLeft, @@ -47,7 +46,12 @@ DefaultReturnCode::Response showSyncPreviewDlg( const SyncStatistics& statistics, bool& dontShowAgain); -DefaultReturnCode::Response showCompareCfgDialog(const wxPoint& position, CompareVariant& cmpVar); +DefaultReturnCode::Response showCompareCfgDialog( + const wxPoint& position, + CompareVariant& cmpVar, + bool& processSymlinks, + bool& traverseDirectorySymlinks, + bool& copyFileSymlinks); DefaultReturnCode::Response showGlobalSettingsDlg(xmlAccess::XmlGlobalSettings& globalSettings); } diff --git a/ui/batchConfig.cpp b/ui/batchConfig.cpp new file mode 100644 index 00000000..e58821e4 --- /dev/null +++ b/ui/batchConfig.cpp @@ -0,0 +1,802 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#include "batchConfig.h" +#include "../shared/xmlBase.h" +#include "folderPair.h" +#include <wx/wupdlock.h> +#include "../shared/helpProvider.h" +#include "../shared/fileHandling.h" +#include "messagePopup.h" +#include <wx/dnd.h> +#include <wx/msgdlg.h> + +using namespace FreeFileSync; + + +class BatchFileDropEvent : public wxFileDropTarget +{ +public: + BatchFileDropEvent(BatchDialog& dlg) : + batchDlg(dlg) {} + + virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) + { + if (!filenames.IsEmpty()) + { + const wxString droppedFileName = filenames[0]; + + xmlAccess::XmlType fileType = xmlAccess::getXmlType(droppedFileName); + + //test if ffs batch file has been dropped + if (fileType == xmlAccess::XML_BATCH_CONFIG) + batchDlg.loadBatchFile(droppedFileName); + else + { + wxString errorMessage = _("%x is not a valid FreeFileSync batch file!"); + errorMessage.Replace(wxT("%x"), wxString(wxT("\"")) + droppedFileName + wxT("\""), false); + wxMessageBox(errorMessage, _("Error"), wxOK | wxICON_ERROR); + } + } + return false; + } + +private: + BatchDialog& batchDlg; +}; + +//################################################################################################################################### + +//------------------------------------------------------------------ +/* class hierarchy: + + template<> + FolderPairPanelBasic + /|\ + | + template<> + FolderPairCallback BatchFolderPairGenerated + /|\ /|\ + _________|______________ ________| + | | | + FirstBatchFolderPairCfg BatchFolderPairPanel +*/ + +template <class GuiPanel> +class FolderPairCallback : public FolderPairPanelBasic<GuiPanel> //implements callback functionality to BatchDialog as imposed by FolderPairPanelBasic +{ +public: + FolderPairCallback(GuiPanel& basicPanel, BatchDialog& batchDialog) : + FolderPairPanelBasic<GuiPanel>(basicPanel), //pass FolderPairGenerated part... + batchDlg(batchDialog) {} + +private: + virtual wxWindow* getParentWindow() + { + return &batchDlg; + } + + virtual MainConfiguration getMainConfig() const + { + return batchDlg.getCurrentConfiguration().mainCfg; + } + + BatchDialog& batchDlg; +}; + + +class BatchFolderPairPanel : + public BatchFolderPairGenerated, //BatchFolderPairPanel "owns" BatchFolderPairGenerated! + public FolderPairCallback<BatchFolderPairGenerated> +{ +public: + BatchFolderPairPanel(wxWindow* parent, BatchDialog& batchDialog) : + BatchFolderPairGenerated(parent), + FolderPairCallback<BatchFolderPairGenerated>(static_cast<BatchFolderPairGenerated&>(*this), batchDialog), //pass BatchFolderPairGenerated part... + dragDropOnLeft( m_panelLeft, m_dirPickerLeft, m_directoryLeft), + dragDropOnRight(m_panelRight, m_dirPickerRight, m_directoryRight) {} + +private: + //support for drag and drop + DragDropOnDlg dragDropOnLeft; + DragDropOnDlg dragDropOnRight; +}; + + +class FirstBatchFolderPairCfg : public FolderPairCallback<BatchDlgGenerated> +{ +public: + FirstBatchFolderPairCfg(BatchDialog& batchDialog) : + FolderPairCallback<BatchDlgGenerated>(batchDialog, batchDialog), + + //prepare drag & drop + dragDropOnLeft(batchDialog.m_panelLeft, + batchDialog.m_dirPickerLeft, + batchDialog.m_directoryLeft), + dragDropOnRight(batchDialog.m_panelRight, + batchDialog.m_dirPickerRight, + batchDialog.m_directoryRight) {} + +private: + //support for drag and drop + DragDropOnDlg dragDropOnLeft; + DragDropOnDlg dragDropOnRight; +}; + + +//################################################################################################################################### +BatchDialog::BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg) : + BatchDlgGenerated(window) +{ + init(); + loadBatchCfg(batchCfg); +} + + +BatchDialog::BatchDialog(wxWindow* window, const wxString& filename) : + BatchDlgGenerated(window) +{ + init(); + loadBatchFile(filename); +} + + +BatchDialog::~BatchDialog() {} //non-inline destructor for std::auto_ptr to work with forward declaration + + +void BatchDialog::init() +{ + wxWindowUpdateLocker dummy(this); //avoid display distortion + + m_bpButtonCmpConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("cmpConfig"))); + m_bpButtonSyncConfig->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("syncConfig"))); + + m_bpButtonHelp->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("help"))); + + //init handling of first folder pair + firstFolderPair.reset(new FirstBatchFolderPairCfg(*this)); + + m_bpButtonFilter->Connect(wxEVT_RIGHT_DOWN, wxCommandEventHandler(BatchDialog::OnGlobalFilterOpenContext), NULL, this); + + //prepare drag & drop for loading of *.ffs_batch files + SetDropTarget(new BatchFileDropEvent(*this)); + dragDropOnLogfileDir.reset(new DragDropOnDlg(m_panelLogging, m_dirPickerLogfileDir, m_textCtrlLogfileDir)); + + //set icons for this dialog + m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); + m_bitmap27->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("batch"))); + + m_buttonSave->SetFocus(); +} + +//------------------- error handling -------------------------- + +xmlAccess::OnError BatchDialog::getSelectionHandleError() const +{ + switch (m_choiceHandleError->GetSelection()) + { + case 0: + return xmlAccess::ON_ERROR_POPUP; + case 1: + return xmlAccess::ON_ERROR_IGNORE; + case 2: + return xmlAccess::ON_ERROR_EXIT; + default: + assert(false); + return xmlAccess::ON_ERROR_POPUP; + } +} + + +void BatchDialog::updateToolTipErrorHandling(const xmlAccess::OnError value) +{ + switch (value) + { + case xmlAccess::ON_ERROR_POPUP: + m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); + break; + case xmlAccess::ON_ERROR_IGNORE: + m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); + break; + case xmlAccess::ON_ERROR_EXIT: + m_choiceHandleError->SetToolTip(_("Abort synchronization immediately")); + break; + } +} + + +void BatchDialog::setSelectionHandleError(const xmlAccess::OnError value) +{ + m_choiceHandleError->Clear(); + m_choiceHandleError->Append(_("Show popup")); + m_choiceHandleError->Append(_("Ignore errors")); + if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! + m_choiceHandleError->Append(_("Exit instantly")); + + //default + m_choiceHandleError->SetSelection(0); + + switch (value) + { + case xmlAccess::ON_ERROR_POPUP: + m_choiceHandleError->SetSelection(0); + break; + case xmlAccess::ON_ERROR_IGNORE: + m_choiceHandleError->SetSelection(1); + break; + case xmlAccess::ON_ERROR_EXIT: + if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! + m_choiceHandleError->SetSelection(2); + break; + } + + updateToolTipErrorHandling(getSelectionHandleError()); +} + + +void BatchDialog::OnChangeErrorHandling(wxCommandEvent& event) +{ + updateToolTipErrorHandling(getSelectionHandleError()); +} + + +void BatchDialog::OnCmpSettings(wxCommandEvent& event) +{ + + //show window right next to the compare-config button + wxPoint windowPos = m_bpButtonCmpConfig->GetScreenPosition(); + windowPos.x += m_bpButtonCmpConfig->GetSize().GetWidth() + 5; + + if (FreeFileSync::showCompareCfgDialog(windowPos, + localBatchCfg.mainCfg.compareVar, + localBatchCfg.mainCfg.processSymlinks, + localBatchCfg.mainCfg.traverseDirectorySymlinks, + localBatchCfg.mainCfg.copyFileSymlinks) == DefaultReturnCode::BUTTON_OKAY) + { + updateGui(); + } +} + + +void BatchDialog::OnSyncSettings(wxCommandEvent& event) +{ + SyncCfgDialog* syncDlg = new SyncCfgDialog(this, + localBatchCfg.mainCfg.compareVar, + localBatchCfg.mainCfg.syncConfiguration, + localBatchCfg.mainCfg.handleDeletion, + localBatchCfg.mainCfg.customDeletionDirectory, + NULL); + if (syncDlg->ShowModal() == SyncCfgDialog::BUTTON_APPLY) + { + updateGui(); + } +} + + +void BatchDialog::OnConfigureFilter(wxCommandEvent& event) +{ + if (showFilterDialog(true, //is main filter dialog + localBatchCfg.mainCfg.globalFilter.includeFilter, + localBatchCfg.mainCfg.globalFilter.excludeFilter) == DefaultReturnCode::BUTTON_OKAY) + { + updateGui(); + } +} + + +void BatchDialog::updateGui() //re-evaluate gui after config changes +{ + //update compare variant name + m_staticTextCmpVariant->SetLabel(wxString(wxT("(")) + getVariantName(localBatchCfg.mainCfg.compareVar) + wxT(")")); + + //update sync variant name + m_staticTextSyncVariant->SetLabel(wxString(wxT("(")) + localBatchCfg.mainCfg.getSyncVariantName() + wxT(")")); + + //set filter icon + if (isNullFilter(localBatchCfg.mainCfg.globalFilter)) + { + m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOff"))); + m_bpButtonFilter->SetToolTip(_("No filter selected")); + } + else + { + m_bpButtonFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterOn"))); + m_bpButtonFilter->SetToolTip(_("Filter is active")); + } + + m_panelOverview->Layout(); //adjust stuff inside scrolled window +} + + +void BatchDialog::OnGlobalFilterOpenContext(wxCommandEvent& event) +{ + const int menuId = 1234; + contextMenu.reset(new wxMenu); //re-create context menu + contextMenu->Append(menuId, _("Clear filter settings")); + contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(BatchDialog::OnGlobalFilterRemConfirm), NULL, this); + + if (isNullFilter(localBatchCfg.mainCfg.globalFilter)) + contextMenu->Enable(menuId, false); //disable menu item, if clicking wouldn't make sense anyway + + PopupMenu(contextMenu.get()); //show context menu +} + + +void BatchDialog::OnGlobalFilterRemConfirm(wxCommandEvent& event) +{ + localBatchCfg.mainCfg.globalFilter = FilterConfig(); + updateGui(); +} + + +void BatchDialog::OnCheckSilent(wxCommandEvent& event) +{ + updateVisibleTabs(); + + //reset error handling depending on "m_checkBoxSilent" + setSelectionHandleError(getSelectionHandleError()); +} + + +void BatchDialog::OnHelp(wxCommandEvent& event) +{ +#ifdef FFS_WIN + FreeFileSync::displayHelpEntry(wxT("html\\advanced\\ScheduleBatch.html")); +#elif defined FFS_LINUX + FreeFileSync::displayHelpEntry(wxT("html/advanced/ScheduleBatch.html")); +#endif +} + + +void BatchDialog::updateVisibleTabs() +{ + showNotebookpage(m_panelLogging, _("Logging"), m_checkBoxSilent->GetValue()); +} + + +void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, bool show) +{ + int windowPosition = -1; + for (size_t i = 0; i < m_notebookSettings->GetPageCount(); ++i) + if (m_notebookSettings->GetPage(i) == page) + { + windowPosition = static_cast<int>(i); + break; + } + + if (show) + { + if (windowPosition == -1) + m_notebookSettings->AddPage(page, pageName, false); + } + else + { + if (windowPosition != -1) + { + //do not delete currently selected tab!! + if (m_notebookSettings->GetCurrentPage() == m_notebookSettings->GetPage(windowPosition)) + m_notebookSettings->ChangeSelection(0); + + m_notebookSettings->RemovePage(windowPosition); + } + } +} + + +void BatchDialog::OnClose(wxCloseEvent& event) +{ + EndModal(0); +} + + +void BatchDialog::OnCancel(wxCommandEvent& event) +{ + EndModal(0); +} + + +void BatchDialog::OnSaveBatchJob(wxCommandEvent& event) +{ + //get a filename + const wxString defaultFileName = proposedBatchFileName.empty() ? wxT("SyncJob.ffs_batch") : proposedBatchFileName; + + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_SAVE); + if (filePicker->ShowModal() == wxID_OK) + { + const wxString newFileName = filePicker->GetPath(); + if (FreeFileSync::fileExists(wxToZ(newFileName))) + { + QuestionDlg* messageDlg = new QuestionDlg(this, + QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, + wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); + + if (messageDlg->ShowModal() != QuestionDlg::BUTTON_YES) + { + OnSaveBatchJob(event); //retry + return; + } + } + + //create batch file + if (saveBatchFile(newFileName)) + EndModal(BATCH_FILE_SAVED); + } +} + + +void BatchDialog::OnLoadBatchJob(wxCommandEvent& event) +{ + wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_OPEN);; + if (filePicker->ShowModal() == wxID_OK) + loadBatchFile(filePicker->GetPath()); +} + + + +inline +FolderPairEnh getEnahncedPair(const BatchFolderPairPanel* panel) +{ + return FolderPairEnh(panel->getLeftDir(), + panel->getRightDir(), + panel->getAltSyncConfig(), + panel->getAltFilterConfig()); +} + + +xmlAccess::XmlBatchConfig BatchDialog::getCurrentConfiguration() const +{ + xmlAccess::XmlBatchConfig batchCfg = localBatchCfg; + + //load parameter with ownership within wxWidgets controls... + + //first folder pair + batchCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(), + firstFolderPair->getRightDir(), + firstFolderPair->getAltSyncConfig(), + firstFolderPair->getAltFilterConfig()); + + //add additional pairs + batchCfg.mainCfg.additionalPairs.clear(); + std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(), + std::back_inserter(batchCfg.mainCfg.additionalPairs), getEnahncedPair); + + + //load structure with batch settings "batchCfg" + batchCfg.silent = m_checkBoxSilent->GetValue(); + batchCfg.logFileDirectory = m_textCtrlLogfileDir->GetValue(); + batchCfg.handleError = getSelectionHandleError(); + + return batchCfg; +} + + +bool BatchDialog::saveBatchFile(const wxString& filename) +{ + const xmlAccess::XmlBatchConfig batchCfg = getCurrentConfiguration(); + + //write config to XML + try + { + xmlAccess::writeBatchConfig(batchCfg, filename); + } + catch (const xmlAccess::XmlError& error) + { + wxMessageBox(error.show().c_str(), _("Error"), wxOK | wxICON_ERROR); + return false; + } + + SetTitle(wxString(_("Create a batch job")) + wxT(" - ") + filename); + proposedBatchFileName = filename; //may be used on next save + + return true; +} + + +void BatchDialog::loadBatchFile(const wxString& filename) +{ + //load XML settings + xmlAccess::XmlBatchConfig batchCfg; //structure to receive gui settings + try + { + xmlAccess::readBatchConfig(filename, batchCfg); + } + catch (const xmlAccess::XmlError& error) + { + if (error.getSeverity() == xmlAccess::XmlError::WARNING) + wxMessageBox(error.show(), _("Warning"), wxOK | wxICON_WARNING); + else + { + wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); + return; + } + } + + SetTitle(wxString(_("Create a batch job")) + wxT(" - ") + filename); + proposedBatchFileName = filename; //may be used on next save + this->loadBatchCfg(batchCfg); +} + + +void BatchDialog::loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg) +{ + wxWindowUpdateLocker dummy(this); //avoid display distortion + +//make working copy + localBatchCfg = batchCfg; + + m_checkBoxSilent->SetValue(batchCfg.silent); + m_textCtrlLogfileDir->SetValue(batchCfg.logFileDirectory); + //error handling is dependent from m_checkBoxSilent! /|\ \|/ + setSelectionHandleError(batchCfg.handleError); + + //set first folder pair + firstFolderPair->setValues(batchCfg.mainCfg.firstPair.leftDirectory, + batchCfg.mainCfg.firstPair.rightDirectory, + batchCfg.mainCfg.firstPair.altSyncConfig, + batchCfg.mainCfg.firstPair.localFilter); + + //remove existing additional folder pairs + clearAddFolderPairs(); + + //set additional pairs + addFolderPair(batchCfg.mainCfg.additionalPairs); + + updateVisibleTabs(); + + updateGui(); //re-evaluate gui after config changes + + Fit(); //needed + Refresh(); //needed + Centre(); +} + + +void BatchDialog::OnAddFolderPair(wxCommandEvent& event) +{ + wxWindowUpdateLocker dummy(this); //avoid display distortion + + std::vector<FolderPairEnh> newPairs; + newPairs.push_back(getCurrentConfiguration().mainCfg.firstPair); + + addFolderPair(newPairs, true); //add pair in front of additonal pairs + + //clear first pair + const FolderPairEnh cfgEmpty; + firstFolderPair->setValues(cfgEmpty.leftDirectory, + cfgEmpty.rightDirectory, + cfgEmpty.altSyncConfig, + cfgEmpty.localFilter); +} + + +void BatchDialog::OnRemoveFolderPair(wxCommandEvent& event) +{ + //find folder pair originating the event + const wxObject* const eventObj = event.GetEventObject(); + for (std::vector<BatchFolderPairPanel*>::const_iterator i = additionalFolderPairs.begin(); i != additionalFolderPairs.end(); ++i) + { + if (eventObj == static_cast<wxObject*>((*i)->m_bpButtonRemovePair)) + { + removeAddFolderPair(i - additionalFolderPairs.begin()); + return; + } + } +} + + +void BatchDialog::OnRemoveTopFolderPair(wxCommandEvent& event) +{ + if (additionalFolderPairs.size() > 0) + { + //get settings from second folder pair + const FolderPairEnh cfgSecond = getEnahncedPair(additionalFolderPairs[0]); + + //reset first pair + firstFolderPair->setValues(cfgSecond.leftDirectory, + cfgSecond.rightDirectory, + cfgSecond.altSyncConfig, + cfgSecond.localFilter); + + removeAddFolderPair(0); //remove second folder pair (first of additional folder pairs) + } +} + + +const size_t MAX_FOLDER_PAIRS = 3; + + +void BatchDialog::updateGuiForFolderPair() +{ + //adapt delete top folder pair button + if (additionalFolderPairs.size() == 0) + m_bpButtonRemovePair->Hide(); + else + m_bpButtonRemovePair->Show(); + + //adapt local filter and sync cfg for first folder pair + if ( additionalFolderPairs.size() == 0 && + firstFolderPair->getAltSyncConfig().get() == NULL && + NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, + firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) + { + m_bpButtonLocalFilter->Hide(); + m_bpButtonAltSyncCfg->Hide(); + } + else + { + m_bpButtonLocalFilter->Show(); + m_bpButtonAltSyncCfg->Show(); + } + + m_scrolledWindow6->Fit(); //adjust scrolled window size + m_panelOverview->Layout(); //adjust stuff inside scrolled window +} + + +void BatchDialog::addFolderPair(const std::vector<FreeFileSync::FolderPairEnh>& newPairs, bool addFront) +{ + wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion + + if (!newPairs.empty()) + { + //add folder pairs + int pairHeight = 0; + for (std::vector<FreeFileSync::FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i) + { + BatchFolderPairPanel* newPair = new BatchFolderPairPanel(m_scrolledWindow6, *this); + + if (addFront) + { + bSizerAddFolderPairs->Insert(0, newPair, 0, wxEXPAND, 5); + additionalFolderPairs.insert(additionalFolderPairs.begin(), newPair); + } + else + { + bSizerAddFolderPairs->Add(newPair, 0, wxEXPAND, 5); + additionalFolderPairs.push_back(newPair); + } + + //get size of scrolled window + pairHeight = newPair->GetSize().GetHeight(); + + //register events + newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BatchDialog::OnRemoveFolderPair), NULL, this ); + + //set alternate configuration + newPair->setValues(i->leftDirectory, + i->rightDirectory, + i->altSyncConfig, + i->localFilter); + } + //set size of scrolled window + const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown + m_scrolledWindow6->SetMinSize(wxSize( -1, pairHeight * static_cast<int>(visiblePairs))); + + //update controls + m_scrolledWindow6->Fit(); //adjust scrolled window size + m_panelOverview->Layout(); //adjust stuff inside scrolled window + Fit(); //adapt dialog size + + //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this + m_bpButtonAddPair->SetFocus(); + } + + updateGuiForFolderPair(); +} + + +void BatchDialog::removeAddFolderPair(const int pos) +{ + wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion + + if (0 <= pos && pos < static_cast<int>(additionalFolderPairs.size())) + { + //remove folder pairs from window + BatchFolderPairPanel* pairToDelete = additionalFolderPairs[pos]; + const int pairHeight = pairToDelete->GetSize().GetHeight(); + + bSizerAddFolderPairs->Detach(pairToDelete); //Remove() does not work on Window*, so do it manually + pairToDelete->Destroy(); // + additionalFolderPairs.erase(additionalFolderPairs.begin() + pos); //remove last element in vector + + //set size of scrolled window + const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown + m_scrolledWindow6->SetMinSize(wxSize(-1, pairHeight * static_cast<int>(visiblePairs))); + + //update controls + m_scrolledWindow6->Fit(); //adjust scrolled window size + m_panelOverview->Layout(); //adjust stuff inside scrolled window + + m_panelOverview->InvalidateBestSize(); //needed for Fit() to work correctly! + Fit(); //adapt dialog size + + //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this + m_bpButtonCmpConfig->SetFocus(); + } + + updateGuiForFolderPair(); +} + + +void BatchDialog::clearAddFolderPairs() +{ + wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion + + additionalFolderPairs.clear(); + bSizerAddFolderPairs->Clear(true); + + m_scrolledWindow6->SetMinSize(wxSize(-1, sbSizerMainPair->GetSize().GetHeight())); //respect height of main pair +} + + +/* +#ifdef FFS_WIN +#include <wx/msw/wrapwin.h> //includes "windows.h" +#include <shlobj.h> +#endif // FFS_WIN + +template <typename T> +struct CleanUp +{ + CleanUp(T* element) : m_element(element) {} + + ~CleanUp() + { + m_element->Release(); + } + + T* m_element; +}; + + +bool BatchDialog::createBatchFile(const wxString& filename) +{ + //create shell link (instead of batch file) for full Unicode support + HRESULT hResult = E_FAIL; + IShellLink* pShellLink = NULL; + + if (FAILED(CoCreateInstance(CLSID_ShellLink, //class identifier + NULL, //object isn't part of an aggregate + CLSCTX_INPROC_SERVER, //context for running executable code + IID_IShellLink, //interface identifier + (void**)&pShellLink))) //pointer to storage of interface pointer + return false; + CleanUp<IShellLink> cleanOnExit(pShellLink); + + wxString freeFileSyncExe = wxStandardPaths::Get().GetExecutablePath(); + if (FAILED(pShellLink->SetPath(freeFileSyncExe.c_str()))) + return false; + + if (FAILED(pShellLink->SetArguments(getCommandlineArguments().c_str()))) + return false; + + if (FAILED(pShellLink->SetIconLocation(freeFileSyncExe.c_str(), 1))) //second icon from executable file is used + return false; + + if (FAILED(pShellLink->SetDescription(_("FreeFileSync Batch Job")))) + return false; + + IPersistFile* pPersistFile = NULL; + if (FAILED(pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile))) + return false; + CleanUp<IPersistFile> cleanOnExit2(pPersistFile); + + //pPersistFile->Save accepts unicode input only +#ifdef _UNICODE + hResult = pPersistFile->Save(filename.c_str(), TRUE); +#else + WCHAR wszTemp [MAX_PATH]; + if (MultiByteToWideChar(CP_ACP, 0, filename.c_str(), -1, wszTemp, MAX_PATH) == 0) + return false; + + hResult = pPersistFile->Save(wszTemp, TRUE); +#endif + if (FAILED(hResult)) + return false; + + return true; +} +*/ diff --git a/ui/batchConfig.h b/ui/batchConfig.h new file mode 100644 index 00000000..5fcf54a3 --- /dev/null +++ b/ui/batchConfig.h @@ -0,0 +1,96 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#ifndef BATCHCONFIG_H_INCLUDED +#define BATCHCONFIG_H_INCLUDED + +#include "guiGenerated.h" +#include "../library/processXml.h" + + +namespace FreeFileSync +{ +class DragDropOnDlg; +} + +class BatchFolderPairPanel; +class FirstBatchFolderPairCfg; + + +class BatchDialog: public BatchDlgGenerated +{ + friend class BatchFileDropEvent; + template <class GuiPanel> + friend class FolderPairCallback; + +public: + BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg); + BatchDialog(wxWindow* window, const wxString& filename); + ~BatchDialog(); + + enum + { + BATCH_FILE_SAVED = 15 + }; + +private: + void init(); + + virtual void OnCmpSettings( wxCommandEvent& event); + virtual void OnSyncSettings( wxCommandEvent& event); + virtual void OnConfigureFilter( wxCommandEvent& event); + + virtual void OnHelp( wxCommandEvent& event); + + void OnGlobalFilterOpenContext(wxCommandEvent& event); + void OnGlobalFilterRemConfirm(wxCommandEvent& event); + virtual void OnCheckSilent( wxCommandEvent& event); + virtual void OnClose( wxCloseEvent& event); + virtual void OnCancel( wxCommandEvent& event); + virtual void OnSaveBatchJob( wxCommandEvent& event); + virtual void OnLoadBatchJob( wxCommandEvent& event); + virtual void OnAddFolderPair( wxCommandEvent& event); + virtual void OnRemoveFolderPair( wxCommandEvent& event); + virtual void OnRemoveTopFolderPair(wxCommandEvent& event); + + void addFolderPair(const std::vector<FreeFileSync::FolderPairEnh>& newPairs, bool addFront = false); + void removeAddFolderPair(const int pos); + void clearAddFolderPairs(); + + void updateGuiForFolderPair(); + + void updateGui(); //re-evaluate gui after config changes + + void updateVisibleTabs(); + void showNotebookpage(wxWindow* page, const wxString& pageName, bool show); + + //error handling + xmlAccess::OnError getSelectionHandleError() const; + void setSelectionHandleError(const xmlAccess::OnError value); + void OnChangeErrorHandling(wxCommandEvent& event); + void updateToolTipErrorHandling(const xmlAccess::OnError value); + + bool saveBatchFile(const wxString& filename); + void loadBatchFile(const wxString& filename); + void loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg); + + xmlAccess::XmlBatchConfig getCurrentConfiguration() const; + + boost::shared_ptr<FirstBatchFolderPairCfg> firstFolderPair; //always bound!!! + std::vector<BatchFolderPairPanel*> additionalFolderPairs; + + //used when saving batch file + wxString proposedBatchFileName; + + xmlAccess::XmlBatchConfig localBatchCfg; + + std::auto_ptr<wxMenu> contextMenu; + + //add drag & drop support when selecting logfile directory + std::auto_ptr<FreeFileSync::DragDropOnDlg> dragDropOnLogfileDir; +}; + +#endif // BATCHCONFIG_H_INCLUDED diff --git a/ui/batchStatusHandler.cpp b/ui/batchStatusHandler.cpp index e8b2b31b..b7589497 100644 --- a/ui/batchStatusHandler.cpp +++ b/ui/batchStatusHandler.cpp @@ -99,21 +99,14 @@ private: //add timestamp wxString timeNow = wxDateTime::Now().FormatISOTime(); - timeNow.Replace(wxT(":"), wxT("-")); + timeNow.Replace(wxT(":"), wxT("")); logfileName += wxDateTime::Now().FormatISODate() + wxChar(' ') + timeNow; wxString output = logfileName + wxT(".log"); //ensure uniqueness - if (FreeFileSync::fileExists(wxToZ(output))) - { - //if it's not unique, add a postfix number - int postfix = 1; - while (FreeFileSync::fileExists(wxToZ(logfileName + wxT('_') + FreeFileSync::numberToWxString(postfix, false) + wxT(".log")))) - ++postfix; - - output = logfileName + wxT('_') + numberToWxString(postfix, false) + wxT(".log"); - } + for (int i = 1; FreeFileSync::somethingExists(wxToZ(output)); ++i) + output = logfileName + wxChar('_') + numberToWxString(i, false) + wxT(".log"); return output; } @@ -128,8 +121,11 @@ BatchStatusHandler::BatchStatusHandler(bool runSilent, const wxString& batchFilename, const wxString* logfileDirectory, const xmlAccess::OnError handleError, + const SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode int& returnVal) : + switchBatchToGui_(switchBatchToGui), exitWhenFinished(runSilent), //=> exit immediately when finished + switchToGuiRequested(false), handleError_(handleError), currentProcess(StatusHandler::PROCESS_NONE), returnValue(returnVal), @@ -177,7 +173,12 @@ BatchStatusHandler::~BatchStatusHandler() logFile->writeLog(errorLog); //decide whether to stay on status screen or exit immediately... - if (!exitWhenFinished || syncStatusFrame.getAsWindow()->IsShown()) //warning: wxWindow::Show() is called within processHasFinished()! + if (switchToGuiRequested) //-> avoid recursive yield() calls, thous switch not before ending batch mode + { + switchBatchToGui_.execute(); //open FreeFileSync GUI + syncStatusFrame.closeWindowDirectly(); //syncStatusFrame is main window => program will quit directly + } + else if (!exitWhenFinished || syncStatusFrame.getAsWindow()->IsShown()) //warning: wxWindow::Show() is called within processHasFinished()! { //print the results list: GUI wxString finalMessage; @@ -285,8 +286,8 @@ void BatchStatusHandler::reportWarning(const wxString& warningMessage, bool& war //show popup and ask user how to handle warning bool dontWarnAgain = false; WarningDlg warningDlg(NULL, - WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_ABORT, - warningMessage, + WarningDlg::BUTTON_IGNORE | WarningDlg::BUTTON_SWITCH | WarningDlg::BUTTON_ABORT, + warningMessage + wxT("\n\n") + _("Press \"Switch\" to open FreeFileSync GUI modus."), dontWarnAgain); warningDlg.Raise(); const WarningDlg::Response rv = static_cast<WarningDlg::Response>(warningDlg.ShowModal()); @@ -296,6 +297,12 @@ void BatchStatusHandler::reportWarning(const wxString& warningMessage, bool& war abortThisProcess(); break; + case WarningDlg::BUTTON_SWITCH: + errorLog.logWarning(_("Switching to FreeFileSync GUI modus...")); + switchToGuiRequested = true; + abortThisProcess(); + break; + case WarningDlg::BUTTON_IGNORE: //no unhandled error situation! warningActive = !dontWarnAgain; break; @@ -322,7 +329,7 @@ ErrorHandler::Response BatchStatusHandler::reportError(const wxString& errorMess bool ignoreNextErrors = false; ErrorDlg errorDlg(NULL, ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, - errorMessage + wxT("\n\n\n") + _("Ignore this error, retry or abort?"), + errorMessage, ignoreNextErrors); errorDlg.Raise(); const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()); diff --git a/ui/batchStatusHandler.h b/ui/batchStatusHandler.h index b2ef125b..fb37c62a 100644 --- a/ui/batchStatusHandler.h +++ b/ui/batchStatusHandler.h @@ -11,6 +11,7 @@ #include "../library/processXml.h" #include "../library/errorLogging.h" #include "progressIndicator.h" +#include "switchToGui.h" class LogFile; class SyncStatus; @@ -23,6 +24,7 @@ public: const wxString& batchFilename, const wxString* logfileDirectory, //optional: enable logging if available const xmlAccess::OnError handleError, + const FreeFileSync::SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode int& returnVal); ~BatchStatusHandler(); @@ -39,7 +41,9 @@ public: private: virtual void abortThisProcess(); + const FreeFileSync::SwitchToGui& switchBatchToGui_; //functionality to change from batch mode to GUI mode bool exitWhenFinished; + bool switchToGuiRequested; xmlAccess::OnError handleError_; FreeFileSync::ErrorLogging errorLog; //list of non-resolved errors and warnings Process currentProcess; diff --git a/ui/folderPair.h b/ui/folderPair.h index d20dde76..7a027fba 100644 --- a/ui/folderPair.h +++ b/ui/folderPair.h @@ -11,9 +11,11 @@ #include "../shared/dragAndDrop.h" #include "../library/resources.h" #include "smallDialogs.h" -#include "settingsDialog.h" +#include "syncConfig.h" #include <wx/event.h> - +#include "isNullFilter.h" +#include "../shared/util.h" +#include "../shared/stringConv.h" namespace FreeFileSync { @@ -76,26 +78,16 @@ public: basicPanel_.m_bpButtonAltSyncCfg->SetToolTip(_("Select alternate synchronization settings")); } - - if (getMainConfig().filterIsActive) + //test for Null-filter + if (isNullFilter(localFilter)) { - //test for Null-filter - const bool isNullFilter = NameFilter(localFilter.includeFilter, localFilter.excludeFilter).isNull(); - if (isNullFilter) - { - basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmallGrey"))); - basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("No filter selected")); - } - else - { - basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmall"))); - basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("Filter has been selected")); - } + basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmallGrey"))); + basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("No filter selected")); } else { - basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmallGrey"))); - basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("Filtering is deactivated")); + basicPanel_.m_bpButtonLocalFilter->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("filterSmall"))); + basicPanel_.m_bpButtonLocalFilter->SetToolTip(_("Filter is active")); } } @@ -131,7 +123,7 @@ private: { const int menuId = 1234; contextMenu.reset(new wxMenu); //re-create context menu - contextMenu->Append(menuId, _("Remove local filter settings")); + contextMenu->Append(menuId, _("Clear filter settings")); contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(FolderPairPanelBasic::OnLocalFilterCfgRemoveConfirm), NULL, this); if (NameFilter(localFilter.includeFilter, localFilter.excludeFilter).isNull()) @@ -189,8 +181,7 @@ private: if (showFilterDialog(false, //is local filter dialog localFiltTmp.includeFilter, - localFiltTmp.excludeFilter, - getMainConfig().filterIsActive) == DefaultReturnCode::BUTTON_OKAY) + localFiltTmp.excludeFilter) == DefaultReturnCode::BUTTON_OKAY) { localFilter = localFiltTmp; refreshButtons(); diff --git a/ui/gridView.cpp b/ui/gridView.cpp index 4989db3d..b1ecb9eb 100644 --- a/ui/gridView.cpp +++ b/ui/gridView.cpp @@ -270,7 +270,7 @@ void GridView::clearAllRows() class GridView::SerializeHierarchy { public: - SerializeHierarchy(std::vector<GridView::RefIndex>& sortedRef, unsigned int index) : + SerializeHierarchy(std::vector<GridView::RefIndex>& sortedRef, size_t index) : index_(index), sortedRef_(sortedRef) {} @@ -295,7 +295,7 @@ public: } private: - unsigned int index_; + size_t index_; std::vector<GridView::RefIndex>& sortedRef_; }; @@ -306,11 +306,9 @@ void GridView::setData(FolderComparison& newData) sortedRef.clear(); folderCmp.swap(newData); - unsigned int index = 0; - //fill sortedRef for (FolderComparison::const_iterator j = folderCmp.begin(); j != folderCmp.end(); ++j) - SerializeHierarchy(sortedRef, index++).execute(*j); + SerializeHierarchy(sortedRef, j - folderCmp.begin()).execute(*j); } diff --git a/ui/gridView.h b/ui/gridView.h index 5310eb7e..53ca017b 100644 --- a/ui/gridView.h +++ b/ui/gridView.h @@ -118,10 +118,10 @@ private: struct RefIndex { - RefIndex(unsigned int folderInd, HierarchyObject::ObjectID id) : + RefIndex(size_t folderInd, HierarchyObject::ObjectID id) : folderIndex(folderInd), objId(id) {} - unsigned int folderIndex; + size_t folderIndex; HierarchyObject::ObjectID objId; }; diff --git a/ui/guiGenerated.cpp b/ui/guiGenerated.cpp index 90929704..9b2f8145 100644 --- a/ui/guiGenerated.cpp +++ b/ui/guiGenerated.cpp @@ -456,12 +456,6 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer23; bSizer23 = new wxBoxSizer( wxVERTICAL ); - m_checkBoxActivateFilter = new wxCheckBox( m_panelFilter, wxID_ANY, _("Activate filter"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_checkBoxActivateFilter->SetToolTip( _("Enable filter to exclude files from synchronization") ); - - bSizer23->Add( m_checkBoxActivateFilter, 0, wxBOTTOM, 5 ); - m_checkBoxHideFilt = new wxCheckBox( m_panelFilter, wxID_ANY, _("Hide excluded items"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxHideFilt->SetToolTip( _("Hide filtered or temporarily excluded files") ); @@ -752,7 +746,6 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_choiceHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_choiceHistory->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxActivateFilter->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnFilterButton ), NULL, this ); m_checkBoxHideFilt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); m_bpButtonSyncCreateLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); m_bpButtonSyncDirOverwLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); @@ -813,7 +806,6 @@ MainDialogGenerated::~MainDialogGenerated() m_choiceHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_choiceHistory->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); - m_checkBoxActivateFilter->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnFilterButton ), NULL, this ); m_checkBoxHideFilt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnHideFilteredButton ), NULL, this ); m_bpButtonSyncCreateLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncCreateLeft ), NULL, this ); m_bpButtonSyncDirOverwLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSyncDirLeft ), NULL, this ); @@ -1041,7 +1033,7 @@ BatchFolderPairGenerated::~BatchFolderPairGenerated() BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( 400,420 ), wxDefaultSize ); wxBoxSizer* bSizer54; bSizer54 = new wxBoxSizer( wxVERTICAL ); @@ -1113,10 +1105,73 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizer67 = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* bSizer120; - bSizer120 = new wxBoxSizer( wxHORIZONTAL ); + bSizer120 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer175; + bSizer175 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbSizer241; + sbSizer241 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Compare") ), wxHORIZONTAL ); + + m_bpButtonCmpConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + m_bpButtonCmpConfig->SetToolTip( _("Comparison settings") ); + + sbSizer241->Add( m_bpButtonCmpConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); + + + sbSizer241->Add( 10, 0, 0, 0, 5 ); + + m_staticTextCmpVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCmpVariant->Wrap( -1 ); + m_staticTextCmpVariant->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextCmpVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + sbSizer241->Add( m_staticTextCmpVariant, 1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer175->Add( sbSizer241, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer26; + sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Filter files") ), wxVERTICAL ); + + m_bpButtonFilter = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE ); + sbSizer26->Add( m_bpButtonFilter, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 15 ); - wxBoxSizer* bSizer100; - bSizer100 = new wxBoxSizer( wxVERTICAL ); + bSizer175->Add( sbSizer26, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer175->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer252; + sbSizer252 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Synchronize...") ), wxHORIZONTAL ); + + m_staticTextSyncVariant = new wxStaticText( m_panelOverview, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSyncVariant->Wrap( -1 ); + m_staticTextSyncVariant->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextSyncVariant->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ); + + sbSizer252->Add( m_staticTextSyncVariant, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizer252->Add( 10, 0, 0, 0, 5 ); + + m_bpButtonSyncConfig = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,42 ), wxBU_AUTODRAW ); + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + m_bpButtonSyncConfig->SetToolTip( _("Synchronization settings") ); + + sbSizer252->Add( m_bpButtonSyncConfig, 0, wxALIGN_CENTER_VERTICAL, 3 ); + + bSizer175->Add( sbSizer252, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer120->Add( bSizer175, 0, wxEXPAND, 5 ); + + + bSizer120->Add( 0, 5, 0, 0, 5 ); m_scrolledWindow6 = new wxScrolledWindow( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); m_scrolledWindow6->SetScrollRate( 5, 5 ); @@ -1234,67 +1289,16 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_scrolledWindow6->SetSizer( bSizer141 ); m_scrolledWindow6->Layout(); bSizer141->Fit( m_scrolledWindow6 ); - bSizer100->Add( m_scrolledWindow6, 0, wxEXPAND, 5 ); + bSizer120->Add( m_scrolledWindow6, 0, wxEXPAND, 5 ); - bSizer100->Add( 0, 10, 0, 0, 5 ); + bSizer120->Add( 0, 5, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); wxFlexGridSizer* fgSizer15; fgSizer15 = new wxFlexGridSizer( 2, 2, 10, 10 ); fgSizer15->SetFlexibleDirection( wxBOTH ); fgSizer15->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxStaticBoxSizer* sbSizer6; - sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Compare by...") ), wxVERTICAL ); - - - sbSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_radioBtnSizeDate = new wxRadioButton( m_panelOverview, wxID_ANY, _("File size and date"), wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnSizeDate->SetValue( true ); - m_radioBtnSizeDate->SetToolTip( _("Files are found equal if\n - filesize\n - last write time and date\nare the same") ); - - sbSizer6->Add( m_radioBtnSizeDate, 0, 0, 5 ); - - m_radioBtnContent = new wxRadioButton( m_panelOverview, wxID_ANY, _("File content"), wxDefaultPosition, wxDefaultSize, 0 ); - m_radioBtnContent->SetToolTip( _("Files are found equal if\n - file content\nis the same") ); - - sbSizer6->Add( m_radioBtnContent, 0, wxTOP, 5 ); - - - sbSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); - - fgSizer15->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - wxStaticBoxSizer* sbSizer24; - sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - - sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_checkBoxAutomatic = new wxCheckBox( m_panelOverview, wxID_ANY, _("Automatic mode"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_checkBoxAutomatic->SetToolTip( _("Synchronize both sides using a database. Deletions are detected automatically") ); - - sbSizer24->Add( m_checkBoxAutomatic, 0, wxALL, 5 ); - - m_checkBoxFilter = new wxCheckBox( m_panelOverview, wxID_ANY, _("Activate filter"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_checkBoxFilter->SetToolTip( _("Enable filter to exclude files from synchronization") ); - - sbSizer24->Add( m_checkBoxFilter, 0, wxALL, 5 ); - - m_checkBoxSilent = new wxCheckBox( m_panelOverview, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); - - m_checkBoxSilent->SetToolTip( _("Run minimized and write status information to a logfile") ); - - sbSizer24->Add( m_checkBoxSilent, 0, wxALL, 5 ); - - - sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - - fgSizer15->Add( sbSizer24, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - wxStaticBoxSizer* sbSizer25; sbSizer25 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Error handling") ), wxHORIZONTAL ); @@ -1305,236 +1309,31 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS fgSizer15->Add( sbSizer25, 0, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer23; - sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Deletion handling") ), wxVERTICAL ); - - wxArrayString m_choiceHandleDeletionChoices; - m_choiceHandleDeletion = new wxChoice( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceHandleDeletionChoices, 0 ); - m_choiceHandleDeletion->SetSelection( 0 ); - sbSizer23->Add( m_choiceHandleDeletion, 0, wxBOTTOM, 5 ); - - m_panelCustomDeletionDir = new wxPanel( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer1151; - bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); - - m_textCtrlCustomDelFolder = new wxTextCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_textCtrlCustomDelFolder->SetMinSize( wxSize( 160,-1 ) ); - - bSizer1151->Add( m_textCtrlCustomDelFolder, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - m_dirPickerCustomDelFolder = new wxDirPickerCtrl( m_panelCustomDeletionDir, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer1151->Add( m_dirPickerCustomDelFolder, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_panelCustomDeletionDir->SetSizer( bSizer1151 ); - m_panelCustomDeletionDir->Layout(); - bSizer1151->Fit( m_panelCustomDeletionDir ); - sbSizer23->Add( m_panelCustomDeletionDir, 0, 0, 5 ); - - fgSizer15->Add( sbSizer23, 0, wxEXPAND, 5 ); - - bSizer100->Add( fgSizer15, 0, 0, 5 ); - - bSizer120->Add( bSizer100, 1, 0, 5 ); - - - bSizer120->Add( 10, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerSyncDirections = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Configuration") ), wxVERTICAL ); - - wxGridSizer* gSizer3; - gSizer3 = new wxGridSizer( 1, 2, 0, 5 ); - - m_staticText21 = new wxStaticText( m_panelOverview, wxID_ANY, _("Category"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - m_staticText21->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) ); - - gSizer3->Add( m_staticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - m_staticText31 = new wxStaticText( m_panelOverview, wxID_ANY, _("Action"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText31->Wrap( -1 ); - m_staticText31->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) ); - - gSizer3->Add( m_staticText31, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizerSyncDirections->Add( gSizer3, 0, wxEXPAND, 5 ); - - m_staticline3 = new wxStaticLine( m_panelOverview, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - sbSizerSyncDirections->Add( m_staticline3, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - wxBoxSizer* bSizer121; - bSizer121 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer122; - bSizer122 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftOnly = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftOnly->SetToolTip( _("Files/folders that exist on left side only") ); - - bSizer122->Add( m_bitmapLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer122->Add( 5, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bpButtonLeftOnly = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer122->Add( m_bpButtonLeftOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer122, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer123; - bSizer123 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightOnly = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightOnly->SetToolTip( _("Files/folders that exist on right side only") ); - - bSizer123->Add( m_bitmapRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer123->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightOnly = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer123->Add( m_bpButtonRightOnly, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer123, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer124; - bSizer124 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapLeftNewer = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapLeftNewer->SetToolTip( _("Files that exist on both sides, left one is newer") ); - - bSizer124->Add( m_bitmapLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer124->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonLeftNewer = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer124->Add( m_bpButtonLeftNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer124, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer125; - bSizer125 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapRightNewer = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapRightNewer->SetToolTip( _("Files that exist on both sides, right one is newer") ); - - bSizer125->Add( m_bitmapRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer125->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonRightNewer = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer125->Add( m_bpButtonRightNewer, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer125, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - wxBoxSizer* bSizer126; - bSizer126 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapDifferent = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapDifferent->SetToolTip( _("Files that exist on both sides and have different content") ); - - bSizer126->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer126->Add( 5, 0, 0, 0, 5 ); - - m_bpButtonDifferent = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer126->Add( m_bpButtonDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer121->Add( bSizer126, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + wxStaticBoxSizer* sbSizer24; + sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( m_panelOverview, wxID_ANY, _("Status feedback") ), wxVERTICAL ); - wxBoxSizer* bSizer127; - bSizer127 = new wxBoxSizer( wxHORIZONTAL ); - m_bitmapConflict = new wxStaticBitmap( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapConflict->SetToolTip( _("Conflicts/files that cannot be categorized") ); + sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - bSizer127->Add( m_bitmapConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + m_checkBoxSilent = new wxCheckBox( m_panelOverview, wxID_ANY, _("Silent mode"), wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxSilent->SetToolTip( _("Run minimized and write status information to a logfile") ); - bSizer127->Add( 5, 0, 0, 0, 5 ); + sbSizer24->Add( m_checkBoxSilent, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 14 ); - m_bpButtonConflict = new wxBitmapButton( m_panelOverview, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 42,42 ), wxBU_AUTODRAW ); - bSizer127->Add( m_bpButtonConflict, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer121->Add( bSizer127, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + sbSizer24->Add( 0, 0, 1, wxEXPAND, 5 ); - sbSizerSyncDirections->Add( bSizer121, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + fgSizer15->Add( sbSizer24, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - bSizer120->Add( sbSizerSyncDirections, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer120->Add( fgSizer15, 0, 0, 5 ); - bSizer67->Add( bSizer120, 1, wxALL, 10 ); + bSizer67->Add( bSizer120, 1, wxALIGN_CENTER_VERTICAL|wxALL, 10 ); m_panelOverview->SetSizer( bSizer67 ); m_panelOverview->Layout(); bSizer67->Fit( m_panelOverview ); m_notebookSettings->AddPage( m_panelOverview, _("Overview"), true ); - m_panelFilter = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer8; - sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( m_panelFilter, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - wxFlexGridSizer* fgSizer3; - fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer3->AddGrowableCol( 1 ); - fgSizer3->AddGrowableRow( 1 ); - fgSizer3->SetFlexibleDirection( wxBOTH ); - fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticText15 = new wxStaticText( m_panelFilter, wxID_ANY, _("Include"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText15->Wrap( -1 ); - m_staticText15->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); - - fgSizer3->Add( m_staticText15, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_bitmap8 = new wxStaticBitmap( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - m_bitmap8->SetToolTip( _("Include") ); - - fgSizer3->Add( m_bitmap8, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlInclude = new wxTextCtrl( m_panelFilter, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - fgSizer3->Add( m_textCtrlInclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - sbSizer8->Add( fgSizer3, 1, wxEXPAND, 5 ); - - wxFlexGridSizer* fgSizer4; - fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); - fgSizer4->AddGrowableCol( 1 ); - fgSizer4->AddGrowableRow( 1 ); - fgSizer4->SetFlexibleDirection( wxBOTH ); - fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - - fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_staticText16 = new wxStaticText( m_panelFilter, wxID_ANY, _("Exclude"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText16->Wrap( -1 ); - m_staticText16->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); - - fgSizer4->Add( m_staticText16, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_bitmap9 = new wxStaticBitmap( m_panelFilter, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 30,30 ), 0 ); - m_bitmap9->SetToolTip( _("Exclude") ); - - fgSizer4->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_textCtrlExclude = new wxTextCtrl( m_panelFilter, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE ); - fgSizer4->Add( m_textCtrlExclude, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - sbSizer8->Add( fgSizer4, 1, wxEXPAND, 5 ); - - bSizer114->Add( sbSizer8, 1, wxALL|wxEXPAND, 10 ); - - m_panelFilter->SetSizer( bSizer114 ); - m_panelFilter->Layout(); - bSizer114->Fit( m_panelFilter ); - m_notebookSettings->AddPage( m_panelFilter, _("Filter"), false ); m_panelLogging = new wxPanel( m_notebookSettings, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer117; bSizer117 = new wxBoxSizer( wxVERTICAL ); @@ -1571,7 +1370,7 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer68; bSizer68 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonSave = new wxButton( this, wxID_SAVE, _("&Save"), wxDefaultPosition, wxSize( 120,35 ), 0 ); + m_buttonSave = new wxButton( this, wxID_SAVE, _("&Save"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonSave->SetDefault(); m_buttonSave->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); @@ -1600,21 +1399,13 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); + m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonSyncConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); m_bpButtonAddPair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_radioBtnSizeDate->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeCompareVar ), NULL, this ); - m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeCompareVar ), NULL, this ); - m_checkBoxAutomatic->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckAutomatic ), NULL, this ); - m_checkBoxFilter->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckFilter ), NULL, this ); - m_checkBoxSilent->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_choiceHandleDeletion->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_bpButtonLeftOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnExLeftSideOnly ), NULL, this ); - m_bpButtonRightOnly->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnExRightSideOnly ), NULL, this ); - m_bpButtonLeftNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLeftNewer ), NULL, this ); - m_bpButtonRightNewer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRightNewer ), NULL, this ); - m_bpButtonDifferent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnDifferent ), NULL, this ); - m_bpButtonConflict->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConflict ), NULL, this ); + m_checkBoxSilent->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); m_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); @@ -1625,21 +1416,13 @@ BatchDlgGenerated::~BatchDlgGenerated() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( BatchDlgGenerated::OnClose ) ); m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnHelp ), NULL, this ); + m_bpButtonCmpConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCmpSettings ), NULL, this ); + m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConfigureFilter ), NULL, this ); + m_bpButtonSyncConfig->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSyncSettings ), NULL, this ); m_bpButtonAddPair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnAddFolderPair ), NULL, this ); m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); - m_radioBtnSizeDate->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeCompareVar ), NULL, this ); - m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeCompareVar ), NULL, this ); - m_checkBoxAutomatic->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckAutomatic ), NULL, this ); - m_checkBoxFilter->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckFilter ), NULL, this ); - m_checkBoxSilent->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); - m_choiceHandleDeletion->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeDeletionHandling ), NULL, this ); - m_bpButtonLeftOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnExLeftSideOnly ), NULL, this ); - m_bpButtonRightOnly->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnExRightSideOnly ), NULL, this ); - m_bpButtonLeftNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLeftNewer ), NULL, this ); - m_bpButtonRightNewer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRightNewer ), NULL, this ); - m_bpButtonDifferent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnDifferent ), NULL, this ); - m_bpButtonConflict->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnConflict ), NULL, this ); + m_checkBoxSilent->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCheckSilent ), NULL, this ); m_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnLoadBatchJob ), NULL, this ); m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); @@ -1652,116 +1435,125 @@ CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id, bSizer42 = new wxBoxSizer( wxHORIZONTAL ); - wxStaticBoxSizer* sbSizer10; - sbSizer10 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxHORIZONTAL ); + wxBoxSizer* bSizer157; + bSizer157 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer118; - bSizer118 = new wxBoxSizer( wxHORIZONTAL ); + bSizerFilesFound = new wxBoxSizer( wxHORIZONTAL ); - m_staticText321 = new wxStaticText( this, wxID_ANY, _("Files/folders found:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText321 = new wxStaticText( this, wxID_ANY, _("Elements found:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText321->Wrap( -1 ); m_staticText321->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Arial") ) ); - bSizer118->Add( m_staticText321, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 5 ); + bSizerFilesFound->Add( m_staticText321, 0, wxALIGN_BOTTOM, 5 ); m_staticTextScanned = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextScanned->Wrap( -1 ); m_staticTextScanned->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - bSizer118->Add( m_staticTextScanned, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); - - sbSizer10->Add( bSizer118, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bSizer42->Add( sbSizer10, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizerFilesFound->Add( m_staticTextScanned, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); - sbSizer13 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comparing content") ), wxVERTICAL ); + bSizer157->Add( bSizerFilesFound, 0, 0, 5 ); - wxFlexGridSizer* fgSizer12; - fgSizer12 = new wxFlexGridSizer( 2, 4, 3, 5 ); - fgSizer12->SetFlexibleDirection( wxBOTH ); - fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + bSizerFilesRemaining = new wxBoxSizer( wxHORIZONTAL ); - m_staticText46 = new wxStaticText( this, wxID_ANY, _("Files remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText46 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText46->Wrap( -1 ); - m_staticText46->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Arial") ) ); + m_staticText46->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Arial") ) ); - fgSizer12->Add( m_staticText46, 0, wxALIGN_BOTTOM, 5 ); + bSizerFilesRemaining->Add( m_staticText46, 0, wxALIGN_BOTTOM, 5 ); + + wxBoxSizer* bSizer154; + bSizer154 = new wxBoxSizer( wxHORIZONTAL ); m_staticTextFilesRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFilesRemaining->Wrap( -1 ); - m_staticTextFilesRemaining->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextFilesRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - fgSizer12->Add( m_staticTextFilesRemaining, 0, wxALIGN_BOTTOM, 5 ); + bSizer154->Add( m_staticTextFilesRemaining, 0, wxALIGN_BOTTOM, 5 ); - m_staticText32 = new wxStaticText( this, wxID_ANY, _("Data remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText32->Wrap( -1 ); - m_staticText32->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Arial") ) ); + m_staticText117 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText117->Wrap( -1 ); + m_staticText117->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - fgSizer12->Add( m_staticText32, 0, wxALIGN_BOTTOM, 5 ); + bSizer154->Add( m_staticText117, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDataRemaining->Wrap( -1 ); - m_staticTextDataRemaining->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); + + bSizer154->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText118 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText118->Wrap( -1 ); + m_staticText118->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Arial") ) ); - fgSizer12->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); + bSizer154->Add( m_staticText118, 0, wxALIGN_BOTTOM, 5 ); + + bSizerFilesRemaining->Add( bSizer154, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); + + bSizer157->Add( bSizerFilesRemaining, 0, 0, 5 ); + + bSizer42->Add( bSizer157, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); + + sSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); m_staticText104 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText104->Wrap( -1 ); - m_staticText104->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Arial") ) ); + m_staticText104->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Arial") ) ); - fgSizer12->Add( m_staticText104, 0, wxALIGN_BOTTOM, 5 ); + sSizerSpeed->Add( m_staticText104, 0, wxALIGN_BOTTOM, 5 ); m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSpeed->Wrap( -1 ); - m_staticTextSpeed->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + sSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer42->Add( sSizerSpeed, 0, wxALIGN_CENTER_VERTICAL, 5 ); - fgSizer12->Add( m_staticTextSpeed, 0, wxALIGN_BOTTOM, 5 ); - m_staticText103 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText103->Wrap( -1 ); - m_staticText103->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Arial") ) ); + bSizer42->Add( 10, 0, 0, wxALIGN_CENTER_VERTICAL, 5 ); - fgSizer12->Add( m_staticText103, 0, wxALIGN_BOTTOM, 5 ); + sSizerTimeRemaining = new wxBoxSizer( wxHORIZONTAL ); + + m_staticTextTimeRemFixed = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemFixed->Wrap( -1 ); + m_staticTextTimeRemFixed->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Arial") ) ); + + sSizerTimeRemaining->Add( m_staticTextTimeRemFixed, 0, wxALIGN_BOTTOM, 5 ); m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextTimeRemaining->Wrap( -1 ); - m_staticTextTimeRemaining->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); - - fgSizer12->Add( m_staticTextTimeRemaining, 0, wxALIGN_BOTTOM, 5 ); + m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - sbSizer13->Add( fgSizer12, 1, wxEXPAND, 5 ); + sSizerTimeRemaining->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer42->Add( sbSizer13, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer42->Add( sSizerTimeRemaining, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer42->Add( 0, 0, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer131; - sbSizer131 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxHORIZONTAL ); - - wxBoxSizer* bSizer117; - bSizer117 = new wxBoxSizer( wxHORIZONTAL ); + sSizerTimeElapsed = new wxBoxSizer( wxHORIZONTAL ); + wxStaticText* m_staticText37; m_staticText37 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText37->Wrap( -1 ); m_staticText37->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Arial") ) ); - bSizer117->Add( m_staticText37, 0, wxALIGN_BOTTOM, 5 ); + sSizerTimeElapsed->Add( m_staticText37, 0, wxALIGN_BOTTOM, 5 ); m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextTimeElapsed->Wrap( -1 ); m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - bSizer117->Add( m_staticTextTimeElapsed, 0, wxALIGN_BOTTOM|wxLEFT, 5 ); - - sbSizer131->Add( bSizer117, 0, wxALIGN_CENTER_VERTICAL, 5 ); + sSizerTimeElapsed->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer42->Add( sbSizer131, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizer42->Add( sSizerTimeElapsed, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 ); + bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizer48; bSizer48 = new wxBoxSizer( wxHORIZONTAL ); @@ -1941,7 +1733,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer291; bSizer291 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,35 ), 0 ); + m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonOK->SetDefault(); m_buttonOK->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); @@ -2055,7 +1847,7 @@ SyncCfgDlgGenerated::SyncCfgDlgGenerated( wxWindow* parent, wxWindowID id, const bSizer126 = new wxBoxSizer( wxHORIZONTAL ); m_bitmapDifferent = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 45,45 ), 0 ); - m_bitmapDifferent->SetToolTip( _("Files that exist on both sides and have different content") ); + m_bitmapDifferent->SetToolTip( _("Files that have different content") ); bSizer126->Add( m_bitmapDifferent, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -2202,15 +1994,30 @@ CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const w sbSizer6->Add( m_bpButtonHelp, 0, wxALIGN_CENTER_VERTICAL, 5 ); - bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL, 2 ); + bSizer55->Add( sbSizer6, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 ); bSizer55->Add( 0, 4, 0, 0, 5 ); + m_checkBoxIncludeSymlinks = new wxCheckBox( this, wxID_ANY, _("Include Symbolic Links"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer55->Add( m_checkBoxIncludeSymlinks, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxHORIZONTAL ); + + m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_button10->SetDefault(); + m_button10->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) ); + + bSizer22->Add( m_button10, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_button6 = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_button6->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizer55->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizer22->Add( m_button6, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer55->Add( bSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer136->Add( bSizer55, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -2225,6 +2032,8 @@ CmpCfgDlgGenerated::CmpCfgDlgGenerated( wxWindow* parent, wxWindowID id, const w m_radioBtnContent->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); m_buttonContent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); m_bpButtonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_checkBoxIncludeSymlinks->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnIncludeSymlinks ), NULL, this ); + m_button10->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); } @@ -2237,6 +2046,8 @@ CmpCfgDlgGenerated::~CmpCfgDlgGenerated() m_radioBtnContent->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); m_buttonContent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnContent ), NULL, this ); m_bpButtonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnShowHelp ), NULL, this ); + m_checkBoxIncludeSymlinks->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnIncludeSymlinks ), NULL, this ); + m_button10->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnOkay ), NULL, this ); m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CmpCfgDlgGenerated::OnCancel ), NULL, this ); } @@ -2298,26 +2109,40 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizer31 = new wxBoxSizer( wxHORIZONTAL ); - m_staticText21 = new wxStaticText( this, wxID_ANY, _("Current operation:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText21->Wrap( -1 ); - m_staticText21->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + bSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); - bSizer31->Add( m_staticText21, 0, wxALIGN_BOTTOM, 5 ); + m_staticText108 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText108->Wrap( -1 ); + m_staticText108->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizerSpeed->Add( m_staticText108, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextSpeed->Wrap( -1 ); + m_staticTextSpeed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + bSizer31->Add( bSizerSpeed, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizer31->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText55 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText55->Wrap( -1 ); - m_staticText55->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + bSizerRemTime = new wxBoxSizer( wxHORIZONTAL ); - bSizer31->Add( m_staticText55, 0, wxALIGN_BOTTOM, 5 ); + m_staticText21 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText21->Wrap( -1 ); + m_staticText21->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeElapsed->Wrap( -1 ); - m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + bSizerRemTime->Add( m_staticText21, 0, wxALIGN_BOTTOM, 5 ); + + m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemaining->Wrap( -1 ); + m_staticTextTimeRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); + + bSizerRemTime->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer31->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + bSizer31->Add( bSizerRemTime, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); bSizer27->Add( bSizer31, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -2336,7 +2161,7 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerObjectsRemaining = new wxBoxSizer( wxHORIZONTAL ); - m_staticText25 = new wxStaticText( this, wxID_ANY, _("Files/folders remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText25 = new wxStaticText( this, wxID_ANY, _("Elements remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText25->Wrap( -1 ); m_staticText25->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -2348,11 +2173,29 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerObjectsRemaining->Add( m_staticTextRemainingObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + m_staticText96 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText96->Wrap( -1 ); + m_staticText96->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizerObjectsRemaining->Add( m_staticText96, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + + m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDataRemaining->Wrap( -1 ); + m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizerObjectsRemaining->Add( m_staticTextDataRemaining, 0, wxALIGN_BOTTOM, 5 ); + + m_staticText97 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText97->Wrap( -1 ); + m_staticText97->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizerObjectsRemaining->Add( m_staticText97, 0, wxALIGN_BOTTOM, 5 ); + bSizer111->Add( bSizerObjectsRemaining, 0, 0, 5 ); bSizerObjectsProcessed = new wxBoxSizer( wxHORIZONTAL ); - m_staticText251 = new wxStaticText( this, wxID_ANY, _("Files/folders processed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText251 = new wxStaticText( this, wxID_ANY, _("Elements processed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText251->Wrap( -1 ); m_staticText251->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -2364,23 +2207,25 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizerObjectsProcessed->Add( m_staticTextProcessedObj, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - bSizer111->Add( bSizerObjectsProcessed, 0, 0, 5 ); + m_staticText98 = new wxStaticText( this, wxID_ANY, _("("), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText98->Wrap( -1 ); + m_staticText98->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizerSpeed = new wxBoxSizer( wxHORIZONTAL ); + bSizerObjectsProcessed->Add( m_staticText98, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - m_staticText108 = new wxStaticText( this, wxID_ANY, _("Speed:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText108->Wrap( -1 ); - m_staticText108->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticTextDataProcessed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDataProcessed->Wrap( -1 ); + m_staticTextDataProcessed->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizerSpeed->Add( m_staticText108, 0, wxALIGN_BOTTOM, 5 ); + bSizerObjectsProcessed->Add( m_staticTextDataProcessed, 0, wxALIGN_BOTTOM, 5 ); - m_staticTextSpeed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSpeed->Wrap( -1 ); - m_staticTextSpeed->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + m_staticText99 = new wxStaticText( this, wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText99->Wrap( -1 ); + m_staticText99->SetFont( wxFont( 9, 74, 90, 90, false, wxT("Tahoma") ) ); - bSizerSpeed->Add( m_staticTextSpeed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + bSizerObjectsProcessed->Add( m_staticText99, 0, wxALIGN_BOTTOM, 5 ); - bSizer111->Add( bSizerSpeed, 0, wxTOP, 5 ); + bSizer111->Add( bSizerObjectsProcessed, 0, 0, 5 ); bSizer28->Add( bSizer111, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -2408,55 +2253,19 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, bSizer28->Add( 0, 0, 1, 0, 5 ); wxBoxSizer* bSizer114; - bSizer114 = new wxBoxSizer( wxVERTICAL ); - - bSizerDataRemaining = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText26 = new wxStaticText( this, wxID_ANY, _("Data remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText26->Wrap( -1 ); - m_staticText26->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizerDataRemaining->Add( m_staticText26, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextDataRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDataRemaining->Wrap( -1 ); - m_staticTextDataRemaining->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerDataRemaining->Add( m_staticTextDataRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer114->Add( bSizerDataRemaining, 0, wxALIGN_RIGHT, 5 ); - - bSizerDataProcessed = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText261 = new wxStaticText( this, wxID_ANY, _("Data transferred:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText261->Wrap( -1 ); - m_staticText261->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - - bSizerDataProcessed->Add( m_staticText261, 0, wxALIGN_BOTTOM, 5 ); - - m_staticTextDataProcessed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextDataProcessed->Wrap( -1 ); - m_staticTextDataProcessed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - - bSizerDataProcessed->Add( m_staticTextDataProcessed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); - - bSizer114->Add( bSizerDataProcessed, 0, wxALIGN_RIGHT, 5 ); - - bSizerRemTime = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText106 = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText106->Wrap( -1 ); - m_staticText106->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + bSizer114 = new wxBoxSizer( wxHORIZONTAL ); - bSizerRemTime->Add( m_staticText106, 0, wxALIGN_BOTTOM, 5 ); + m_staticText55 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText55->Wrap( -1 ); + m_staticText55->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); - m_staticTextTimeRemaining = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextTimeRemaining->Wrap( -1 ); - m_staticTextTimeRemaining->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Arial") ) ); + bSizer114->Add( m_staticText55, 0, wxALIGN_BOTTOM, 5 ); - bSizerRemTime->Add( m_staticTextTimeRemaining, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); + m_staticTextTimeElapsed = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeElapsed->Wrap( -1 ); + m_staticTextTimeElapsed->SetFont( wxFont( 9, 74, 90, 92, false, wxT("Arial") ) ); - bSizer114->Add( bSizerRemTime, 0, wxALIGN_RIGHT|wxTOP, 5 ); + bSizer114->Add( m_staticTextTimeElapsed, 0, wxLEFT|wxALIGN_BOTTOM, 5 ); bSizer28->Add( bSizer114, 0, wxALIGN_CENTER_VERTICAL, 5 ); @@ -2986,6 +2795,11 @@ WarningDlgGenerated::WarningDlgGenerated( wxWindow* parent, wxWindowID id, const bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + m_buttonSwitch = new wxButton( this, wxID_MORE, _("&Switch"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonSwitch->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); + + bSizer25->Add( m_buttonSwitch, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); + m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) ); @@ -3002,6 +2816,7 @@ WarningDlgGenerated::WarningDlgGenerated( wxWindow* parent, wxWindowID id, const // Connect Events this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); + m_buttonSwitch->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); } @@ -3010,6 +2825,7 @@ WarningDlgGenerated::~WarningDlgGenerated() // Disconnect Events this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WarningDlgGenerated::OnClose ) ); m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnIgnore ), NULL, this ); + m_buttonSwitch->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnSwitch ), NULL, this ); m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WarningDlgGenerated::OnAbort ), NULL, this ); } @@ -3286,13 +3102,6 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w bSizer69->Fit( m_panel13 ); bSizer21->Add( m_panel13, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxEXPAND, 5 ); - m_staticTextFilteringInactive = new wxStaticText( this, wxID_ANY, _("Filtering is deactivated"), wxDefaultPosition, wxDefaultSize, 0|wxRAISED_BORDER ); - m_staticTextFilteringInactive->Wrap( -1 ); - m_staticTextFilteringInactive->SetFont( wxFont( 12, 74, 90, 92, false, wxT("Arial Black") ) ); - m_staticTextFilteringInactive->SetForegroundColour( wxColour( 255, 0, 0 ) ); - - bSizer21->Add( m_staticTextFilteringInactive, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - wxStaticBoxSizer* sbSizer8; sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); @@ -3482,7 +3291,7 @@ CustomizeColsDlgGenerated::~CustomizeColsDlgGenerated() GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( 280,230 ), wxDefaultSize ); wxBoxSizer* bSizer95; bSizer95 = new wxBoxSizer( wxVERTICAL ); @@ -3521,45 +3330,17 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind wxStaticBoxSizer* sbSizer23; sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - wxBoxSizer* bSizer120; - bSizer120 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText114 = new wxStaticText( this, wxID_ANY, _("Ignore 1-hour file time difference"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText114->Wrap( -1 ); - m_staticText114->SetToolTip( _("Treat file times that differ by exactly +/- 1 hour as equal, less than 1 hour as conflict in order to handle Daylight Saving Time changes") ); - - bSizer120->Add( m_staticText114, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer120->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_checkBoxIgnoreOneHour = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxIgnoreOneHour = new wxCheckBox( this, wxID_ANY, _("Ignore 1-hour file time difference"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxIgnoreOneHour->SetToolTip( _("Treat file times that differ by exactly +/- 1 hour as equal, less than 1 hour as conflict in order to handle Daylight Saving Time changes") ); - bSizer120->Add( m_checkBoxIgnoreOneHour, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer23->Add( bSizer120, 0, wxEXPAND, 5 ); + sbSizer23->Add( m_checkBoxIgnoreOneHour, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - wxBoxSizer* bSizer1201; - bSizer1201 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticTextCopyLocked = new wxStaticText( this, wxID_ANY, _("Copy locked files"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextCopyLocked->Wrap( -1 ); - m_staticTextCopyLocked->SetToolTip( _("Copy shared or locked files using Volume Shadow Copy Service") ); - - bSizer1201->Add( m_staticTextCopyLocked, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer1201->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_checkBoxCopyLocked = new wxCheckBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_checkBoxCopyLocked = new wxCheckBox( this, wxID_ANY, _("Copy locked files"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxCopyLocked->SetToolTip( _("Copy shared or locked files using Volume Shadow Copy Service") ); - bSizer1201->Add( m_checkBoxCopyLocked, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - - sbSizer23->Add( bSizer1201, 0, wxEXPAND, 5 ); + sbSizer23->Add( m_checkBoxCopyLocked, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_staticline10 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); sbSizer23->Add( m_staticline10, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 ); @@ -3580,9 +3361,9 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind bSizer101->Add( m_buttonResetDialogs, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - sbSizer23->Add( bSizer101, 1, wxEXPAND, 5 ); + sbSizer23->Add( bSizer101, 0, wxEXPAND, 5 ); - bSizer95->Add( sbSizer23, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + bSizer95->Add( sbSizer23, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizer95->Add( 0, 10, 0, 0, 5 ); @@ -3591,7 +3372,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("External applications") ), wxHORIZONTAL ); - sbSizer26->Add( 0, 0, 1, wxEXPAND, 5 ); + sbSizer26->Add( 5, 0, 0, 0, 5 ); m_gridCustomCommand = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -3621,7 +3402,7 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind // Cell Defaults m_gridCustomCommand->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - sbSizer26->Add( m_gridCustomCommand, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + sbSizer26->Add( m_gridCustomCommand, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); wxBoxSizer* bSizer157; bSizer157 = new wxBoxSizer( wxVERTICAL ); @@ -3635,9 +3416,9 @@ GlobalSettingsDlgGenerated::GlobalSettingsDlgGenerated( wxWindow* parent, wxWind sbSizer26->Add( bSizer157, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - sbSizer26->Add( 0, 0, 1, wxEXPAND, 5 ); + sbSizer26->Add( 5, 0, 0, 0, 5 ); - bSizer95->Add( sbSizer26, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bSizer95->Add( sbSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxEXPAND, 5 ); wxBoxSizer* bSizer97; bSizer97 = new wxBoxSizer( wxHORIZONTAL ); diff --git a/ui/guiGenerated.h b/ui/guiGenerated.h index 2c5659b5..32e0c2a4 100644 --- a/ui/guiGenerated.h +++ b/ui/guiGenerated.h @@ -43,9 +43,9 @@ class wxButtonWithImage; #include <wx/textctrl.h> #include <wx/statline.h> #include <wx/frame.h> -#include <wx/radiobut.h> #include <wx/dialog.h> #include <wx/gauge.h> +#include <wx/radiobut.h> #include <wx/animate.h> #include <wx/treectrl.h> #include <wx/hyperlink.h> @@ -116,7 +116,6 @@ class MainDialogGenerated : public wxFrame wxChoice* m_choiceHistory; wxPanel* m_panelFilter; wxBitmapButton* m_bpButtonFilter; - wxCheckBox* m_checkBoxActivateFilter; wxCheckBox* m_checkBoxHideFilt; wxPanel* m_panel112; @@ -195,7 +194,6 @@ class MainDialogGenerated : public wxFrame virtual void OnCfgHistoryKeyEvent( wxKeyEvent& event ){ event.Skip(); } virtual void OnLoadFromHistory( wxCommandEvent& event ){ event.Skip(); } virtual void OnConfigureFilter( wxCommandEvent& event ){ event.Skip(); } - virtual void OnFilterButton( wxCommandEvent& event ){ event.Skip(); } virtual void OnHideFilteredButton( wxCommandEvent& event ){ event.Skip(); } virtual void OnSyncCreateLeft( wxCommandEvent& event ){ event.Skip(); } virtual void OnSyncDirLeft( wxCommandEvent& event ){ event.Skip(); } @@ -226,7 +224,7 @@ class MainDialogGenerated : public wxFrame wxDirPickerCtrl* m_dirPickerRight; wxPanel* m_panelLeft; wxPanel* m_panelRight; - MainDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Comparison and Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + MainDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); ~MainDialogGenerated(); }; @@ -309,58 +307,26 @@ class BatchDlgGenerated : public wxDialog wxStaticText* m_staticText531; wxNotebook* m_notebookSettings; wxPanel* m_panelOverview; + wxBitmapButton* m_bpButtonCmpConfig; + + wxStaticText* m_staticTextCmpVariant; + + wxBitmapButton* m_bpButtonFilter; + + wxStaticText* m_staticTextSyncVariant; + + wxBitmapButton* m_bpButtonSyncConfig; + wxBoxSizer* sbSizerMainPair; wxPanel* m_panelMainPair; wxStaticText* m_staticText532; wxStaticText* m_staticText5411; wxBoxSizer* bSizerAddFolderPairs; - - wxRadioButton* m_radioBtnSizeDate; - wxRadioButton* m_radioBtnContent; - - - wxCheckBox* m_checkBoxAutomatic; - wxCheckBox* m_checkBoxFilter; - wxCheckBox* m_checkBoxSilent; - wxChoice* m_choiceHandleError; - wxChoice* m_choiceHandleDeletion; - wxPanel* m_panelCustomDeletionDir; - wxTextCtrl* m_textCtrlCustomDelFolder; - wxDirPickerCtrl* m_dirPickerCustomDelFolder; - - wxStaticBoxSizer* sbSizerSyncDirections; - wxStaticText* m_staticText21; - wxStaticText* m_staticText31; - wxStaticLine* m_staticline3; - wxStaticBitmap* m_bitmapLeftOnly; - - wxBitmapButton* m_bpButtonLeftOnly; - wxStaticBitmap* m_bitmapRightOnly; - - wxBitmapButton* m_bpButtonRightOnly; - wxStaticBitmap* m_bitmapLeftNewer; - - wxBitmapButton* m_bpButtonLeftNewer; - wxStaticBitmap* m_bitmapRightNewer; - - wxBitmapButton* m_bpButtonRightNewer; - wxStaticBitmap* m_bitmapDifferent; - - wxBitmapButton* m_bpButtonDifferent; - wxStaticBitmap* m_bitmapConflict; - - wxBitmapButton* m_bpButtonConflict; - wxPanel* m_panelFilter; - wxStaticText* m_staticText15; - wxStaticBitmap* m_bitmap8; - wxTextCtrl* m_textCtrlInclude; + wxCheckBox* m_checkBoxSilent; - wxStaticText* m_staticText16; - wxStaticBitmap* m_bitmap9; - wxTextCtrl* m_textCtrlExclude; wxPanel* m_panelLogging; wxStaticText* m_staticText120; wxTextCtrl* m_textCtrlLogfileDir; @@ -372,20 +338,13 @@ class BatchDlgGenerated : public wxDialog // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } virtual void OnHelp( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCmpSettings( wxCommandEvent& event ){ event.Skip(); } + virtual void OnConfigureFilter( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSyncSettings( wxCommandEvent& event ){ event.Skip(); } virtual void OnAddFolderPair( wxCommandEvent& event ){ event.Skip(); } virtual void OnRemoveTopFolderPair( wxCommandEvent& event ){ event.Skip(); } - virtual void OnChangeCompareVar( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCheckAutomatic( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCheckFilter( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCheckSilent( wxCommandEvent& event ){ event.Skip(); } virtual void OnChangeErrorHandling( wxCommandEvent& event ){ event.Skip(); } - virtual void OnChangeDeletionHandling( wxCommandEvent& event ){ event.Skip(); } - virtual void OnExLeftSideOnly( wxCommandEvent& event ){ event.Skip(); } - virtual void OnExRightSideOnly( wxCommandEvent& event ){ event.Skip(); } - virtual void OnLeftNewer( wxCommandEvent& event ){ event.Skip(); } - virtual void OnRightNewer( wxCommandEvent& event ){ event.Skip(); } - virtual void OnDifferent( wxCommandEvent& event ){ event.Skip(); } - virtual void OnConflict( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCheckSilent( wxCommandEvent& event ){ event.Skip(); } virtual void OnSaveBatchJob( wxCommandEvent& event ){ event.Skip(); } virtual void OnLoadBatchJob( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } @@ -417,20 +376,25 @@ class CompareStatusGenerated : public wxPanel protected: wxBoxSizer* bSizer42; + wxBoxSizer* bSizerFilesFound; wxStaticText* m_staticText321; wxStaticText* m_staticTextScanned; - - wxStaticBoxSizer* sbSizer13; + wxBoxSizer* bSizerFilesRemaining; wxStaticText* m_staticText46; wxStaticText* m_staticTextFilesRemaining; - wxStaticText* m_staticText32; + wxStaticText* m_staticText117; wxStaticText* m_staticTextDataRemaining; + wxStaticText* m_staticText118; + + wxBoxSizer* sSizerSpeed; wxStaticText* m_staticText104; wxStaticText* m_staticTextSpeed; - wxStaticText* m_staticText103; + + wxBoxSizer* sSizerTimeRemaining; + wxStaticText* m_staticTextTimeRemFixed; wxStaticText* m_staticTextTimeRemaining; - wxStaticText* m_staticText37; + wxBoxSizer* sSizerTimeElapsed; wxStaticText* m_staticTextTimeElapsed; wxStaticText* m_staticText30; wxTextCtrl* m_textCtrlStatus; @@ -542,6 +506,8 @@ class CmpCfgDlgGenerated : public wxDialog wxStaticLine* m_staticline14; wxBitmapButton* m_bpButtonHelp; + wxCheckBox* m_checkBoxIncludeSymlinks; + wxButton* m_button10; wxButton* m_button6; // Virtual event handlers, overide them in your derived class @@ -549,6 +515,8 @@ class CmpCfgDlgGenerated : public wxDialog virtual void OnTimeSize( wxCommandEvent& event ){ event.Skip(); } virtual void OnContent( wxCommandEvent& event ){ event.Skip(); } virtual void OnShowHelp( wxCommandEvent& event ){ event.Skip(); } + virtual void OnIncludeSymlinks( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOkay( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } @@ -575,35 +543,34 @@ class SyncStatusDlgGenerated : public wxFrame wxStaticText* m_staticTextStatus; wxBoxSizer* bSizer31; - wxStaticText* m_staticText21; + wxBoxSizer* bSizerSpeed; + wxStaticText* m_staticText108; + wxStaticText* m_staticTextSpeed; - wxStaticText* m_staticText55; - wxStaticText* m_staticTextTimeElapsed; + wxBoxSizer* bSizerRemTime; + wxStaticText* m_staticText21; + wxStaticText* m_staticTextTimeRemaining; wxTextCtrl* m_textCtrlInfo; wxBoxSizer* bSizer28; wxBoxSizer* bSizerObjectsRemaining; wxStaticText* m_staticText25; wxStaticText* m_staticTextRemainingObj; + wxStaticText* m_staticText96; + wxStaticText* m_staticTextDataRemaining; + wxStaticText* m_staticText97; wxBoxSizer* bSizerObjectsProcessed; wxStaticText* m_staticText251; wxStaticText* m_staticTextProcessedObj; - wxBoxSizer* bSizerSpeed; - wxStaticText* m_staticText108; - wxStaticText* m_staticTextSpeed; + wxStaticText* m_staticText98; + wxStaticText* m_staticTextDataProcessed; + wxStaticText* m_staticText99; wxButton* m_buttonOK; wxButton* m_buttonPause; wxButton* m_buttonAbort; - wxBoxSizer* bSizerDataRemaining; - wxStaticText* m_staticText26; - wxStaticText* m_staticTextDataRemaining; - wxBoxSizer* bSizerDataProcessed; - wxStaticText* m_staticText261; - wxStaticText* m_staticTextDataProcessed; - wxBoxSizer* bSizerRemTime; - wxStaticText* m_staticText106; - wxStaticText* m_staticTextTimeRemaining; + wxStaticText* m_staticText55; + wxStaticText* m_staticTextTimeElapsed; // Virtual event handlers, overide them in your derived class @@ -768,12 +735,14 @@ class WarningDlgGenerated : public wxDialog wxCheckBox* m_checkBoxDontShowAgain; wxButton* m_buttonIgnore; + wxButton* m_buttonSwitch; wxButton* m_buttonAbort; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } virtual void OnIgnore( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSwitch( wxCommandEvent& event ){ event.Skip(); } virtual void OnAbort( wxCommandEvent& event ){ event.Skip(); } @@ -872,7 +841,6 @@ class FilterDlgGenerated : public wxDialog wxStaticText* m_staticText85; wxStaticText* m_staticText181; wxStaticText* m_staticText1811; - wxStaticText* m_staticTextFilteringInactive; wxStaticText* m_staticText15; wxStaticBitmap* m_bitmap8; @@ -945,11 +913,7 @@ class GlobalSettingsDlgGenerated : public wxDialog wxPanel* m_panel8; wxStaticText* m_staticText56; - wxStaticText* m_staticText114; - wxCheckBox* m_checkBoxIgnoreOneHour; - wxStaticText* m_staticTextCopyLocked; - wxCheckBox* m_checkBoxCopyLocked; wxStaticLine* m_staticline10; wxStaticText* m_staticText100; @@ -977,7 +941,7 @@ class GlobalSettingsDlgGenerated : public wxDialog public: - GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + GlobalSettingsDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~GlobalSettingsDlgGenerated(); }; diff --git a/ui/guiStatusHandler.cpp b/ui/guiStatusHandler.cpp index 19eccb1c..0cd32383 100644 --- a/ui/guiStatusHandler.cpp +++ b/ui/guiStatusHandler.cpp @@ -28,7 +28,7 @@ CompareStatusHandler::CompareStatusHandler(MainDialog* dlg) : mainDialog->disableAllElements(); //display status panel during compare - mainDialog->compareStatus.init(); //clear old values and make visible + mainDialog->compareStatus->init(); //clear old values and make visible mainDialog->bSizer1->Layout(); //both sizers need to recalculate! mainDialog->bSizer6->Layout(); //adapt layout for wxBitmapWithImage @@ -37,7 +37,7 @@ CompareStatusHandler::CompareStatusHandler(MainDialog* dlg) : //register abort button mainDialog->m_buttonAbort->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CompareStatusHandler::OnAbortCompare ), NULL, this); - //register key event + //register key event mainDialog->Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this); } @@ -53,13 +53,13 @@ CompareStatusHandler::~CompareStatusHandler() mainDialog->pushStatusInformation(_("Operation aborted!")); //hide status panel from main window - mainDialog->compareStatus.finalize(); + mainDialog->compareStatus->finalize(); mainDialog->bSizer6->Layout(); //adapt layout for wxBitmapWithImage mainDialog->Layout(); mainDialog->Refresh(); - //register key event + //register key event mainDialog->Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(CompareStatusHandler::OnKeyPressed), NULL, this); //de-register abort button mainDialog->m_buttonAbort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CompareStatusHandler::OnAbortCompare ), NULL, this); @@ -70,10 +70,10 @@ void CompareStatusHandler::OnKeyPressed(wxKeyEvent& event) { const int keyCode = event.GetKeyCode(); if (keyCode == WXK_ESCAPE) - { - wxCommandEvent dummy; - OnAbortCompare(dummy); - } + { + wxCommandEvent dummy; + OnAbortCompare(dummy); + } event.Skip(); } @@ -81,7 +81,7 @@ void CompareStatusHandler::OnKeyPressed(wxKeyEvent& event) void CompareStatusHandler::updateStatusText(const Zstring& text) { - mainDialog->compareStatus.setStatusText_NoUpdate(text); + mainDialog->compareStatus->setStatusText_NoUpdate(text); } @@ -94,7 +94,7 @@ void CompareStatusHandler::initNewProcess(int objectsTotal, wxLongLong dataTotal case StatusHandler::PROCESS_SCANNING: break; case StatusHandler::PROCESS_COMPARING_CONTENT: - mainDialog->compareStatus.switchToCompareBytewise(objectsTotal, dataTotal); + mainDialog->compareStatus->switchToCompareBytewise(objectsTotal, dataTotal); mainDialog->Layout(); break; case StatusHandler::PROCESS_SYNCHRONIZING: @@ -111,10 +111,10 @@ void CompareStatusHandler::updateProcessedData(int objectsProcessed, wxLongLong switch (currentProcess) { case StatusHandler::PROCESS_SCANNING: - mainDialog->compareStatus.incScannedObjects_NoUpdate(objectsProcessed); + mainDialog->compareStatus->incScannedObjects_NoUpdate(objectsProcessed); break; case StatusHandler::PROCESS_COMPARING_CONTENT: - mainDialog->compareStatus.incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); + mainDialog->compareStatus->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed); break; case StatusHandler::PROCESS_SYNCHRONIZING: case StatusHandler::PROCESS_NONE: @@ -129,13 +129,12 @@ ErrorHandler::Response CompareStatusHandler::reportError(const wxString& message if (ignoreErrors) return ErrorHandler::IGNORE_ERROR; - mainDialog->compareStatus.updateStatusPanelNow(); + mainDialog->compareStatus->updateStatusPanelNow(); bool ignoreNextErrors = false; - const wxString errorMessage = message + wxT("\n\n\n") + _("Ignore this error, retry or abort?"); ErrorDlg errorDlg(NULL, ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, - errorMessage, ignoreNextErrors); + message, ignoreNextErrors); errorDlg.Raise(); switch (static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal())) { @@ -157,7 +156,7 @@ ErrorHandler::Response CompareStatusHandler::reportError(const wxString& message void CompareStatusHandler::reportFatalError(const wxString& errorMessage) { - mainDialog->compareStatus.updateStatusPanelNow(); + mainDialog->compareStatus->updateStatusPanelNow(); bool dummy = false; ErrorDlg errorDlg(NULL, @@ -174,7 +173,7 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w if (!warningActive || ignoreErrors) //if errors are ignored, then warnings should also return; - mainDialog->compareStatus.updateStatusPanelNow(); + mainDialog->compareStatus->updateStatusPanelNow(); //show popup and ask user how to handle warning bool dontWarnAgain = false; @@ -185,13 +184,15 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w warningDlg.Raise(); switch (static_cast<WarningDlg::Response>(warningDlg.ShowModal())) { - case WarningDlg::BUTTON_ABORT: - abortThisProcess(); - break; - case WarningDlg::BUTTON_IGNORE: warningActive = !dontWarnAgain; break; + + case WarningDlg::BUTTON_SWITCH: + assert(false); + case WarningDlg::BUTTON_ABORT: + abortThisProcess(); + break; } } @@ -199,7 +200,7 @@ void CompareStatusHandler::reportWarning(const wxString& warningMessage, bool& w inline void CompareStatusHandler::forceUiRefresh() { - mainDialog->compareStatus.updateStatusPanelNow(); + mainDialog->compareStatus->updateStatusPanelNow(); } @@ -305,7 +306,7 @@ ErrorHandler::Response SyncStatusHandler::reportError(const wxString& errorMessa bool ignoreNextErrors = false; ErrorDlg errorDlg(NULL, ErrorDlg::BUTTON_IGNORE | ErrorDlg::BUTTON_RETRY | ErrorDlg::BUTTON_ABORT, - errorMessage + wxT("\n\n\n") + _("Ignore this error, retry or abort synchronization?"), + errorMessage, ignoreNextErrors); errorDlg.Raise(); const ErrorDlg::ReturnCodes rv = static_cast<ErrorDlg::ReturnCodes>(errorDlg.ShowModal()); @@ -361,6 +362,8 @@ void SyncStatusHandler::reportWarning(const wxString& warningMessage, bool& warn warningActive = !dontWarnAgain; return; + case WarningDlg::BUTTON_SWITCH: + assert(false); case WarningDlg::BUTTON_ABORT: abortThisProcess(); return; diff --git a/ui/guiStatusHandler.h b/ui/guiStatusHandler.h index 3dab9a85..add3ffaa 100644 --- a/ui/guiStatusHandler.h +++ b/ui/guiStatusHandler.h @@ -35,7 +35,7 @@ public: virtual void reportWarning(const wxString& warningMessage, bool& warningActive); private: -void OnKeyPressed(wxKeyEvent& event); + void OnKeyPressed(wxKeyEvent& event); void OnAbortCompare(wxCommandEvent& event); //handle abort button click virtual void abortThisProcess(); diff --git a/ui/isNullFilter.h b/ui/isNullFilter.h new file mode 100644 index 00000000..f68bc65d --- /dev/null +++ b/ui/isNullFilter.h @@ -0,0 +1,24 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#ifndef ISNULLFILTER_H_INCLUDED +#define ISNULLFILTER_H_INCLUDED + +#include "../structures.h" +#include "../library/filter.h" + +namespace FreeFileSync +{ + +inline +bool isNullFilter(const FilterConfig& filterCfg) +{ + return NameFilter(filterCfg.includeFilter, filterCfg.excludeFilter).isNull(); +} + +} + +#endif // ISNULLFILTER_H_INCLUDED diff --git a/ui/messagePopup.cpp b/ui/messagePopup.cpp index fe051eed..771df4f3 100644 --- a/ui/messagePopup.cpp +++ b/ui/messagePopup.cpp @@ -81,6 +81,9 @@ WarningDlg::WarningDlg(wxWindow* parentWindow, int activeButtons, const wxStrin m_checkBoxDontShowAgain->Hide(); } + if (~activeButtons & BUTTON_SWITCH) + m_buttonSwitch->Hide(); + if (~activeButtons & BUTTON_ABORT) m_buttonAbort->Hide(); @@ -91,8 +94,6 @@ WarningDlg::WarningDlg(wxWindow* parentWindow, int activeButtons, const wxStrin m_buttonAbort->SetFocus(); } -WarningDlg::~WarningDlg() {} - void WarningDlg::OnClose(wxCloseEvent& event) { @@ -108,6 +109,13 @@ void WarningDlg::OnIgnore(wxCommandEvent& event) } +void WarningDlg::OnSwitch(wxCommandEvent& event) +{ + dontShowAgain = m_checkBoxDontShowAgain->GetValue(); + EndModal(BUTTON_SWITCH); +} + + void WarningDlg::OnAbort(wxCommandEvent& event) { dontShowAgain = m_checkBoxDontShowAgain->GetValue(); diff --git a/ui/messagePopup.h b/ui/messagePopup.h index e1fa58fb..d41594b5 100644 --- a/ui/messagePopup.h +++ b/ui/messagePopup.h @@ -36,21 +36,19 @@ class WarningDlg : public WarningDlgGenerated { public: WarningDlg(wxWindow* parentWindow, int activeButtons, const wxString messageText, bool& dontShowAgain); - ~WarningDlg(); enum Response { BUTTON_IGNORE = 1, - BUTTON_ABORT = 2 + BUTTON_SWITCH = 2, + BUTTON_ABORT = 4 }; private: void OnClose(wxCloseEvent& event); void OnIgnore(wxCommandEvent& event); - void OnResolve(wxCommandEvent& event); + void OnSwitch(wxCommandEvent& event); void OnAbort(wxCommandEvent& event); - void OnOkay(wxCommandEvent& event); - bool& dontShowAgain; }; diff --git a/ui/progressIndicator.cpp b/ui/progressIndicator.cpp index e2680b0e..09af2f6f 100644 --- a/ui/progressIndicator.cpp +++ b/ui/progressIndicator.cpp @@ -184,7 +184,11 @@ void CompareStatus::CompareStatusImpl::init() m_gauge2->SetValue(0); //initially hide status that's relevant for comparing bytewise only - bSizer42->Hide(sbSizer13); + bSizerFilesFound->Show(true); + bSizerFilesRemaining->Show(false); + sSizerSpeed->Show(false); + sSizerTimeRemaining->Show(false); + m_gauge2->Hide(); bSizer42->Layout(); @@ -239,7 +243,11 @@ void CompareStatus::CompareStatusImpl::switchToCompareBytewise(int totalObjectsT lastStatCallRemTime = -1000000; //show status for comparing bytewise - bSizer42->Show(sbSizer13); + bSizerFilesFound->Show(false); + bSizerFilesRemaining->Show(true); + sSizerSpeed->Show(true); + sSizerTimeRemaining->Show(true); + m_gauge2->Show(); bSizer42->Layout(); } @@ -502,7 +510,7 @@ void SyncStatus::processHasFinished(SyncStatusID id, const wxString& finalMessag SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWindow* parentWindow) : SyncStatusDlgGenerated(parentWindow, wxID_ANY, - parentWindow ? wxEmptyString : _("FreeFileSync - Folder Comparison and Synchronization"), + parentWindow ? wxString(wxEmptyString) : (wxString(wxT("FreeFileSync - ")) + _("Folder Comparison and Synchronization")), wxDefaultPosition, wxSize(638, 376), parentWindow ? wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT : //wxTAB_TRAVERSAL is needed for standard button handling: wxID_OK/wxID_CANCEL @@ -551,7 +559,7 @@ SyncStatus::SyncStatusImpl::SyncStatusImpl(StatusHandler& updater, wxTopLevelWin //hide "processed" statistics until end of process bSizerObjectsProcessed->Show(false); - bSizerDataProcessed->Show(false); + //bSizerDataProcessed->Show(false); SetIcon(*GlobalResources::getInstance().programIcon); //set application icon @@ -865,13 +873,13 @@ void SyncStatus::SyncStatusImpl::processHasFinished(SyncStatus::SyncStatusID id, totalData == currentData) { bSizerObjectsRemaining->Show(false); - bSizerDataRemaining ->Show(false); + //bSizerDataRemaining ->Show(false); //show processed statistics at the end (but only if there was some work to be done) if (totalObjects != 0 || totalData != 0) { bSizerObjectsProcessed->Show(true); - bSizerDataProcessed ->Show(true); + //bSizerDataProcessed ->Show(true); m_staticTextProcessedObj->SetLabel(numberToWxString(currentObjects, true)); m_staticTextDataProcessed->SetLabel(FreeFileSync::formatFilesizeToShortString(currentData)); diff --git a/ui/search.cpp b/ui/search.cpp index 418ef2ac..367d6502 100644 --- a/ui/search.cpp +++ b/ui/search.cpp @@ -8,6 +8,7 @@ #include "guiGenerated.h" #include <wx/msgdlg.h> #include <wx/utils.h> +#include <utility> class SearchDlg : public SearchDialogGenerated diff --git a/ui/settingsDialog.cpp b/ui/settingsDialog.cpp deleted file mode 100644 index 5199b987..00000000 --- a/ui/settingsDialog.cpp +++ /dev/null @@ -1,1389 +0,0 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * -// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * -// ************************************************************************** -// -#include "settingsDialog.h" -#include "../shared/systemConstants.h" -#include "../library/resources.h" -#include <wx/msgdlg.h> -#include "../shared/customButton.h" -#include "../synchronization.h" -#include "../shared/stringConv.h" -#include "../shared/util.h" -#include <wx/dnd.h> -#include "../shared/dragAndDrop.h" -#include "../shared/fileHandling.h" -#include "../shared/xmlBase.h" -#include <wx/wupdlock.h> -#include "folderPair.h" -#include "messagePopup.h" -#include "../shared/helpProvider.h" - -using namespace FreeFileSync; - - -SyncCfgDialog::SyncCfgDialog(wxWindow* window, - const CompareVariant compareVar, - SyncConfiguration& syncConfiguration, - DeletionPolicy& handleDeletion, - wxString& customDeletionDirectory, - bool* ignoreErrors) : - SyncCfgDlgGenerated(window), - cmpVariant(compareVar), - currentSyncConfig(syncConfiguration), //make working copy of syncConfiguration - refSyncConfiguration(syncConfiguration), - refHandleDeletion(handleDeletion), - refCustomDeletionDirectory(customDeletionDirectory), - refIgnoreErrors(ignoreErrors), - dragDropCustomDelFolder(new DragDropOnDlg(m_panelCustomDeletionDir, m_dirPickerCustomDelFolder, m_textCtrlCustomDelFolder)) -{ - setDeletionHandling(handleDeletion); - m_textCtrlCustomDelFolder->SetValue(customDeletionDirectory); - - //error handling - if (ignoreErrors) - setErrorHandling(*ignoreErrors); - else - { - sbSizerErrorHandling->Show(false); - Layout(); - } - - //set sync config icons - updateConfigIcons(cmpVariant, currentSyncConfig); - - //set icons for this dialog - m_bitmapLeftOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftOnly"))); - m_bitmapRightOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightOnly"))); - m_bitmapLeftNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftNewer"))); - m_bitmapRightNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightNewer"))); - m_bitmapDifferent->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("different"))); - m_bitmapConflict->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("conflictGrey"))); - - bSizer201->Layout(); //wxButtonWithImage size might have changed - - m_buttonOK->SetFocus(); - - Fit(); -} - -//################################################################################################################# - -SyncCfgDialog::~SyncCfgDialog() {} //non-inline destructor for std::auto_ptr to work with forward declaration - - -void SyncCfgDialog::updateConfigIcons(const FreeFileSync::CompareVariant cmpVar, const FreeFileSync::SyncConfiguration& syncConfig) -{ - //wxWindowUpdateLocker dummy(this); //avoid display distortion - wxWindowUpdateLocker dummy2(m_panelCustomDeletionDir); //avoid display distortion - wxWindowUpdateLocker dummy3(m_bpButtonLeftOnly); - wxWindowUpdateLocker dummy4(m_bpButtonRightOnly); - wxWindowUpdateLocker dummy5(m_bpButtonLeftNewer); - wxWindowUpdateLocker dummy6(m_bpButtonRightNewer); - wxWindowUpdateLocker dummy7(m_bpButtonDifferent); - wxWindowUpdateLocker dummy8(m_bpButtonConflict); - - - updateConfigIcons(cmpVar, - syncConfig, - m_bpButtonLeftOnly, - m_bpButtonRightOnly, - m_bpButtonLeftNewer, - m_bpButtonRightNewer, - m_bpButtonDifferent, - m_bpButtonConflict, - m_bitmapLeftOnly, - m_bitmapRightOnly, - m_bitmapLeftNewer, - m_bitmapRightNewer, - m_bitmapDifferent, - m_bitmapConflict, - sbSizerSyncDirections); - - //set radiobuttons -> have no parameter-ownership at all! - switch (FreeFileSync::getVariant(currentSyncConfig)) - { - case SyncConfiguration::AUTOMATIC: - m_radioBtnAutomatic->SetValue(true); //automatic mode - break; - case SyncConfiguration::MIRROR: - m_radioBtnMirror->SetValue(true); //one way -> - break; - case SyncConfiguration::UPDATE: - m_radioBtnUpdate->SetValue(true); //Update -> - break; - case SyncConfiguration::CUSTOM: - m_radioBtnCustom->SetValue(true); //custom - break; - } - - GetSizer()->SetSizeHints(this); //this works like a charm for GTK2 with window resizing problems!!! (includes call to Fit()) -} - - -void SyncCfgDialog::updateConfigIcons(const CompareVariant compareVar, - const SyncConfiguration& syncConfig, - wxBitmapButton* buttonLeftOnly, - wxBitmapButton* buttonRightOnly, - wxBitmapButton* buttonLeftNewer, - wxBitmapButton* buttonRightNewer, - wxBitmapButton* buttonDifferent, - wxBitmapButton* buttonConflict, - wxStaticBitmap* bitmapLeftOnly, - wxStaticBitmap* bitmapRightOnly, - wxStaticBitmap* bitmapLeftNewer, - wxStaticBitmap* bitmapRightNewer, - wxStaticBitmap* bitmapDifferent, - wxStaticBitmap* bitmapConflict, - wxSizer* syncDirections) //sizer containing all sync-directions -{ - //display only relevant sync options - syncDirections->Show(true); - - buttonLeftOnly ->Show(); // - buttonRightOnly ->Show(); // - buttonLeftNewer ->Show(); // - buttonRightNewer->Show(); // enable everything by default - buttonDifferent ->Show(); // - buttonConflict ->Show(); // - - bitmapLeftOnly ->Show(); // - bitmapRightOnly ->Show(); // - bitmapLeftNewer ->Show(); // - bitmapRightNewer->Show(); // - bitmapDifferent ->Show(); // - bitmapConflict ->Show(); // - - switch (compareVar) - { - case CMP_BY_TIME_SIZE: - buttonDifferent ->Hide(); - - bitmapDifferent ->Hide(); - break; - - case CMP_BY_CONTENT: - buttonLeftNewer ->Hide(); - buttonRightNewer->Hide(); - - bitmapLeftNewer ->Hide(); - bitmapRightNewer->Hide(); - break; - } - - if (syncConfig.automatic) //automatic mode needs no sync-directions - syncDirections->Show(false); - - switch (syncConfig.exLeftSideOnly) - { - case SYNC_DIR_RIGHT: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRightCr"))); - buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteLeft"))); - buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING)); - break; - } - - switch (syncConfig.exRightSideOnly) - { - case SYNC_DIR_RIGHT: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteRight"))); - buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeftCr"))); - buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT)); - break; - case SYNC_DIR_NONE: - buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING)); - break; - } - - switch (syncConfig.leftNewer) - { - case SYNC_DIR_RIGHT: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING)); - break; - } - - switch (syncConfig.rightNewer) - { - case SYNC_DIR_RIGHT: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING)); - break; - } - - switch (syncConfig.different) - { - case SYNC_DIR_RIGHT: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); - buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING)); - break; - } - - switch (syncConfig.conflict) - { - case SYNC_DIR_RIGHT: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); - buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); - break; - case SYNC_DIR_LEFT: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); - buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); - break; - case SYNC_DIR_NONE: - buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("conflict"))); - buttonConflict->SetToolTip(_("Leave as unresolved conflict")); - break; - } -} - - -void SyncCfgDialog::OnClose(wxCloseEvent& event) -{ - EndModal(0); -} - - -void SyncCfgDialog::OnCancel(wxCommandEvent& event) -{ - EndModal(0); -} - - -void SyncCfgDialog::OnApply(wxCommandEvent& event) -{ - //write configuration to main dialog - refSyncConfiguration = currentSyncConfig; - refHandleDeletion = getDeletionHandling(); - refCustomDeletionDirectory = m_textCtrlCustomDelFolder->GetValue(); - if (refIgnoreErrors) - *refIgnoreErrors = getErrorHandling(); - - EndModal(BUTTON_APPLY); -} - - -void SyncCfgDialog::updateToolTipErrorHandling(bool ignoreErrors) -{ - if (ignoreErrors) - m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); - else - m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); -} - - -bool SyncCfgDialog::getErrorHandling() -{ - if (m_choiceHandleError->GetSelection() == 1) //Ignore errors - return true; - else - return false; // Show popup -} - - -void SyncCfgDialog::setErrorHandling(bool ignoreErrors) -{ - m_choiceHandleError->Clear(); - m_choiceHandleError->Append(_("Show popup")); - m_choiceHandleError->Append(_("Ignore errors")); - - if (ignoreErrors) - m_choiceHandleError->SetSelection(1); - else - m_choiceHandleError->SetSelection(0); - - updateToolTipErrorHandling(ignoreErrors); -} - - -void SyncCfgDialog::OnChangeErrorHandling(wxCommandEvent& event) -{ - updateToolTipErrorHandling(getErrorHandling()); -} - -//------------------- - -void updateToolTipDeletionHandling(wxChoice* choiceHandleError, wxPanel* customDir, const FreeFileSync::DeletionPolicy value) -{ - customDir->Disable(); - - switch (value) - { - case FreeFileSync::DELETE_PERMANENTLY: - choiceHandleError->SetToolTip(_("Delete or overwrite files permanently")); - break; - - case FreeFileSync::MOVE_TO_RECYCLE_BIN: - choiceHandleError->SetToolTip(_("Use Recycle Bin when deleting or overwriting files")); - break; - - case FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY: - choiceHandleError->SetToolTip(_("Move files into a time-stamped subdirectory")); - customDir->Enable(); - break; - } -} - - -FreeFileSync::DeletionPolicy SyncCfgDialog::getDeletionHandling() -{ - switch (m_choiceHandleDeletion->GetSelection()) - { - case 0: - return FreeFileSync::DELETE_PERMANENTLY; - case 1: - return FreeFileSync::MOVE_TO_RECYCLE_BIN; - case 2: - return FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY; - default: - assert(false); - return FreeFileSync::MOVE_TO_RECYCLE_BIN; - } -} - - -void SyncCfgDialog::setDeletionHandling(FreeFileSync::DeletionPolicy newValue) -{ - m_choiceHandleDeletion->Clear(); - m_choiceHandleDeletion->Append(_("Delete permanently")); - m_choiceHandleDeletion->Append(_("Use Recycle Bin")); - m_choiceHandleDeletion->Append(_("User-defined directory")); - - switch (newValue) - { - case FreeFileSync::DELETE_PERMANENTLY: - m_choiceHandleDeletion->SetSelection(0); - break; - case FreeFileSync::MOVE_TO_RECYCLE_BIN: - m_choiceHandleDeletion->SetSelection(1); - break; - case FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY: - m_choiceHandleDeletion->SetSelection(2); - break; - } - - updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, newValue); -} - - -void SyncCfgDialog::OnChangeDeletionHandling(wxCommandEvent& event) -{ - updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, getDeletionHandling()); -} - - -void SyncCfgDialog::OnSyncAutomatic(wxCommandEvent& event) -{ - FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::AUTOMATIC); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnSyncLeftToRight(wxCommandEvent& event) -{ - FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::MIRROR); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnSyncUpdate(wxCommandEvent& event) -{ - FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::UPDATE); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void toggleSyncDirection(SyncDirection& current) -{ - switch (current) - { - case SYNC_DIR_RIGHT: - current = SYNC_DIR_LEFT; - break; - case SYNC_DIR_LEFT: - current = SYNC_DIR_NONE; - break; - case SYNC_DIR_NONE: - current = SYNC_DIR_RIGHT; - break; - } -} - - -void SyncCfgDialog::OnExLeftSideOnly(wxCommandEvent& event ) -{ - toggleSyncDirection(currentSyncConfig.exLeftSideOnly); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnExRightSideOnly(wxCommandEvent& event ) -{ - toggleSyncDirection(currentSyncConfig.exRightSideOnly); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnLeftNewer(wxCommandEvent& event ) -{ - toggleSyncDirection(currentSyncConfig.leftNewer); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnRightNewer(wxCommandEvent& event ) -{ - toggleSyncDirection(currentSyncConfig.rightNewer); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnDifferent(wxCommandEvent& event ) -{ - toggleSyncDirection(currentSyncConfig.different); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -void SyncCfgDialog::OnConflict(wxCommandEvent& event) -{ - toggleSyncDirection(currentSyncConfig.conflict); - updateConfigIcons(cmpVariant, currentSyncConfig); -} - - -//################################################################################################################################### - -class BatchFileDropEvent : public wxFileDropTarget -{ -public: - BatchFileDropEvent(BatchDialog& dlg) : - batchDlg(dlg) {} - - virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames) - { - if (!filenames.IsEmpty()) - { - const wxString droppedFileName = filenames[0]; - - xmlAccess::XmlType fileType = xmlAccess::getXmlType(droppedFileName); - - //test if ffs batch file has been dropped - if (fileType == xmlAccess::XML_BATCH_CONFIG) - batchDlg.loadBatchFile(droppedFileName); - else - { - wxString errorMessage = _("%x is not a valid FreeFileSync batch file!"); - errorMessage.Replace(wxT("%x"), wxString(wxT("\"")) + droppedFileName + wxT("\""), false); - wxMessageBox(errorMessage, _("Error"), wxOK | wxICON_ERROR); - } - } - return false; - } - -private: - BatchDialog& batchDlg; -}; - -//################################################################################################################################### - -//------------------------------------------------------------------ -/* class hierarchy: - - template<> - FolderPairPanelBasic - /|\ - | - template<> - FolderPairCallback BatchFolderPairGenerated - /|\ /|\ - _________|______________ ________| - | | | - FirstBatchFolderPairCfg BatchFolderPairPanel -*/ - -template <class GuiPanel> -class FolderPairCallback : public FolderPairPanelBasic<GuiPanel> //implements callback functionality to BatchDialog as imposed by FolderPairPanelBasic -{ -public: - FolderPairCallback(GuiPanel& basicPanel, BatchDialog& batchDialog) : - FolderPairPanelBasic<GuiPanel>(basicPanel), //pass FolderPairGenerated part... - batchDlg(batchDialog) {} - -private: - virtual wxWindow* getParentWindow() - { - return &batchDlg; - } - - virtual MainConfiguration getMainConfig() const - { - return batchDlg.getCurrentConfiguration().mainCfg; - } - - BatchDialog& batchDlg; -}; - - -class BatchFolderPairPanel : - public BatchFolderPairGenerated, //BatchFolderPairPanel "owns" BatchFolderPairGenerated! - public FolderPairCallback<BatchFolderPairGenerated> -{ -public: - BatchFolderPairPanel(wxWindow* parent, BatchDialog& batchDialog) : - BatchFolderPairGenerated(parent), - FolderPairCallback<BatchFolderPairGenerated>(static_cast<BatchFolderPairGenerated&>(*this), batchDialog), //pass BatchFolderPairGenerated part... - dragDropOnLeft( m_panelLeft, m_dirPickerLeft, m_directoryLeft), - dragDropOnRight(m_panelRight, m_dirPickerRight, m_directoryRight) {} - -private: - //support for drag and drop - DragDropOnDlg dragDropOnLeft; - DragDropOnDlg dragDropOnRight; -}; - - -class FirstBatchFolderPairCfg : public FolderPairCallback<BatchDlgGenerated> -{ -public: - FirstBatchFolderPairCfg(BatchDialog& batchDialog) : - FolderPairCallback<BatchDlgGenerated>(batchDialog, batchDialog), - - //prepare drag & drop - dragDropOnLeft(batchDialog.m_panelLeft, - batchDialog.m_dirPickerLeft, - batchDialog.m_directoryLeft), - dragDropOnRight(batchDialog.m_panelRight, - batchDialog.m_dirPickerRight, - batchDialog.m_directoryRight) {} - -private: - //support for drag and drop - DragDropOnDlg dragDropOnLeft; - DragDropOnDlg dragDropOnRight; -}; - - -//################################################################################################################################### -BatchDialog::BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg) : - BatchDlgGenerated(window) -{ - init(); - loadBatchCfg(batchCfg); -} - - -BatchDialog::BatchDialog(wxWindow* window, const wxString& filename) : - BatchDlgGenerated(window) -{ - init(); - loadBatchFile(filename); -} - - -BatchDialog::~BatchDialog() {} //non-inline destructor for std::auto_ptr to work with forward declaration - - -void BatchDialog::init() -{ - wxWindowUpdateLocker dummy(this); //avoid display distortion - - m_bpButtonHelp->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("help"))); - - //init handling of first folder pair - firstFolderPair.reset(new FirstBatchFolderPairCfg(*this)); - - - //prepare drag & drop for loading of *.ffs_batch files - SetDropTarget(new BatchFileDropEvent(*this)); - dragDropOnLogfileDir.reset(new DragDropOnDlg(m_panelLogging, m_dirPickerLogfileDir, m_textCtrlLogfileDir)); - - //support for drag and drop: user-defined deletion directory - dragDropCustomDelFolder.reset(new DragDropOnDlg(m_panelCustomDeletionDir, m_dirPickerCustomDelFolder, m_textCtrlCustomDelFolder)); - - - //set icons for this dialog - m_bpButtonAddPair->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("addFolderPair"))); - m_bitmapLeftOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftOnly"))); - m_bitmapRightOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightOnly"))); - m_bitmapLeftNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftNewer"))); - m_bitmapRightNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightNewer"))); - m_bitmapDifferent->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("different"))); - m_bitmapConflict->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("conflictGrey"))); - m_bitmap8->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("include"))); - m_bitmap9->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("exclude"))); - m_bitmap27->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("batch"))); - - m_buttonSave->SetFocus(); -} - -//------------------- error handling -------------------------- - -xmlAccess::OnError BatchDialog::getSelectionHandleError() const -{ - switch (m_choiceHandleError->GetSelection()) - { - case 0: - return xmlAccess::ON_ERROR_POPUP; - case 1: - return xmlAccess::ON_ERROR_IGNORE; - case 2: - return xmlAccess::ON_ERROR_EXIT; - default: - assert(false); - return xmlAccess::ON_ERROR_POPUP; - } -} - - -void BatchDialog::updateToolTipErrorHandling(const xmlAccess::OnError value) -{ - switch (value) - { - case xmlAccess::ON_ERROR_POPUP: - m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); - break; - case xmlAccess::ON_ERROR_IGNORE: - m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); - break; - case xmlAccess::ON_ERROR_EXIT: - m_choiceHandleError->SetToolTip(_("Abort synchronization immediately")); - break; - } -} - - -void BatchDialog::setSelectionHandleError(const xmlAccess::OnError value) -{ - m_choiceHandleError->Clear(); - m_choiceHandleError->Append(_("Show popup")); - m_choiceHandleError->Append(_("Ignore errors")); - if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! - m_choiceHandleError->Append(_("Exit instantly")); - - //default - m_choiceHandleError->SetSelection(0); - - switch (value) - { - case xmlAccess::ON_ERROR_POPUP: - m_choiceHandleError->SetSelection(0); - break; - case xmlAccess::ON_ERROR_IGNORE: - m_choiceHandleError->SetSelection(1); - break; - case xmlAccess::ON_ERROR_EXIT: - if (m_checkBoxSilent->GetValue()) //this option shall be available for silent mode only! - m_choiceHandleError->SetSelection(2); - break; - } - - updateToolTipErrorHandling(getSelectionHandleError()); -} - - -void BatchDialog::OnChangeErrorHandling(wxCommandEvent& event) -{ - updateToolTipErrorHandling(getSelectionHandleError()); -} - - -void BatchDialog::OnExLeftSideOnly(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.exLeftSideOnly); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -//------------------- deletion handling -------------------------- - -FreeFileSync::DeletionPolicy BatchDialog::getDeletionHandling() const -{ - switch (m_choiceHandleDeletion->GetSelection()) - { - case 0: - return FreeFileSync::DELETE_PERMANENTLY; - case 1: - return FreeFileSync::MOVE_TO_RECYCLE_BIN; - case 2: - return FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY; - default: - assert(false); - return FreeFileSync::MOVE_TO_RECYCLE_BIN; - } -} - - -void BatchDialog::setDeletionHandling(FreeFileSync::DeletionPolicy newValue) -{ - m_choiceHandleDeletion->Clear(); - m_choiceHandleDeletion->Append(_("Delete permanently")); - m_choiceHandleDeletion->Append(_("Use Recycle Bin")); - m_choiceHandleDeletion->Append(_("User-defined directory")); - - switch (newValue) - { - case FreeFileSync::DELETE_PERMANENTLY: - m_choiceHandleDeletion->SetSelection(0); - break; - case FreeFileSync::MOVE_TO_RECYCLE_BIN: - m_choiceHandleDeletion->SetSelection(1); - break; - case FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY: - m_choiceHandleDeletion->SetSelection(2); - break; - } - - updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, newValue); -} - - -void BatchDialog::OnChangeDeletionHandling(wxCommandEvent& event) -{ - updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, getDeletionHandling()); -} - - - -void BatchDialog::OnExRightSideOnly(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.exRightSideOnly); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -void BatchDialog::OnLeftNewer(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.leftNewer); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -void BatchDialog::OnRightNewer(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.rightNewer); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -void BatchDialog::OnDifferent(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.different); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -void BatchDialog::OnConflict(wxCommandEvent& event) -{ - toggleSyncDirection(localSyncConfiguration.conflict); - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); -} - - -void BatchDialog::OnHelp(wxCommandEvent& event) -{ -#ifdef FFS_WIN - FreeFileSync::displayHelpEntry(wxT("html\\advanced\\ScheduleBatch.html")); -#elif defined FFS_LINUX - FreeFileSync::displayHelpEntry(wxT("html/advanced/ScheduleBatch.html")); -#endif -} - - -void BatchDialog::OnCheckFilter(wxCommandEvent& event) -{ - updateVisibleTabs(); - - //update main local filter - firstFolderPair->refreshButtons(); - - //update folder pairs - for (std::vector<BatchFolderPairPanel*>::const_iterator i = additionalFolderPairs.begin(); i != additionalFolderPairs.end(); ++i) - { - BatchFolderPairPanel* dirPair = *i; - dirPair->refreshButtons(); - } -} - - -void BatchDialog::OnCheckAutomatic(wxCommandEvent& event) -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - - //toggle automatic setting - localSyncConfiguration.automatic = !localSyncConfiguration.automatic; - - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); - Fit(); -} - - -void BatchDialog::OnCheckSilent(wxCommandEvent& event) -{ - updateVisibleTabs(); - - //reset error handling depending on "m_checkBoxSilent" - setSelectionHandleError(getSelectionHandleError()); -} - - -void BatchDialog::updateVisibleTabs() -{ - showNotebookpage(m_panelFilter, _("Filter"), m_checkBoxFilter->GetValue()); - showNotebookpage(m_panelLogging, _("Logging"), m_checkBoxSilent->GetValue()); -} - - -void BatchDialog::showNotebookpage(wxWindow* page, const wxString& pageName, bool show) -{ - int windowPosition = -1; - for (size_t i = 0; i < m_notebookSettings->GetPageCount(); ++i) - if (m_notebookSettings->GetPage(i) == page) - { - windowPosition = static_cast<int>(i); - break; - } - - if (show) - { - if (windowPosition == -1) - m_notebookSettings->AddPage(page, pageName, false); - } - else - { - if (windowPosition != -1) - { - //do not delete currently selected tab!! - if (m_notebookSettings->GetCurrentPage() == m_notebookSettings->GetPage(windowPosition)) - m_notebookSettings->ChangeSelection(0); - - m_notebookSettings->RemovePage(windowPosition); - } - } -} - - -CompareVariant BatchDialog::getCurrentCompareVar() const -{ - if (m_radioBtnSizeDate->GetValue()) - return CMP_BY_TIME_SIZE; - else if (m_radioBtnContent->GetValue()) - return CMP_BY_CONTENT; - else - { - assert(false); - return CMP_BY_TIME_SIZE; - } -} - - -void BatchDialog::updateConfigIcons(const FreeFileSync::CompareVariant cmpVar, const FreeFileSync::SyncConfiguration& syncConfig) -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - - SyncCfgDialog::updateConfigIcons(cmpVar, - syncConfig, - m_bpButtonLeftOnly, - m_bpButtonRightOnly, - m_bpButtonLeftNewer, - m_bpButtonRightNewer, - m_bpButtonDifferent, - m_bpButtonConflict, - m_bitmapLeftOnly, - m_bitmapRightOnly, - m_bitmapLeftNewer, - m_bitmapRightNewer, - m_bitmapDifferent, - m_bitmapConflict, - sbSizerSyncDirections); - - //parameter ownership lies within localSyncConfiguration, NOT m_checkBoxAutomatic!!! - m_checkBoxAutomatic->SetValue(localSyncConfiguration.automatic); - - m_panelOverview->Layout(); //needed -} - - -void BatchDialog::OnChangeCompareVar(wxCommandEvent& event) -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - updateConfigIcons(getCurrentCompareVar(), localSyncConfiguration); - - Fit(); -} - - -void BatchDialog::OnClose(wxCloseEvent& event) -{ - EndModal(0); -} - - -void BatchDialog::OnCancel(wxCommandEvent& event) -{ - EndModal(0); -} - - -void BatchDialog::OnSaveBatchJob(wxCommandEvent& event) -{ - //get a filename - const wxString defaultFileName = proposedBatchFileName.empty() ? wxT("SyncJob.ffs_batch") : proposedBatchFileName; - - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, defaultFileName, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_SAVE); - if (filePicker->ShowModal() == wxID_OK) - { - const wxString newFileName = filePicker->GetPath(); - if (FreeFileSync::fileExists(wxToZ(newFileName))) - { - QuestionDlg* messageDlg = new QuestionDlg(this, - QuestionDlg::BUTTON_YES | QuestionDlg::BUTTON_CANCEL, - wxString(_("File already exists. Overwrite?")) + wxT(" \"") + newFileName + wxT("\"")); - - if (messageDlg->ShowModal() != QuestionDlg::BUTTON_YES) - { - OnSaveBatchJob(event); //retry - return; - } - } - - //create batch file - if (saveBatchFile(newFileName)) - EndModal(BATCH_FILE_SAVED); - } -} - - -void BatchDialog::OnLoadBatchJob(wxCommandEvent& event) -{ - wxFileDialog* filePicker = new wxFileDialog(this, wxEmptyString, wxEmptyString, wxEmptyString, wxString(_("FreeFileSync batch file")) + wxT(" (*.ffs_batch)|*.ffs_batch"), wxFD_OPEN);; - if (filePicker->ShowModal() == wxID_OK) - loadBatchFile(filePicker->GetPath()); -} - - - -inline -FolderPairEnh getEnahncedPair(const BatchFolderPairPanel* panel) -{ - return FolderPairEnh(panel->getLeftDir(), - panel->getRightDir(), - panel->getAltSyncConfig(), - panel->getAltFilterConfig()); -} - - -xmlAccess::XmlBatchConfig BatchDialog::getCurrentConfiguration() const -{ - xmlAccess::XmlBatchConfig batchCfg; - - //load structure with basic settings "mainCfg" - batchCfg.mainCfg.compareVar = getCurrentCompareVar(); - batchCfg.mainCfg.syncConfiguration = localSyncConfiguration; - batchCfg.mainCfg.filterIsActive = m_checkBoxFilter->GetValue(); - batchCfg.mainCfg.includeFilter = wxToZ(m_textCtrlInclude->GetValue()); - batchCfg.mainCfg.excludeFilter = wxToZ(m_textCtrlExclude->GetValue()); - batchCfg.mainCfg.handleDeletion = getDeletionHandling(); - batchCfg.mainCfg.customDeletionDirectory = m_textCtrlCustomDelFolder->GetValue(); - - //first folder pair - batchCfg.mainCfg.firstPair = FolderPairEnh(firstFolderPair->getLeftDir(), - firstFolderPair->getRightDir(), - firstFolderPair->getAltSyncConfig(), - firstFolderPair->getAltFilterConfig()); - - //add additional pairs - batchCfg.mainCfg.additionalPairs.clear(); - std::transform(additionalFolderPairs.begin(), additionalFolderPairs.end(), - std::back_inserter(batchCfg.mainCfg.additionalPairs), getEnahncedPair); - - - //load structure with batch settings "batchCfg" - batchCfg.silent = m_checkBoxSilent->GetValue(); - batchCfg.handleError = getSelectionHandleError(); - batchCfg.logFileDirectory = m_textCtrlLogfileDir->GetValue(); - - return batchCfg; -} - - -bool BatchDialog::saveBatchFile(const wxString& filename) -{ - const xmlAccess::XmlBatchConfig batchCfg = getCurrentConfiguration(); - - //write config to XML - try - { - xmlAccess::writeBatchConfig(batchCfg, filename); - } - catch (const xmlAccess::XmlError& error) - { - wxMessageBox(error.show().c_str(), _("Error"), wxOK | wxICON_ERROR); - return false; - } - - SetTitle(wxString(_("Create a batch job")) + wxT(" - ") + filename); - proposedBatchFileName = filename; //may be used on next save - - return true; -} - - -void BatchDialog::loadBatchFile(const wxString& filename) -{ - //load XML settings - xmlAccess::XmlBatchConfig batchCfg; //structure to receive gui settings - try - { - xmlAccess::readBatchConfig(filename, batchCfg); - } - catch (const xmlAccess::XmlError& error) - { - if (error.getSeverity() == xmlAccess::XmlError::WARNING) - wxMessageBox(error.show(), _("Warning"), wxOK | wxICON_WARNING); - else - { - wxMessageBox(error.show(), _("Error"), wxOK | wxICON_ERROR); - return; - } - } - - SetTitle(wxString(_("Create a batch job")) + wxT(" - ") + filename); - proposedBatchFileName = filename; //may be used on next save - this->loadBatchCfg(batchCfg); -} - - -void BatchDialog::loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg) -{ - wxWindowUpdateLocker dummy(this); //avoid display distortion - - //make working copy of mainDialog.cfg.syncConfiguration and recycler setting - localSyncConfiguration = batchCfg.mainCfg.syncConfiguration; - - setDeletionHandling(batchCfg.mainCfg.handleDeletion); - m_textCtrlCustomDelFolder->SetValue(batchCfg.mainCfg.customDeletionDirectory); - - switch (batchCfg.mainCfg.compareVar) - { - case CMP_BY_TIME_SIZE: - m_radioBtnSizeDate->SetValue(true); - break; - case CMP_BY_CONTENT: - m_radioBtnContent->SetValue(true); - break; - } - - updateConfigIcons(batchCfg.mainCfg.compareVar, batchCfg.mainCfg.syncConfiguration); - - m_checkBoxFilter->SetValue(batchCfg.mainCfg.filterIsActive); - m_textCtrlInclude->SetValue(zToWx(batchCfg.mainCfg.includeFilter)); - m_textCtrlExclude->SetValue(zToWx(batchCfg.mainCfg.excludeFilter)); - - m_checkBoxSilent->SetValue(batchCfg.silent); - m_textCtrlLogfileDir->SetValue(batchCfg.logFileDirectory); - //error handling is dependent from m_checkBoxSilent! /|\ \|/ - setSelectionHandleError(batchCfg.handleError); - - //set first folder pair - firstFolderPair->setValues(batchCfg.mainCfg.firstPair.leftDirectory, - batchCfg.mainCfg.firstPair.rightDirectory, - batchCfg.mainCfg.firstPair.altSyncConfig, - batchCfg.mainCfg.firstPair.localFilter); - - //remove existing additional folder pairs - clearAddFolderPairs(); - - //set additional pairs - addFolderPair(batchCfg.mainCfg.additionalPairs); - - updateVisibleTabs(); - - Fit(); //needed - Refresh(); //needed - Centre(); -} - - -void BatchDialog::OnAddFolderPair(wxCommandEvent& event) -{ - wxWindowUpdateLocker dummy(this); //avoid display distortion - - std::vector<FolderPairEnh> newPairs; - newPairs.push_back(getCurrentConfiguration().mainCfg.firstPair); - - addFolderPair(newPairs, true); //add pair in front of additonal pairs - - //clear first pair - const FolderPairEnh cfgEmpty; - firstFolderPair->setValues(cfgEmpty.leftDirectory, - cfgEmpty.rightDirectory, - cfgEmpty.altSyncConfig, - cfgEmpty.localFilter); -} - - -void BatchDialog::OnRemoveFolderPair(wxCommandEvent& event) -{ - //find folder pair originating the event - const wxObject* const eventObj = event.GetEventObject(); - for (std::vector<BatchFolderPairPanel*>::const_iterator i = additionalFolderPairs.begin(); i != additionalFolderPairs.end(); ++i) - { - if (eventObj == static_cast<wxObject*>((*i)->m_bpButtonRemovePair)) - { - removeAddFolderPair(i - additionalFolderPairs.begin()); - return; - } - } -} - - -void BatchDialog::OnRemoveTopFolderPair(wxCommandEvent& event) -{ - if (additionalFolderPairs.size() > 0) - { - //get settings from second folder pair - const FolderPairEnh cfgSecond = getEnahncedPair(additionalFolderPairs[0]); - - //reset first pair - firstFolderPair->setValues(cfgSecond.leftDirectory, - cfgSecond.rightDirectory, - cfgSecond.altSyncConfig, - cfgSecond.localFilter); - - removeAddFolderPair(0); //remove second folder pair (first of additional folder pairs) - } -} - - -const size_t MAX_FOLDER_PAIRS = 3; - - -void BatchDialog::updateGuiForFolderPair() -{ - //adapt delete top folder pair button - if (additionalFolderPairs.size() == 0) - m_bpButtonRemovePair->Hide(); - else - m_bpButtonRemovePair->Show(); - - //adapt local filter and sync cfg for first folder pair - if ( additionalFolderPairs.size() == 0 && - firstFolderPair->getAltSyncConfig().get() == NULL && - NameFilter(firstFolderPair->getAltFilterConfig().includeFilter, - firstFolderPair->getAltFilterConfig().excludeFilter).isNull()) - { - m_bpButtonLocalFilter->Hide(); - m_bpButtonAltSyncCfg->Hide(); - } - else - { - m_bpButtonLocalFilter->Show(); - m_bpButtonAltSyncCfg->Show(); - } - - m_scrolledWindow6->Fit(); //adjust scrolled window size - m_panelOverview->Layout(); //adjust stuff inside scrolled window -} - - -void BatchDialog::addFolderPair(const std::vector<FreeFileSync::FolderPairEnh>& newPairs, bool addFront) -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - - if (!newPairs.empty()) - { - //add folder pairs - int pairHeight = 0; - for (std::vector<FreeFileSync::FolderPairEnh>::const_iterator i = newPairs.begin(); i != newPairs.end(); ++i) - { - BatchFolderPairPanel* newPair = new BatchFolderPairPanel(m_scrolledWindow6, *this); - - if (addFront) - { - bSizerAddFolderPairs->Insert(0, newPair, 0, wxEXPAND, 5); - additionalFolderPairs.insert(additionalFolderPairs.begin(), newPair); - } - else - { - bSizerAddFolderPairs->Add(newPair, 0, wxEXPAND, 5); - additionalFolderPairs.push_back(newPair); - } - - //get size of scrolled window - pairHeight = newPair->GetSize().GetHeight(); - - //register events - newPair->m_bpButtonRemovePair->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(BatchDialog::OnRemoveFolderPair), NULL, this ); - - //set alternate configuration - newPair->setValues(i->leftDirectory, - i->rightDirectory, - i->altSyncConfig, - i->localFilter); - } - //set size of scrolled window - const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown - m_scrolledWindow6->SetMinSize(wxSize( -1, pairHeight * static_cast<int>(visiblePairs))); - - //update controls - m_scrolledWindow6->Fit(); //adjust scrolled window size - m_panelOverview->Layout(); //adjust stuff inside scrolled window - Fit(); //adapt dialog size - - //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this - m_bpButtonLeftOnly->SetFocus(); - } - - updateGuiForFolderPair(); -} - - -void BatchDialog::removeAddFolderPair(const int pos) -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - - if (0 <= pos && pos < static_cast<int>(additionalFolderPairs.size())) - { - //remove folder pairs from window - BatchFolderPairPanel* pairToDelete = additionalFolderPairs[pos]; - const int pairHeight = pairToDelete->GetSize().GetHeight(); - - bSizerAddFolderPairs->Detach(pairToDelete); //Remove() does not work on Window*, so do it manually - pairToDelete->Destroy(); // - additionalFolderPairs.erase(additionalFolderPairs.begin() + pos); //remove last element in vector - - //set size of scrolled window - const size_t visiblePairs = std::min(additionalFolderPairs.size() + 1, MAX_FOLDER_PAIRS); //up to MAX_FOLDER_PAIRS pairs shall be shown - m_scrolledWindow6->SetMinSize(wxSize(-1, pairHeight * static_cast<int>(visiblePairs))); - - //update controls - m_scrolledWindow6->Fit(); //adjust scrolled window size - m_panelOverview->Layout(); //adjust stuff inside scrolled window - - m_panelOverview->InvalidateBestSize(); //needed for Fit() to work correctly! - Fit(); //adapt dialog size - - //after changing folder pairs window focus is lost: results in scrolled window scrolling to top each time window is shown: we don't want this - m_bpButtonLeftOnly->SetFocus(); - } - - updateGuiForFolderPair(); -} - - -void BatchDialog::clearAddFolderPairs() -{ - wxWindowUpdateLocker dummy(m_panelOverview); //avoid display distortion - - additionalFolderPairs.clear(); - bSizerAddFolderPairs->Clear(true); - - m_scrolledWindow6->SetMinSize(wxSize(-1, sbSizerMainPair->GetSize().GetHeight())); //respect height of main pair -} - - -/* -#ifdef FFS_WIN -#include <wx/msw/wrapwin.h> //includes "windows.h" -#include <shlobj.h> -#endif // FFS_WIN - -template <typename T> -struct CleanUp -{ - CleanUp(T* element) : m_element(element) {} - - ~CleanUp() - { - m_element->Release(); - } - - T* m_element; -}; - - -bool BatchDialog::createBatchFile(const wxString& filename) -{ - //create shell link (instead of batch file) for full Unicode support - HRESULT hResult = E_FAIL; - IShellLink* pShellLink = NULL; - - if (FAILED(CoCreateInstance(CLSID_ShellLink, //class identifier - NULL, //object isn't part of an aggregate - CLSCTX_INPROC_SERVER, //context for running executable code - IID_IShellLink, //interface identifier - (void**)&pShellLink))) //pointer to storage of interface pointer - return false; - CleanUp<IShellLink> cleanOnExit(pShellLink); - - wxString freeFileSyncExe = wxStandardPaths::Get().GetExecutablePath(); - if (FAILED(pShellLink->SetPath(freeFileSyncExe.c_str()))) - return false; - - if (FAILED(pShellLink->SetArguments(getCommandlineArguments().c_str()))) - return false; - - if (FAILED(pShellLink->SetIconLocation(freeFileSyncExe.c_str(), 1))) //second icon from executable file is used - return false; - - if (FAILED(pShellLink->SetDescription(_("FreeFileSync Batch Job")))) - return false; - - IPersistFile* pPersistFile = NULL; - if (FAILED(pShellLink->QueryInterface(IID_IPersistFile, (void**)&pPersistFile))) - return false; - CleanUp<IPersistFile> cleanOnExit2(pPersistFile); - - //pPersistFile->Save accepts unicode input only -#ifdef _UNICODE - hResult = pPersistFile->Save(filename.c_str(), TRUE); -#else - WCHAR wszTemp [MAX_PATH]; - if (MultiByteToWideChar(CP_ACP, 0, filename.c_str(), -1, wszTemp, MAX_PATH) == 0) - return false; - - hResult = pPersistFile->Save(wszTemp, TRUE); -#endif - if (FAILED(hResult)) - return false; - - return true; -} -*/ diff --git a/ui/switchToGui.cpp b/ui/switchToGui.cpp new file mode 100644 index 00000000..ed678dd1 --- /dev/null +++ b/ui/switchToGui.cpp @@ -0,0 +1,27 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#include "switchToGui.h" +#include "mainDialog.h" + +using FreeFileSync::SwitchToGui; + + +SwitchToGui::SwitchToGui(const xmlAccess::XmlBatchConfig& batchCfg, + xmlAccess::XmlGlobalSettings& globalSettings) : //prepare + globalSettings_(globalSettings), + guiCfg(xmlAccess::convertBatchToGui(batchCfg)) {} + + +void SwitchToGui::execute() const //throw() +{ + try + { + MainDialog* frame = new MainDialog(guiCfg, globalSettings_, true); + frame->Show(); + } + catch(...) {} +} diff --git a/ui/switchToGui.h b/ui/switchToGui.h new file mode 100644 index 00000000..7970534a --- /dev/null +++ b/ui/switchToGui.h @@ -0,0 +1,29 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#ifndef SWITCHTOGUI_H_INCLUDED +#define SWITCHTOGUI_H_INCLUDED + +#include "../library/processXml.h" + + +namespace FreeFileSync +{ + +//switch from FreeFileSync Batch to GUI modus: opens a new FreeFileSync GUI session asynchronously +class SwitchToGui +{ +public: + SwitchToGui(const xmlAccess::XmlBatchConfig& batchCfg, xmlAccess::XmlGlobalSettings& globalSettings); //prepare + void execute() const; //throw() + +private: + xmlAccess::XmlGlobalSettings& globalSettings_; + const xmlAccess::XmlGuiConfig guiCfg; +}; +} + +#endif // SWITCHTOGUI_H_INCLUDED diff --git a/ui/syncConfig.cpp b/ui/syncConfig.cpp new file mode 100644 index 00000000..a2d821ff --- /dev/null +++ b/ui/syncConfig.cpp @@ -0,0 +1,477 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** +// +#include "syncConfig.h" + +#include "../library/resources.h" +#include "../shared/dragAndDrop.h" +#include <wx/wupdlock.h> + +using namespace FreeFileSync; + + +SyncCfgDialog::SyncCfgDialog(wxWindow* window, + const CompareVariant compareVar, + SyncConfiguration& syncConfiguration, + DeletionPolicy& handleDeletion, + wxString& customDeletionDirectory, + bool* ignoreErrors) : + SyncCfgDlgGenerated(window), + cmpVariant(compareVar), + currentSyncConfig(syncConfiguration), //make working copy of syncConfiguration + refSyncConfiguration(syncConfiguration), + refHandleDeletion(handleDeletion), + refCustomDeletionDirectory(customDeletionDirectory), + refIgnoreErrors(ignoreErrors), + dragDropCustomDelFolder(new DragDropOnDlg(m_panelCustomDeletionDir, m_dirPickerCustomDelFolder, m_textCtrlCustomDelFolder)) +{ + setDeletionHandling(handleDeletion); + m_textCtrlCustomDelFolder->SetValue(customDeletionDirectory); + + //error handling + if (ignoreErrors) + setErrorHandling(*ignoreErrors); + else + { + sbSizerErrorHandling->Show(false); + Layout(); + } + + //set sync config icons + updateConfigIcons(cmpVariant, currentSyncConfig); + + //set icons for this dialog + m_bitmapLeftOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftOnly"))); + m_bitmapRightOnly->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightOnly"))); + m_bitmapLeftNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("leftNewer"))); + m_bitmapRightNewer->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("rightNewer"))); + m_bitmapDifferent->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("different"))); + m_bitmapConflict->SetBitmap(GlobalResources::getInstance().getImageByName(wxT("conflictGrey"))); + + bSizer201->Layout(); //wxButtonWithImage size might have changed + + m_buttonOK->SetFocus(); + + Fit(); +} + +//################################################################################################################# + +SyncCfgDialog::~SyncCfgDialog() {} //non-inline destructor for std::auto_ptr to work with forward declaration + + +void SyncCfgDialog::updateConfigIcons(const FreeFileSync::CompareVariant cmpVar, const FreeFileSync::SyncConfiguration& syncConfig) +{ + //wxWindowUpdateLocker dummy(this); //avoid display distortion + wxWindowUpdateLocker dummy2(m_panelCustomDeletionDir); //avoid display distortion + wxWindowUpdateLocker dummy3(m_bpButtonLeftOnly); + wxWindowUpdateLocker dummy4(m_bpButtonRightOnly); + wxWindowUpdateLocker dummy5(m_bpButtonLeftNewer); + wxWindowUpdateLocker dummy6(m_bpButtonRightNewer); + wxWindowUpdateLocker dummy7(m_bpButtonDifferent); + wxWindowUpdateLocker dummy8(m_bpButtonConflict); + + + updateConfigIcons(cmpVar, + syncConfig, + m_bpButtonLeftOnly, + m_bpButtonRightOnly, + m_bpButtonLeftNewer, + m_bpButtonRightNewer, + m_bpButtonDifferent, + m_bpButtonConflict, + m_bitmapLeftOnly, + m_bitmapRightOnly, + m_bitmapLeftNewer, + m_bitmapRightNewer, + m_bitmapDifferent, + m_bitmapConflict, + sbSizerSyncDirections); + + //set radiobuttons -> have no parameter-ownership at all! + switch (FreeFileSync::getVariant(currentSyncConfig)) + { + case SyncConfiguration::AUTOMATIC: + m_radioBtnAutomatic->SetValue(true); //automatic mode + break; + case SyncConfiguration::MIRROR: + m_radioBtnMirror->SetValue(true); //one way -> + break; + case SyncConfiguration::UPDATE: + m_radioBtnUpdate->SetValue(true); //Update -> + break; + case SyncConfiguration::CUSTOM: + m_radioBtnCustom->SetValue(true); //custom + break; + } + + GetSizer()->SetSizeHints(this); //this works like a charm for GTK2 with window resizing problems!!! (includes call to Fit()) +} + + +void SyncCfgDialog::updateConfigIcons(const CompareVariant compareVar, + const SyncConfiguration& syncConfig, + wxBitmapButton* buttonLeftOnly, + wxBitmapButton* buttonRightOnly, + wxBitmapButton* buttonLeftNewer, + wxBitmapButton* buttonRightNewer, + wxBitmapButton* buttonDifferent, + wxBitmapButton* buttonConflict, + wxStaticBitmap* bitmapLeftOnly, + wxStaticBitmap* bitmapRightOnly, + wxStaticBitmap* bitmapLeftNewer, + wxStaticBitmap* bitmapRightNewer, + wxStaticBitmap* bitmapDifferent, + wxStaticBitmap* bitmapConflict, + wxSizer* syncDirections) //sizer containing all sync-directions +{ + //display only relevant sync options + syncDirections->Show(true); + + buttonLeftOnly ->Show(); // + buttonRightOnly ->Show(); // + buttonLeftNewer ->Show(); // + buttonRightNewer->Show(); // enable everything by default + buttonDifferent ->Show(); // + buttonConflict ->Show(); // + + bitmapLeftOnly ->Show(); // + bitmapRightOnly ->Show(); // + bitmapLeftNewer ->Show(); // + bitmapRightNewer->Show(); // + bitmapDifferent ->Show(); // + bitmapConflict ->Show(); // + + switch (compareVar) + { + case CMP_BY_TIME_SIZE: + buttonDifferent ->Hide(); + + bitmapDifferent ->Hide(); + break; + + case CMP_BY_CONTENT: + buttonLeftNewer ->Hide(); + buttonRightNewer->Hide(); + + bitmapLeftNewer ->Hide(); + bitmapRightNewer->Hide(); + break; + } + + if (syncConfig.automatic) //automatic mode needs no sync-directions + syncDirections->Show(false); + + switch (syncConfig.exLeftSideOnly) + { + case SYNC_DIR_RIGHT: + buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRightCr"))); + buttonLeftOnly->SetToolTip(getDescription(SO_CREATE_NEW_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteLeft"))); + buttonLeftOnly->SetToolTip(getDescription(SO_DELETE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonLeftOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); + buttonLeftOnly->SetToolTip(getDescription(SO_DO_NOTHING)); + break; + } + + switch (syncConfig.exRightSideOnly) + { + case SYNC_DIR_RIGHT: + buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("deleteRight"))); + buttonRightOnly->SetToolTip(getDescription(SO_DELETE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeftCr"))); + buttonRightOnly->SetToolTip(getDescription(SO_CREATE_NEW_LEFT)); + break; + case SYNC_DIR_NONE: + buttonRightOnly->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); + buttonRightOnly->SetToolTip(getDescription(SO_DO_NOTHING)); + break; + } + + switch (syncConfig.leftNewer) + { + case SYNC_DIR_RIGHT: + buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); + buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); + buttonLeftNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonLeftNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); + buttonLeftNewer->SetToolTip(getDescription(SO_DO_NOTHING)); + break; + } + + switch (syncConfig.rightNewer) + { + case SYNC_DIR_RIGHT: + buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); + buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); + buttonRightNewer->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonRightNewer->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); + buttonRightNewer->SetToolTip(getDescription(SO_DO_NOTHING)); + break; + } + + switch (syncConfig.different) + { + case SYNC_DIR_RIGHT: + buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); + buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); + buttonDifferent->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonDifferent->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowNone"))); + buttonDifferent->SetToolTip(getDescription(SO_DO_NOTHING)); + break; + } + + switch (syncConfig.conflict) + { + case SYNC_DIR_RIGHT: + buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowRight"))); + buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_RIGHT)); + break; + case SYNC_DIR_LEFT: + buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("arrowLeft"))); + buttonConflict->SetToolTip(getDescription(SO_OVERWRITE_LEFT)); + break; + case SYNC_DIR_NONE: + buttonConflict->SetBitmapLabel(GlobalResources::getInstance().getImageByName(wxT("conflict"))); + buttonConflict->SetToolTip(_("Leave as unresolved conflict")); + break; + } +} + + +void SyncCfgDialog::OnClose(wxCloseEvent& event) +{ + EndModal(0); +} + + +void SyncCfgDialog::OnCancel(wxCommandEvent& event) +{ + EndModal(0); +} + + +void SyncCfgDialog::OnApply(wxCommandEvent& event) +{ + //write configuration to main dialog + refSyncConfiguration = currentSyncConfig; + refHandleDeletion = getDeletionHandling(); + refCustomDeletionDirectory = m_textCtrlCustomDelFolder->GetValue(); + if (refIgnoreErrors) + *refIgnoreErrors = getErrorHandling(); + + EndModal(BUTTON_APPLY); +} + + +void SyncCfgDialog::updateToolTipErrorHandling(bool ignoreErrors) +{ + if (ignoreErrors) + m_choiceHandleError->SetToolTip(_("Hide all error and warning messages")); + else + m_choiceHandleError->SetToolTip(_("Show popup on errors or warnings")); +} + + +bool SyncCfgDialog::getErrorHandling() +{ + if (m_choiceHandleError->GetSelection() == 1) //Ignore errors + return true; + else + return false; // Show popup +} + + +void SyncCfgDialog::setErrorHandling(bool ignoreErrors) +{ + m_choiceHandleError->Clear(); + m_choiceHandleError->Append(_("Show popup")); + m_choiceHandleError->Append(_("Ignore errors")); + + if (ignoreErrors) + m_choiceHandleError->SetSelection(1); + else + m_choiceHandleError->SetSelection(0); + + updateToolTipErrorHandling(ignoreErrors); +} + + +void SyncCfgDialog::OnChangeErrorHandling(wxCommandEvent& event) +{ + updateToolTipErrorHandling(getErrorHandling()); +} + +//------------------- + +void updateToolTipDeletionHandling(wxChoice* choiceHandleError, wxPanel* customDir, const FreeFileSync::DeletionPolicy value) +{ + customDir->Disable(); + + switch (value) + { + case FreeFileSync::DELETE_PERMANENTLY: + choiceHandleError->SetToolTip(_("Delete or overwrite files permanently")); + break; + + case FreeFileSync::MOVE_TO_RECYCLE_BIN: + choiceHandleError->SetToolTip(_("Use Recycle Bin when deleting or overwriting files")); + break; + + case FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY: + choiceHandleError->SetToolTip(_("Move files into a time-stamped subdirectory")); + customDir->Enable(); + break; + } +} + + +FreeFileSync::DeletionPolicy SyncCfgDialog::getDeletionHandling() +{ + switch (m_choiceHandleDeletion->GetSelection()) + { + case 0: + return FreeFileSync::DELETE_PERMANENTLY; + case 1: + return FreeFileSync::MOVE_TO_RECYCLE_BIN; + case 2: + return FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY; + default: + assert(false); + return FreeFileSync::MOVE_TO_RECYCLE_BIN; + } +} + + +void SyncCfgDialog::setDeletionHandling(FreeFileSync::DeletionPolicy newValue) +{ + m_choiceHandleDeletion->Clear(); + m_choiceHandleDeletion->Append(_("Delete permanently")); + m_choiceHandleDeletion->Append(_("Use Recycle Bin")); + m_choiceHandleDeletion->Append(_("User-defined directory")); + + switch (newValue) + { + case FreeFileSync::DELETE_PERMANENTLY: + m_choiceHandleDeletion->SetSelection(0); + break; + case FreeFileSync::MOVE_TO_RECYCLE_BIN: + m_choiceHandleDeletion->SetSelection(1); + break; + case FreeFileSync::MOVE_TO_CUSTOM_DIRECTORY: + m_choiceHandleDeletion->SetSelection(2); + break; + } + + updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, newValue); +} + + +void SyncCfgDialog::OnChangeDeletionHandling(wxCommandEvent& event) +{ + updateToolTipDeletionHandling(m_choiceHandleDeletion, m_panelCustomDeletionDir, getDeletionHandling()); +} + + +void SyncCfgDialog::OnSyncAutomatic(wxCommandEvent& event) +{ + FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::AUTOMATIC); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnSyncLeftToRight(wxCommandEvent& event) +{ + FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::MIRROR); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnSyncUpdate(wxCommandEvent& event) +{ + FreeFileSync::setVariant(currentSyncConfig, SyncConfiguration::UPDATE); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void toggleSyncDirection(SyncDirection& current) +{ + switch (current) + { + case SYNC_DIR_RIGHT: + current = SYNC_DIR_LEFT; + break; + case SYNC_DIR_LEFT: + current = SYNC_DIR_NONE; + break; + case SYNC_DIR_NONE: + current = SYNC_DIR_RIGHT; + break; + } +} + + +void SyncCfgDialog::OnExLeftSideOnly(wxCommandEvent& event ) +{ + toggleSyncDirection(currentSyncConfig.exLeftSideOnly); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnExRightSideOnly(wxCommandEvent& event ) +{ + toggleSyncDirection(currentSyncConfig.exRightSideOnly); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnLeftNewer(wxCommandEvent& event ) +{ + toggleSyncDirection(currentSyncConfig.leftNewer); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnRightNewer(wxCommandEvent& event ) +{ + toggleSyncDirection(currentSyncConfig.rightNewer); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnDifferent(wxCommandEvent& event ) +{ + toggleSyncDirection(currentSyncConfig.different); + updateConfigIcons(cmpVariant, currentSyncConfig); +} + + +void SyncCfgDialog::OnConflict(wxCommandEvent& event) +{ + toggleSyncDirection(currentSyncConfig.conflict); + updateConfigIcons(cmpVariant, currentSyncConfig); +} diff --git a/ui/settingsDialog.h b/ui/syncConfig.h index 5a36b1c4..dc76325c 100644 --- a/ui/settingsDialog.h +++ b/ui/syncConfig.h @@ -4,17 +4,13 @@ // * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** // -#ifndef SYNCDIALOG_H_INCLUDED -#define SYNCDIALOG_H_INCLUDED +#ifndef SYNCCONFIG_H_INCLUDED +#define SYNCCONFIG_H_INCLUDED -#include "guiGenerated.h" -#include "../library/processXml.h" #include <memory> +#include "guiGenerated.h" +#include "../structures.h" -class BatchFileDropEvent; -class BatchFolderPairPanel; -class FirstBatchFolderPairCfg; -class wxHelpController; namespace FreeFileSync { @@ -100,90 +96,4 @@ private: std::auto_ptr<FreeFileSync::DragDropOnDlg> dragDropCustomDelFolder; }; - -class BatchDialog: public BatchDlgGenerated -{ - friend class BatchFileDropEvent; - template <class GuiPanel> - friend class FolderPairCallback; - -public: - BatchDialog(wxWindow* window, const xmlAccess::XmlBatchConfig& batchCfg); - BatchDialog(wxWindow* window, const wxString& filename); - ~BatchDialog(); - - enum - { - BATCH_FILE_SAVED = 15 - }; - -private: - void init(); - - virtual void OnExLeftSideOnly( wxCommandEvent& event); - virtual void OnExRightSideOnly( wxCommandEvent& event); - virtual void OnLeftNewer( wxCommandEvent& event); - virtual void OnRightNewer( wxCommandEvent& event); - virtual void OnDifferent( wxCommandEvent& event); - virtual void OnConflict( wxCommandEvent& event); - virtual void OnHelp( wxCommandEvent& event); - - virtual void OnCheckAutomatic( wxCommandEvent& event); - virtual void OnCheckFilter( wxCommandEvent& event); - virtual void OnCheckSilent( wxCommandEvent& event); - virtual void OnChangeCompareVar( wxCommandEvent& event); - virtual void OnClose( wxCloseEvent& event); - virtual void OnCancel( wxCommandEvent& event); - virtual void OnSaveBatchJob( wxCommandEvent& event); - virtual void OnLoadBatchJob( wxCommandEvent& event); - virtual void OnAddFolderPair( wxCommandEvent& event); - virtual void OnRemoveFolderPair( wxCommandEvent& event); - virtual void OnRemoveTopFolderPair(wxCommandEvent& event); - - void addFolderPair(const std::vector<FreeFileSync::FolderPairEnh>& newPairs, bool addFront = false); - void removeAddFolderPair(const int pos); - void clearAddFolderPairs(); - - void updateGuiForFolderPair(); - - FreeFileSync::CompareVariant getCurrentCompareVar() const; - - void updateConfigIcons(const FreeFileSync::CompareVariant cmpVar, const FreeFileSync::SyncConfiguration& syncConfig); - - void updateVisibleTabs(); - void showNotebookpage(wxWindow* page, const wxString& pageName, bool show); - - //error handling - xmlAccess::OnError getSelectionHandleError() const; - void setSelectionHandleError(const xmlAccess::OnError value); - void OnChangeErrorHandling(wxCommandEvent& event); - - //set tooltip - void updateToolTipErrorHandling(const xmlAccess::OnError value); - - //deletion handling - FreeFileSync::DeletionPolicy getDeletionHandling() const; - void setDeletionHandling(FreeFileSync::DeletionPolicy newValue); - void OnChangeDeletionHandling(wxCommandEvent& event); - - - bool saveBatchFile(const wxString& filename); - void loadBatchFile(const wxString& filename); - void loadBatchCfg(const xmlAccess::XmlBatchConfig& batchCfg); - - xmlAccess::XmlBatchConfig getCurrentConfiguration() const; - - FreeFileSync::SyncConfiguration localSyncConfiguration; - - boost::shared_ptr<FirstBatchFolderPairCfg> firstFolderPair; //always bound!!! - std::vector<BatchFolderPairPanel*> additionalFolderPairs; - - //used when saving batch file - wxString proposedBatchFileName; - - //add drag & drop support when selecting logfile directory - std::auto_ptr<FreeFileSync::DragDropOnDlg> dragDropOnLogfileDir; - std::auto_ptr<FreeFileSync::DragDropOnDlg> dragDropCustomDelFolder; -}; - -#endif // SYNCDIALOG_H_INCLUDED +#endif // SYNCCONFIG_H_INCLUDED |