diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/batch_config.cpp | 5 | ||||
-rw-r--r-- | ui/batch_status_handler.cpp | 192 | ||||
-rw-r--r-- | ui/batch_status_handler.h | 7 | ||||
-rw-r--r-- | ui/check_version.cpp | 56 | ||||
-rw-r--r-- | ui/custom_grid.cpp | 12 | ||||
-rw-r--r-- | ui/dir_name.cpp | 2 | ||||
-rw-r--r-- | ui/folder_history_box.cpp | 1 | ||||
-rw-r--r-- | ui/folder_history_box.h | 1 | ||||
-rw-r--r-- | ui/folder_pair.h | 1 | ||||
-rw-r--r-- | ui/grid_view.h | 8 | ||||
-rw-r--r-- | ui/gui_generated.cpp | 484 | ||||
-rw-r--r-- | ui/gui_generated.h | 114 | ||||
-rw-r--r-- | ui/gui_status_handler.cpp | 66 | ||||
-rw-r--r-- | ui/gui_status_handler.h | 5 | ||||
-rw-r--r-- | ui/main_dlg.cpp | 385 | ||||
-rw-r--r-- | ui/main_dlg.h | 13 | ||||
-rw-r--r-- | ui/msg_popup.cpp | 225 | ||||
-rw-r--r-- | ui/msg_popup.h | 23 | ||||
-rw-r--r-- | ui/small_dlgs.cpp | 37 | ||||
-rw-r--r-- | ui/sync_cfg.cpp | 5 |
20 files changed, 731 insertions, 911 deletions
diff --git a/ui/batch_config.cpp b/ui/batch_config.cpp index 10cee822..75033bf8 100644 --- a/ui/batch_config.cpp +++ b/ui/batch_config.cpp @@ -14,7 +14,6 @@ #include <zen/file_handling.h> #include "msg_popup.h" #include "gui_generated.h" -//#include <wx/dnd.h> #include <wx/msgdlg.h> #include <wx+/button.h> #include <wx+/choice_enum.h> @@ -504,7 +503,7 @@ void BatchDialog::OnSaveBatchJob(wxCommandEvent& event) wxEmptyString, wxEmptyString, defaultFileName, - _("FreeFileSync batch file") + L" (*.ffs_batch)|*.ffs_batch" + L"|" +_("All files") + L" (*.*)|*", + _("FreeFileSync batch") + L" (*.ffs_batch)|*.ffs_batch" + L"|" +_("All files") + L" (*.*)|*", wxFD_SAVE | wxFD_OVERWRITE_PROMPT); //creating this on freestore leads to memleak! if (filePicker.ShowModal() == wxID_OK) { @@ -523,7 +522,7 @@ void BatchDialog::OnLoadBatchJob(wxCommandEvent& event) wxEmptyString, beforeLast(proposedBatchFileName, utfCvrtTo<wxString>(FILE_NAME_SEPARATOR)), //set default dir: empty string if "currentConfigFileName" is empty or has no path separator wxEmptyString, - _("FreeFileSync batch file") + L" (*.ffs_batch;*.ffs_gui)|*.ffs_batch;*.ffs_gui" + L"|" +_("All files") + L" (*.*)|*", + _("FreeFileSync batch") + L" (*.ffs_batch;*.ffs_gui)|*.ffs_batch;*.ffs_gui" + L"|" +_("All files") + L" (*.*)|*", wxFD_OPEN | wxFD_MULTIPLE); //creating this on freestore leads to memleak! if (filePicker.ShowModal() == wxID_OK) { diff --git a/ui/batch_status_handler.cpp b/ui/batch_status_handler.cpp index 89d28084..c0958025 100644 --- a/ui/batch_status_handler.cpp +++ b/ui/batch_status_handler.cpp @@ -5,10 +5,8 @@ // ************************************************************************** #include "batch_status_handler.h" -#include <wx/ffile.h> #include <zen/file_handling.h> #include <zen/file_traverser.h> -#include <wx+/string_conv.h> #include <wx+/app_main.h> #include <wx+/format_unit.h> #include <wx+/shell_execute.h> @@ -17,6 +15,7 @@ #include "../lib/ffs_paths.h" #include "../lib/resolve_path.h" #include "../lib/status_handler_impl.h" +#include "../lib/generate_logfile.h" using namespace zen; @@ -44,130 +43,62 @@ private: const Zstring prefix_; std::vector<Zstring>& logfiles_; }; -} -class LogFile //throw FileError +void limitLogfileCount(const Zstring& logdir, const std::wstring& jobname, size_t maxCount) //throw() { -public: - LogFile(const Zstring& logfileDirectory, - const std::wstring& jobName, - const std::wstring& timestamp) : - jobName_(jobName), //throw FileError - logfileName(findUnusedLogname(logfileDirectory, jobName, timestamp)) - { - logFile.Open(toWx(logfileName), L"w"); - if (!logFile.IsOpened()) - throw FileError(replaceCpy(_("Cannot write file %x."), L"%x", fmtFileName(logfileName))); + std::vector<Zstring> logFiles; + FindLogfiles traverseCallback(toZ(jobname), logFiles); - //write header - const wxString& headerLine = wxString(L"FreeFileSync - ") + _("Batch execution") + L" - " + formatTime<wxString>(FORMAT_DATE); - logFile.Write(headerLine + L'\n'); - logFile.Write(wxString().Pad(headerLine.Len(), L'=') + L'\n'); + traverseFolder(logdir, //throw(); + traverseCallback); - //logItemStart = formatTime<wxString>(L"[%X] ") + _("Start"); + if (logFiles.size() <= maxCount) + return; - totalTime.Start(); //measure total time - } + //delete oldest logfiles + std::nth_element(logFiles.begin(), logFiles.end() - maxCount, logFiles.end()); //take advantage of logfile naming convention to find oldest files - void writeLog(const ErrorLog& log, const std::wstring& finalStatus, - int itemsSynced, Int64 dataSynced, - int itemsTotal, Int64 dataTotal) - { - //assemble results box - std::vector<wxString> results; - results.push_back(finalStatus); - results.push_back(L""); - if (itemsTotal != 0 || dataTotal != 0) //=: sync phase was reached and there were actual items to sync - { - results.push_back(L" " + _("Items processed:") + L" " + toGuiString(itemsSynced) + L" (" + filesizeToShortString(dataSynced) + L")"); + std::for_each(logFiles.begin(), logFiles.end() - maxCount, + [](const Zstring& filename) { try { removeFile(filename); } catch (FileError&) {} }); +} - if (itemsSynced != itemsTotal || - dataSynced != dataTotal) - results.push_back(L" " + _("Items remaining:") + L" " + toGuiString(itemsTotal - itemsSynced) + L" (" + filesizeToShortString(dataTotal - dataSynced) + L")"); - } - results.push_back(L" " + _("Total time:") + L" " + wxTimeSpan::Milliseconds(totalTime.Time()).Format()); - //write results box - size_t sepLineLen = 0; - std::for_each(results.begin(), results.end(), [&](const wxString& str) { sepLineLen = std::max(sepLineLen, str.size()); }); +std::unique_ptr<FileOutput> prepareNewLogfile(const Zstring& logfileDirectory, //throw FileError + const std::wstring& jobName, + const std::wstring& timestamp) //return value always bound! +{ + //create logfile directory if required + Zstring logfileDir = logfileDirectory.empty() ? + getConfigDir() + Zstr("Logs") : + getFormattedDirectoryName(logfileDirectory); - logFile.Write(wxString().Pad(sepLineLen, L'_') + L"\n\n"); - std::for_each(results.begin(), results.end(), [&](const wxString& str) { logFile.Write(str + L'\n'); }); - logFile.Write(wxString().Pad(sepLineLen, L'_') + L"\n\n"); + makeDirectory(logfileDir); //throw FileError - //logFile.Write(logItemStart + L"\n\n"); + //assemble logfile name + const Zstring body = appendSeparator(logfileDir) + toZ(jobName) + Zstr(" ") + utfCvrtTo<Zstring>(timestamp); - //write log items - const auto& entries = log.getEntries(); - for (auto iter = entries.begin(); iter != entries.end(); ++iter) + //ensure uniqueness + for (int i = 0;; ++i) + try { - const std::string& msg = utfCvrtTo<std::string>(formatMessage(*iter)); - logFile.Write(msg.c_str(), msg.size()); //better do UTF8 conversion ourselves rather than to rely on wxWidgets - logFile.Write(L'\n'); - } + const Zstring& filename = i == 0 ? + body + Zstr(".log") : + body + Zstr('_') + numberTo<Zstring>(i) + Zstr(".log"); - ////write footer - //logFile.Write(L'\n'); - //logFile.Write(formatTime<wxString>(L"[%X] ") + _("Stop") + L" (" + _("Total time:") + L" " + wxTimeSpan::Milliseconds(totalTime.Time()).Format() + L")\n"); - } - - void limitLogfileCount(size_t maxCount) const //throw() - { - std::vector<Zstring> logFiles; - FindLogfiles traverseCallback(toZ(jobName_), logFiles); - - traverseFolder(beforeLast(logfileName, FILE_NAME_SEPARATOR), //throw(); - traverseCallback); - - if (logFiles.size() <= maxCount) - return; - - //delete oldest logfiles - std::nth_element(logFiles.begin(), logFiles.end() - maxCount, logFiles.end()); //take advantage of logfile naming convention to find oldest files - - std::for_each(logFiles.begin(), logFiles.end() - maxCount, - [](const Zstring& filename) { try { removeFile(filename); } catch (FileError&) {} }); - } - - //Zstring getLogfileName() const { return logfileName; } - -private: - static Zstring findUnusedLogname(const Zstring& logfileDirectory, - const std::wstring& jobName, - const std::wstring& timestamp) - { - //create logfile directory - Zstring logfileDir = logfileDirectory.empty() ? - getConfigDir() + Zstr("Logs") : - getFormattedDirectoryName(logfileDirectory); - - if (!dirExists(logfileDir)) - createDirectory(logfileDir); //throw FileError; create recursively if necessary - - //assemble logfile name - const Zstring logfileName = appendSeparator(logfileDir) + toZ(jobName) + Zstr(" ") + utfCvrtTo<Zstring>(timestamp); - - //ensure uniqueness - Zstring output = logfileName + Zstr(".log"); - - for (int i = 1; somethingExists(output); ++i) - output = logfileName + Zstr('_') + numberTo<Zstring>(i) + Zstr(".log"); - return output; - } - - const wxString jobName_; - const Zstring logfileName; - wxFFile logFile; - wxStopWatch totalTime; -}; + return make_unique<FileOutput>(filename, FileOutput::ACC_CREATE_NEW); //throw FileError, ErrorTargetExisting + //*no* file system race-condition! + } + catch (const ErrorTargetExisting&) {} +} +} //############################################################################################################################## BatchStatusHandler::BatchStatusHandler(bool showProgress, const std::wstring& jobName, const std::wstring& timestamp, - const wxString& logfileDirectory, + const wxString& logfileDirectory, //may be empty size_t logFileCountMax, const xmlAccess::OnError handleError, const SwitchToGui& switchBatchToGui, //functionality to change from batch mode to GUI mode @@ -179,19 +110,23 @@ BatchStatusHandler::BatchStatusHandler(bool showProgress, switchToGuiRequested(false), handleError_(handleError), returnCode_(returnCode), - syncStatusFrame(*this, *this, nullptr, showProgress, jobName, execWhenFinished, execFinishedHistory) + syncStatusFrame(*this, *this, nullptr, showProgress, jobName, execWhenFinished, execFinishedHistory), + jobName_(jobName) { if (logFileCountMax > 0) //init log file: starts internal timer! if (!tryReportingError([&] { - logFile.reset(new LogFile(toZ(logfileDirectory), jobName, timestamp)); //throw FileError - logFile->limitLogfileCount(logFileCountMax); //throw() + logFile = prepareNewLogfile(toZ(logfileDirectory), jobName, timestamp); //throw FileError; return value always bound! + + limitLogfileCount(beforeLast(logFile->getFilename(), FILE_NAME_SEPARATOR), jobName_, logFileCountMax); //throw() }, *this)) { returnCode_ = FFS_RC_ABORTED; throw BatchAbortProcess(); } + totalTime.Start(); //measure total time + //::wxSetEnv(L"logfile", logFile->getLogfileName()); } @@ -224,14 +159,26 @@ BatchStatusHandler::~BatchStatusHandler() errorLog.logMsg(finalStatus, TYPE_INFO); } + const Utf8String logStream = generateLogStream(errorLog, jobName_, finalStatus, + getObjectsCurrent(PHASE_SYNCHRONIZING), getDataCurrent(PHASE_SYNCHRONIZING), + getObjectsTotal (PHASE_SYNCHRONIZING), getDataTotal (PHASE_SYNCHRONIZING), totalTime.Time() / 1000); //print the results list: logfile if (logFile.get()) { - logFile->writeLog(errorLog, finalStatus, - getObjectsCurrent(PHASE_SYNCHRONIZING), getDataCurrent(PHASE_SYNCHRONIZING), - getObjectsTotal (PHASE_SYNCHRONIZING), getDataTotal (PHASE_SYNCHRONIZING)); + try + { + if (!logStream.empty()) + logFile->write(&*logStream.begin(), logStream.size()); //throw FileError + } + catch (FileError&) {} + logFile.reset(); //close file now: user may do something with it in "on completion" } + try + { + saveToLastSyncsLog(logStream); //throw FileError + } + catch (FileError&) {} //decide whether to stay on status screen or exit immediately... if (switchToGuiRequested) //-> avoid recursive yield() calls, thous switch not before ending batch mode @@ -326,11 +273,11 @@ void BatchStatusHandler::reportWarning(const std::wstring& warningMessage, bool& bool dontWarnAgain = false; switch (showWarningDlg(syncStatusFrame.getAsWindow(), - ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_SWITCH | ReturnWarningDlg::BUTTON_ABORT, + ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_SWITCH | ReturnWarningDlg::BUTTON_CANCEL, warningMessage + L"\n\n" + _("Press \"Switch\" to resolve issues in FreeFileSync main dialog."), dontWarnAgain)) { - case ReturnWarningDlg::BUTTON_ABORT: + case ReturnWarningDlg::BUTTON_CANCEL: abortThisProcess(); break; @@ -368,7 +315,7 @@ ProcessCallback::Response BatchStatusHandler::reportError(const std::wstring& er bool ignoreNextErrors = false; switch (showErrorDlg(syncStatusFrame.getAsWindow(), - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT, + ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_CANCEL, errorMessage, &ignoreNextErrors)) { case ReturnErrorDlg::BUTTON_IGNORE: @@ -380,7 +327,7 @@ ProcessCallback::Response BatchStatusHandler::reportError(const std::wstring& er case ReturnErrorDlg::BUTTON_RETRY: return ProcessCallback::RETRY; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnErrorDlg::BUTTON_CANCEL: errorLog.logMsg(errorMessage, TYPE_ERROR); abortThisProcess(); } @@ -414,21 +361,18 @@ void BatchStatusHandler::reportFatalError(const std::wstring& errorMessage) forceUiRefresh(); bool ignoreNextErrors = false; - switch (showErrorDlg(syncStatusFrame.getAsWindow(), - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_ABORT, - errorMessage, &ignoreNextErrors)) + switch (showFatalErrorDlg(syncStatusFrame.getAsWindow(), + ReturnFatalErrorDlg::BUTTON_IGNORE | ReturnFatalErrorDlg::BUTTON_CANCEL, + errorMessage, &ignoreNextErrors)) { - case ReturnErrorDlg::BUTTON_IGNORE: + case ReturnFatalErrorDlg::BUTTON_IGNORE: if (ignoreNextErrors) //falsify only handleError_ = xmlAccess::ON_ERROR_IGNORE; break; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnFatalErrorDlg::BUTTON_CANCEL: abortThisProcess(); break; - - case ReturnErrorDlg::BUTTON_RETRY: - assert(false); } } break; diff --git a/ui/batch_status_handler.h b/ui/batch_status_handler.h index 56e9e781..c6def13c 100644 --- a/ui/batch_status_handler.h +++ b/ui/batch_status_handler.h @@ -8,13 +8,13 @@ #define BATCHSTATUSHANDLER_H_INCLUDED #include <zen/error_log.h> +#include <zen/file_io.h> #include "../lib/status_handler.h" #include "../lib/process_xml.h" #include "progress_indicator.h" #include "switch_to_gui.h" #include "lib/return_codes.h" -class LogFile; //Exception class used to abort the "compare" and "sync" process class BatchAbortProcess {}; @@ -55,7 +55,10 @@ private: zen::FfsReturnCode& returnCode_; SyncStatus syncStatusFrame; //the window managed by SyncStatus has longer lifetime than this handler! - std::unique_ptr<LogFile> logFile; //optional! + std::unique_ptr<zen::FileOutput> logFile; //optional! + + const std::wstring jobName_; + wxStopWatch totalTime; }; diff --git a/ui/check_version.cpp b/ui/check_version.cpp index 5856f95a..56896836 100644 --- a/ui/check_version.cpp +++ b/ui/check_version.cpp @@ -15,56 +15,46 @@ #include <zen/string_tools.h> #include "msg_popup.h" #include "../lib/ffs_paths.h" -#include <zen/scope_guard.h> -#include <wx/tokenzr.h> #include <zen/i18n.h> +using namespace zen; -bool getOnlineVersion(wxString& version) + +wxString getOnlineVersion() //empty string on error; { wxWindowDisabler dummy; wxHTTP webAccess; - webAccess.SetHeader(wxT("Content-type"), wxT("text/html; charset=utf-8")); - webAccess.SetTimeout(5); //5 seconds of timeout instead of 10 minutes... + webAccess.SetHeader(L"Content-type", L"text/html; charset=utf-8"); + webAccess.SetTimeout(5); //5 seconds of timeout instead of 10 minutes(WTF are they thinking???)... - if (webAccess.Connect(wxT("freefilesync.cvs.sourceforge.net"))) //only the server, no pages here yet... + if (webAccess.Connect(L"freefilesync.cvs.sourceforge.net")) //only the server, no pages here yet... { //wxApp::IsMainLoopRunning(); // should return true - std::unique_ptr<wxInputStream> httpStream(webAccess.GetInputStream(wxT("/viewvc/freefilesync/version/version.txt"))); + std::unique_ptr<wxInputStream> httpStream(webAccess.GetInputStream(L"/viewvc/freefilesync/version/version.txt")); //must be deleted BEFORE webAccess is closed if (httpStream && webAccess.GetError() == wxPROTO_NOERR) { - wxString newestVersion; - wxStringOutputStream out_stream(&newestVersion); + wxString onlineVersion; + wxStringOutputStream out_stream(&onlineVersion); httpStream->Read(out_stream); - if (!newestVersion.empty()) - { - version = newestVersion; - return true; - } + return onlineVersion; } } - - return false; + return wxString(); } const wchar_t VERSION_SEP = L'.'; - std::vector<size_t> parseVersion(const wxString& version) { - std::vector<size_t> output; + std::vector<wxString> digits = split(version, VERSION_SEP); - wxStringTokenizer tkz(version, VERSION_SEP, wxTOKEN_RET_EMPTY); - while (tkz.HasMoreTokens()) - { - const wxString& token = tkz.GetNextToken(); - output.push_back(zen::stringTo<size_t>(token)); - } + std::vector<size_t> output; + std::transform(digits.begin(), digits.end(), std::back_inserter(output), [&](const wxString& d) { return stringTo<size_t>(d); }); return output; } @@ -74,18 +64,18 @@ bool isNewerVersion(const wxString& onlineVersion) std::vector<size_t> current = parseVersion(zen::currentVersion); std::vector<size_t> online = parseVersion(onlineVersion); - if (online.empty() || online[0] == 0) //onlineVersion may be "This website has been moved..." In this case better check for an update + if (online.empty() || online[0] == 0) //online version may be "This website has been moved..." In this case better check for an update return true; return std::lexicographical_compare(current.begin(), current.end(), - online.begin(), online.end()); + online .begin(), online .end()); } void zen::checkForUpdateNow(wxWindow* parent) { - wxString onlineVersion; - if (!getOnlineVersion(onlineVersion)) + const wxString onlineVersion = getOnlineVersion(); + if (onlineVersion.empty()) { wxMessageBox(_("Unable to connect to sourceforge.net!"), _("Error"), wxOK | wxICON_ERROR, parent); return; @@ -94,7 +84,7 @@ void zen::checkForUpdateNow(wxWindow* parent) if (isNewerVersion(onlineVersion)) { if (showQuestionDlg(parent, ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL, - _("A newer version of FreeFileSync is available:") + L" " + onlineVersion + L"\n\n" + _("Download now?")) == ReturnQuestionDlg::BUTTON_YES) + _("A new version of FreeFileSync is available:") + L" " + onlineVersion + L"\n\n" + _("Download now?")) == ReturnQuestionDlg::BUTTON_YES) wxLaunchDefaultBrowser(L"http://sourceforge.net/projects/freefilesync/files/freefilesync/v" + onlineVersion + L"/"); } else @@ -105,7 +95,7 @@ void zen::checkForUpdateNow(wxWindow* parent) void zen::checkForUpdatePeriodically(wxWindow* parent, long& lastUpdateCheck) { #ifdef FFS_LINUX - if (!zen::isPortableVersion()) //don't check for updates in installer version -> else: handled by .deb + if (!zen::isPortableVersion()) //don't check for updates in locally installed version -> handled by system updater return; #endif @@ -132,8 +122,8 @@ void zen::checkForUpdatePeriodically(wxWindow* parent, long& lastUpdateCheck) } else if (wxGetLocalTime() >= lastUpdateCheck + 7 * 24 * 3600) //check weekly { - wxString onlineVersion; - if (!getOnlineVersion(onlineVersion)) + const wxString onlineVersion = getOnlineVersion(); + if (onlineVersion.empty()) return; //do not handle error lastUpdateCheck = wxGetLocalTime(); @@ -141,7 +131,7 @@ void zen::checkForUpdatePeriodically(wxWindow* parent, long& lastUpdateCheck) if (isNewerVersion(onlineVersion)) { if (showQuestionDlg(parent, ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_CANCEL, - _("A newer version of FreeFileSync is available:") + L" " + onlineVersion + L"\n\n" + _("Download now?")) == ReturnQuestionDlg::BUTTON_YES) + _("A new version of FreeFileSync is available:") + L" " + onlineVersion + L"\n\n" + _("Download now?")) == ReturnQuestionDlg::BUTTON_YES) wxLaunchDefaultBrowser(L"http://sourceforge.net/projects/freefilesync/files/freefilesync/v" + onlineVersion + L"/"); } } diff --git a/ui/custom_grid.cpp b/ui/custom_grid.cpp index d6180dd0..f340a819 100644 --- a/ui/custom_grid.cpp +++ b/ui/custom_grid.cpp @@ -347,6 +347,9 @@ private: case COL_TYPE_SIZE: //file size if (!fsObj_.isEmpty<side>()) value = zen::toGuiString(fileObj.getFileSize<side>()); + + //if (!fsObj_.isEmpty<side>()) -> test file id + // value = toGuiString(fileObj.getFileId<side>().second); break; case COL_TYPE_DATE: //date if (!fsObj_.isEmpty<side>()) @@ -647,14 +650,14 @@ private: virtual void visit(const FileMapping& fileObj) { tipMsg_ += L"\n" + - _("Size") + L": " + zen::filesizeToShortString(to<Int64>(fileObj.getFileSize<side>())) + L"\n" + - _("Date") + L": " + zen::utcToLocalTimeString(fileObj.getLastWriteTime<side>()); + _("Size:") + L" " + zen::filesizeToShortString(to<Int64>(fileObj.getFileSize<side>())) + L"\n" + + _("Date:") + L" " + zen::utcToLocalTimeString(fileObj.getLastWriteTime<side>()); } virtual void visit(const SymLinkMapping& linkObj) { tipMsg_ += L"\n" + - _("Date") + L": " + zen::utcToLocalTimeString(linkObj.getLastWriteTime<side>()); + _("Date:") + L" " + zen::utcToLocalTimeString(linkObj.getLastWriteTime<side>()); } virtual void visit(const DirMapping& dirObj) {} @@ -769,7 +772,8 @@ public: void onSelectBegin(const wxPoint& clientPos, size_t row, ColumnType colType) { - if (static_cast<ColumnTypeMiddle>(colType) == COL_TYPE_MIDDLE_VALUE) + if (static_cast<ColumnTypeMiddle>(colType) == COL_TYPE_MIDDLE_VALUE && + row < refGrid().getRowCount()) { refGrid().clearSelection(gridview::COMP_MIDDLE); dragSelection.reset(new std::pair<size_t, BlockPosition>(row, mousePosToBlock(clientPos, row))); diff --git a/ui/dir_name.cpp b/ui/dir_name.cpp index fcab49ca..3d8db37d 100644 --- a/ui/dir_name.cpp +++ b/ui/dir_name.cpp @@ -22,7 +22,7 @@ namespace { void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, wxWindow& tooltipWnd, wxStaticText* staticText, size_t timeout) { - const wxString dirFormatted = toWx(getFormattedDirectoryName(toZ(dirname))); + const wxString dirFormatted = utfCvrtTo<wxString>(getFormattedDirectoryName(toZ(dirname))); tooltipWnd.SetToolTip(nullptr); //workaround wxComboBox bug http://trac.wxwidgets.org/ticket/10512 / http://trac.wxwidgets.org/ticket/12659 tooltipWnd.SetToolTip(dirFormatted); //only lord knows when the real bugfix reaches mere mortals via an official release diff --git a/ui/folder_history_box.cpp b/ui/folder_history_box.cpp index d30ada64..2b773c20 100644 --- a/ui/folder_history_box.cpp +++ b/ui/folder_history_box.cpp @@ -8,6 +8,7 @@ #include <list> #include <wx/scrolwin.h> #include "../lib/resolve_path.h" +#include <wx+/string_conv.h> using namespace zen; diff --git a/ui/folder_history_box.h b/ui/folder_history_box.h index 24ff1725..68197786 100644 --- a/ui/folder_history_box.h +++ b/ui/folder_history_box.h @@ -10,7 +10,6 @@ #include <wx/combobox.h> #include <memory> #include <zen/zstring.h> -#include <wx+/string_conv.h> #include <zen/stl_tools.h> //combobox with history function + functionality to delete items (DEL) diff --git a/ui/folder_pair.h b/ui/folder_pair.h index 3dadc07c..c9f42259 100644 --- a/ui/folder_pair.h +++ b/ui/folder_pair.h @@ -15,7 +15,6 @@ #include <wx/event.h> #include <wx+/context_menu.h> #include <wx/menu.h> -#include <wx+/string_conv.h> #include "../lib/norm_filter.h" #include <wx+/button.h> #include <wx+/image_tools.h> diff --git a/ui/grid_view.h b/ui/grid_view.h index c830224b..5fc80338 100644 --- a/ui/grid_view.h +++ b/ui/grid_view.h @@ -181,16 +181,12 @@ private: - - - -//############################################################################ -//inline implementation +//##################### implementation ######################################### inline const FileSystemObject* GridView::getObject(size_t row) const { - return row < rowsOnView() ? + return row < viewRef.size() ? FileSystemObject::retrieve(viewRef[row]) : nullptr; } diff --git a/ui/gui_generated.cpp b/ui/gui_generated.cpp index c59028c2..c0f83cec 100644 --- a/ui/gui_generated.cpp +++ b/ui/gui_generated.cpp @@ -44,9 +44,12 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_menuItemLoad = new wxMenuItem( m_menuFile, wxID_OPEN, wxString( _("&Open...") ) + wxT('\t') + wxT("Ctrl+O"), wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemLoad ); - m_menuItemSave = new wxMenuItem( m_menuFile, wxID_SAVE, wxString( _("&Save...") ) + wxT('\t') + wxT("Ctrl+S"), wxEmptyString, wxITEM_NORMAL ); + m_menuItemSave = new wxMenuItem( m_menuFile, wxID_SAVE, wxString( _("&Save") ) + wxT('\t') + wxT("Ctrl+S"), wxEmptyString, wxITEM_NORMAL ); m_menuFile->Append( m_menuItemSave ); + m_menuItemSaveAs = new wxMenuItem( m_menuFile, wxID_SAVEAS, wxString( _("Save &As...") ) , wxEmptyString, wxITEM_NORMAL ); + m_menuFile->Append( m_menuItemSaveAs ); + m_menuFile->AppendSeparator(); wxMenuItem* m_menuItem4; @@ -559,19 +562,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer1712; bSizer1712 = new wxBoxSizer( wxVERTICAL ); - - bSizer1712->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapCreateLeft = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapCreateLeft->SetToolTip( _("Number of files and folders that will be created") ); bSizer1712->Add( m_bitmapCreateLeft, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer1712->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer1712->Add( 5, 2, 0, 0, 5 ); - bSizer1712->Add( 2, 2, 0, 0, 5 ); + bSizer1712->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextCreateLeft = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCreateLeft->Wrap( -1 ); @@ -588,19 +588,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer172; bSizer172 = new wxBoxSizer( wxVERTICAL ); - - bSizer172->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapUpdateLeft = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapUpdateLeft->SetToolTip( _("Number of files that will be overwritten") ); bSizer172->Add( m_bitmapUpdateLeft, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer172->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer172->Add( 5, 2, 0, 0, 5 ); - bSizer172->Add( 2, 2, 0, 0, 5 ); + bSizer172->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextUpdateLeft = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUpdateLeft->Wrap( -1 ); @@ -617,19 +614,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer173; bSizer173 = new wxBoxSizer( wxVERTICAL ); - - bSizer173->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapDeleteLeft = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapDeleteLeft->SetToolTip( _("Number of files and folders that will be deleted") ); bSizer173->Add( m_bitmapDeleteLeft, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer173->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer173->Add( 5, 2, 0, 0, 5 ); - bSizer173->Add( 2, 2, 0, 0, 5 ); + bSizer173->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextDeleteLeft = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDeleteLeft->Wrap( -1 ); @@ -645,23 +639,20 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const bSizerData = new wxBoxSizer( wxVERTICAL ); - - bSizerData->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapData = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); + m_bitmapData->SetToolTip( _("Total bytes to copy") ); bSizerData->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizerData->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizerData->Add( 5, 2, 0, 0, 5 ); - bSizerData->Add( 2, 2, 0, 0, 5 ); + bSizerData->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextData = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextData->Wrap( -1 ); - m_staticTextData->SetToolTip( _("Total amount of data that will be transferred") ); + m_staticTextData->SetToolTip( _("Total bytes to copy") ); bSizerData->Add( m_staticTextData, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); @@ -674,19 +665,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer176; bSizer176 = new wxBoxSizer( wxVERTICAL ); - - bSizer176->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapDeleteRight = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapDeleteRight->SetToolTip( _("Number of files and folders that will be deleted") ); bSizer176->Add( m_bitmapDeleteRight, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - bSizer176->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer176->Add( 5, 2, 0, 0, 5 ); - bSizer176->Add( 2, 2, 0, 0, 5 ); + bSizer176->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextDeleteRight = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDeleteRight->Wrap( -1 ); @@ -703,19 +691,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer177; bSizer177 = new wxBoxSizer( wxVERTICAL ); - - bSizer177->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapUpdateRight = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapUpdateRight->SetToolTip( _("Number of files that will be overwritten") ); bSizer177->Add( m_bitmapUpdateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer177->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer177->Add( 5, 2, 0, 0, 5 ); - bSizer177->Add( 2, 2, 0, 0, 5 ); + bSizer177->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextUpdateRight = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUpdateRight->Wrap( -1 ); @@ -732,19 +717,16 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const wxBoxSizer* bSizer178; bSizer178 = new wxBoxSizer( wxVERTICAL ); - - bSizer178->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapCreateRight = new wxStaticBitmap( m_panelStatistics, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapCreateRight->SetToolTip( _("Number of files and folders that will be created") ); bSizer178->Add( m_bitmapCreateRight, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); - bSizer178->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer178->Add( 5, 2, 0, 0, 5 ); - bSizer178->Add( 2, 2, 0, 0, 5 ); + bSizer178->Add( 0, 0, 1, wxEXPAND, 5 ); m_staticTextCreateRight = new wxStaticText( m_panelStatistics, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextCreateRight->Wrap( -1 ); @@ -832,9 +814,10 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); this->Connect( m_menuItem10->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); this->Connect( m_menuItem11->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); - this->Connect( m_menuItemNew->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); - this->Connect( m_menuItemLoad->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); - this->Connect( m_menuItemSave->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); + this->Connect( m_menuItemNew->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigNew ) ); + this->Connect( m_menuItemLoad->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ) ); + this->Connect( m_menuItemSave->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ) ); + this->Connect( m_menuItemSaveAs->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ) ); this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); this->Connect( m_menuItemGlobSett->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); this->Connect( m_menuItem7->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); @@ -851,8 +834,8 @@ MainDialogGenerated::MainDialogGenerated( wxWindow* parent, wxWindowID id, const m_dirPickerLeft->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonSwapSides->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); m_dirPickerRight->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); - m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); + m_bpButtonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); + m_bpButtonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ), NULL, this ); m_listBoxHistory->Connect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); @@ -879,9 +862,10 @@ MainDialogGenerated::~MainDialogGenerated() this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainDialogGenerated::OnClose ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnCompare ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnStartSync ) ); - this->Disconnect( wxID_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnNewConfig ) ); - this->Disconnect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ) ); - this->Disconnect( wxID_SAVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ) ); + this->Disconnect( wxID_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigNew ) ); + this->Disconnect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ) ); + this->Disconnect( wxID_SAVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigSave ) ); + this->Disconnect( wxID_SAVEAS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ) ); this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuQuit ) ); this->Disconnect( wxID_PREFERENCES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuGlobalSettings ) ); this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnMenuBatchJob ) ); @@ -898,8 +882,8 @@ MainDialogGenerated::~MainDialogGenerated() m_dirPickerLeft->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); m_bpButtonSwapSides->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSwapSides ), NULL, this ); m_dirPickerRight->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainDialogGenerated::OnDirSelected ), NULL, this ); - m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnLoadConfig ), NULL, this ); - m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnSaveConfig ), NULL, this ); + m_bpButtonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigLoad ), NULL, this ); + m_bpButtonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigSaveAs ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_CHAR, wxKeyEventHandler( MainDialogGenerated::OnCfgHistoryKeyEvent ), NULL, this ); m_listBoxHistory->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( MainDialogGenerated::OnLoadFromHistory ), NULL, this ); m_bpButtonFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::OnConfigureFilter ), NULL, this ); @@ -1109,7 +1093,7 @@ CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id, sSizerTimeRemaining = new wxBoxSizer( wxHORIZONTAL ); - m_staticTextTimeRemFixed = new wxStaticText( this, wxID_ANY, _("Remaining time:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextTimeRemFixed = new wxStaticText( this, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextTimeRemFixed->Wrap( -1 ); m_staticTextTimeRemFixed->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -1130,7 +1114,7 @@ CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id, sSizerTimeElapsed = new wxBoxSizer( wxHORIZONTAL ); wxStaticText* m_staticText37; - m_staticText37 = new wxStaticText( this, wxID_ANY, _("Elapsed time:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText37 = new wxStaticText( this, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText37->Wrap( -1 ); m_staticText37->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -1539,16 +1523,16 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer68; bSizer68 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonSave = new wxButton( this, wxID_SAVE, _("&Save..."), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonSave->SetDefault(); - m_buttonSave->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); - - bSizer68->Add( m_buttonSave, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - m_buttonLoad = new wxButton( this, wxID_OPEN, _("&Open..."), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_buttonLoad->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - bSizer68->Add( m_buttonLoad, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + bSizer68->Add( m_buttonLoad, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_buttonSave = new wxButton( this, wxID_SAVE, _("Save &As..."), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonSave->SetDefault(); + m_buttonSave->SetFont( wxFont( 10, 70, 90, 92, false, wxEmptyString ) ); + + bSizer68->Add( m_buttonSave, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_button6 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); m_button6->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -1575,8 +1559,8 @@ BatchDlgGenerated::BatchDlgGenerated( wxWindow* parent, wxWindowID id, const wxS m_bpButtonRemovePair->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); m_choiceHandleError->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); m_spinCtrlLogCountMax->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), 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_buttonSave->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); } @@ -1592,8 +1576,8 @@ BatchDlgGenerated::~BatchDlgGenerated() m_bpButtonRemovePair->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnRemoveTopFolderPair ), NULL, this ); m_choiceHandleError->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( BatchDlgGenerated::OnChangeErrorHandling ), NULL, this ); m_spinCtrlLogCountMax->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BatchDlgGenerated::OnChangeMaxLogCountTxt ), 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_buttonSave->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnSaveBatchJob ), NULL, this ); m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BatchDlgGenerated::OnCancel ), NULL, this ); } @@ -2257,7 +2241,7 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, m_staticTextStatus->Wrap( -1 ); m_staticTextStatus->SetFont( wxFont( 14, 70, 90, 92, false, wxEmptyString ) ); - bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); + bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); m_animationControl1 = new wxAnimationCtrl( m_panelHeader, wxID_ANY, wxNullAnimation, wxDefaultPosition, wxDefaultSize, wxAC_DEFAULT_STYLE ); m_animationControl1->SetMinSize( wxSize( 45,45 ) ); @@ -2359,7 +2343,7 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, fgSizer10->Add( m_staticTextSpeed, 0, wxALIGN_BOTTOM, 5 ); - m_staticTextLabelRemTime = new wxStaticText( m_panelProgress, wxID_ANY, _("Remaining time:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLabelRemTime = new wxStaticText( m_panelProgress, wxID_ANY, _("Time remaining:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLabelRemTime->Wrap( -1 ); m_staticTextLabelRemTime->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -2371,7 +2355,7 @@ SyncStatusDlgGenerated::SyncStatusDlgGenerated( wxWindow* parent, wxWindowID id, fgSizer10->Add( m_staticTextRemTime, 0, wxALIGN_BOTTOM, 5 ); - m_staticTextLabelElapsedTime = new wxStaticText( m_panelProgress, wxID_ANY, _("Elapsed time:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLabelElapsedTime = new wxStaticText( m_panelProgress, wxID_ANY, _("Time elapsed:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLabelElapsedTime->Wrap( -1 ); m_staticTextLabelElapsedTime->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); @@ -2561,20 +2545,20 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer53; bSizer53 = new wxBoxSizer( wxVERTICAL ); - m_panel5 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); - m_panel5->SetBackgroundColour( wxColour( 255, 255, 255 ) ); + m_panelLogo = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL ); + m_panelLogo->SetBackgroundColour( wxColour( 255, 255, 255 ) ); wxBoxSizer* bSizer36; bSizer36 = new wxBoxSizer( wxHORIZONTAL ); - m_bitmap11 = new wxStaticBitmap( m_panel5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_bitmap11 = new wxStaticBitmap( m_panelLogo, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); bSizer36->Add( m_bitmap11, 0, wxALIGN_CENTER_VERTICAL, 5 ); - m_panel5->SetSizer( bSizer36 ); - m_panel5->Layout(); - bSizer36->Fit( m_panel5 ); - bSizer53->Add( m_panel5, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); + m_panelLogo->SetSizer( bSizer36 ); + m_panelLogo->Layout(); + bSizer36->Fit( m_panelLogo ); + bSizer53->Add( m_panelLogo, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_build = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_build->Wrap( -1 ); @@ -2680,57 +2664,54 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizerCodeInfo->Fit( m_panel33 ); bSizer53->Add( m_panel33, 0, wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer29; - sbSizer29 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Feedback and suggestions are welcome") ), wxHORIZONTAL ); - - wxBoxSizer* bSizer170; - bSizer170 = new wxBoxSizer( wxHORIZONTAL ); - - - bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); - - m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, _("Homepage"), wxT("http://sourceforge.net/projects/freefilesync/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink1->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink1->SetToolTip( _("http://sourceforge.net/projects/freefilesync/") ); - - bSizer170->Add( m_hyperlink1, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_bitmap9->SetToolTip( _("FreeFileSync at Sourceforge") ); - - bSizer170->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_panel40 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel40->SetBackgroundColour( wxColour( 153, 170, 187 ) ); + wxBoxSizer* bSizer183; + bSizer183 = new wxBoxSizer( wxVERTICAL ); - bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); + m_panel39 = new wxPanel( m_panel40, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel39->SetBackgroundColour( wxColour( 221, 221, 255 ) ); + wxBoxSizer* bSizer184; + bSizer184 = new wxBoxSizer( wxHORIZONTAL ); - sbSizer29->Add( bSizer170, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_staticText83 = new wxStaticText( m_panel39, wxID_ANY, _("If you like FreeFileSync"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText83->Wrap( -1 ); + m_staticText83->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 93, 92, false, wxEmptyString ) ); + m_staticText83->SetForegroundColour( wxColour( 0, 0, 0 ) ); - wxBoxSizer* bSizer1711; - bSizer1711 = new wxBoxSizer( wxHORIZONTAL ); + bSizer184->Add( m_staticText83, 0, wxALL, 5 ); - bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); - m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink2->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink2->SetToolTip( _("zhnmju123@gmx.de") ); + m_hyperlink3 = new wxHyperlinkCtrl( m_panel39, wxID_ANY, _("Donate with PayPal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink3->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink3->SetBackgroundColour( wxColour( 221, 221, 255 ) ); + m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR") ); - bSizer1711->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bSizer184->Add( m_hyperlink3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - m_bitmap10->SetToolTip( _("Email") ); + m_bitmapPaypal = new wxStaticBitmap( m_panel39, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bitmapPaypal->SetToolTip( _("Donate with PayPal") ); - bSizer1711->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + bSizer184->Add( m_bitmapPaypal, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); - sbSizer29->Add( bSizer1711, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_panel39->SetSizer( bSizer184 ); + m_panel39->Layout(); + bSizer184->Fit( m_panel39 ); + bSizer183->Add( m_panel39, 0, wxEXPAND|wxALL, 5 ); - bSizer53->Add( sbSizer29, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); + m_panel40->SetSizer( bSizer183 ); + m_panel40->Layout(); + bSizer183->Fit( m_panel40 ); + bSizer53->Add( m_panel40, 0, wxEXPAND|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5 ); m_scrolledWindowTranslators = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxDOUBLE_BORDER|wxHSCROLL|wxVSCROLL ); m_scrolledWindowTranslators->SetScrollRate( 5, 5 ); @@ -2761,54 +2742,57 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS bSizerTranslators->Fit( m_scrolledWindowTranslators ); bSizer53->Add( m_scrolledWindowTranslators, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxEXPAND, 5 ); - m_panel40 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel40->SetBackgroundColour( wxColour( 153, 170, 187 ) ); + wxStaticBoxSizer* sbSizer29; + sbSizer29 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Feedback and suggestions are welcome") ), wxHORIZONTAL ); - wxBoxSizer* bSizer183; - bSizer183 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizer170; + bSizer170 = new wxBoxSizer( wxHORIZONTAL ); - m_panel39 = new wxPanel( m_panel40, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel39->SetBackgroundColour( wxColour( 221, 221, 255 ) ); - wxBoxSizer* bSizer184; - bSizer184 = new wxBoxSizer( wxHORIZONTAL ); + bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); - m_staticText83 = new wxStaticText( m_panel39, wxID_ANY, _("If you like FreeFileSync"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText83->Wrap( -1 ); - m_staticText83->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 93, 92, false, wxEmptyString ) ); - m_staticText83->SetForegroundColour( wxColour( 0, 0, 0 ) ); + m_hyperlink1 = new wxHyperlinkCtrl( this, wxID_ANY, _("Homepage"), wxT("http://sourceforge.net/projects/freefilesync/"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink1->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink1->SetToolTip( _("http://sourceforge.net/projects/freefilesync/") ); - bSizer184->Add( m_staticText83, 0, wxALL, 5 ); + bSizer170->Add( m_hyperlink1, 0, wxALIGN_CENTER_VERTICAL, 5 ); + m_bitmap9 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_bitmap9->SetToolTip( _("FreeFileSync at Sourceforge") ); - bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer170->Add( m_bitmap9, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - m_hyperlink3 = new wxHyperlinkCtrl( m_panel39, wxID_ANY, _("Donate with PayPal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); - m_hyperlink3->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); - m_hyperlink3->SetBackgroundColour( wxColour( 221, 221, 255 ) ); - m_hyperlink3->SetToolTip( _("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zhnmju123@gmx.de&lc=US¤cy_code=EUR") ); - bSizer184->Add( m_hyperlink3, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + bSizer170->Add( 0, 0, 1, wxEXPAND, 5 ); - m_bitmapPaypal = new wxStaticBitmap( m_panel39, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapPaypal->SetToolTip( _("Donate with PayPal") ); - bSizer184->Add( m_bitmapPaypal, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + sbSizer29->Add( bSizer170, 1, wxALIGN_CENTER_VERTICAL, 5 ); + wxBoxSizer* bSizer1711; + bSizer1711 = new wxBoxSizer( wxHORIZONTAL ); - bSizer184->Add( 0, 0, 1, wxEXPAND, 5 ); + bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); - m_panel39->SetSizer( bSizer184 ); - m_panel39->Layout(); - bSizer184->Fit( m_panel39 ); - bSizer183->Add( m_panel39, 0, wxEXPAND|wxALL, 5 ); + m_hyperlink2 = new wxHyperlinkCtrl( this, wxID_ANY, _("Email"), wxT("mailto:zhnmju123@gmx.de"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + m_hyperlink2->SetFont( wxFont( 10, 70, 90, 92, true, wxEmptyString ) ); + m_hyperlink2->SetToolTip( _("zhnmju123@gmx.de") ); + bSizer1711->Add( m_hyperlink2, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_bitmap10->SetToolTip( _("Email") ); + + bSizer1711->Add( m_bitmap10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + + bSizer1711->Add( 0, 0, 1, wxEXPAND, 5 ); - m_panel40->SetSizer( bSizer183 ); - m_panel40->Layout(); - bSizer183->Fit( m_panel40 ); - bSizer53->Add( m_panel40, 0, wxEXPAND|wxBOTTOM, 5 ); + + sbSizer29->Add( bSizer1711, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer53->Add( sbSizer29, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5 ); wxStaticBoxSizer* sbSizer14; sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Published under the GNU General Public License") ), wxHORIZONTAL ); @@ -2857,7 +2841,7 @@ AboutDlgGenerated::~AboutDlgGenerated() } -ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +MessageDlgGenerated::MessageDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { this->SetSizeHints( wxSize( 300,160 ), wxDefaultSize ); this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); @@ -2871,11 +2855,11 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer26; bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_bitmapMsgType = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer26->Add( m_bitmapMsgType, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,130 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); - bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + m_textCtrlMessage = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,130 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); + bSizer26->Add( m_textCtrlMessage, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); @@ -2889,29 +2873,27 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS wxBoxSizer* bSizer177; bSizer177 = new wxBoxSizer( wxVERTICAL ); - m_checkBoxIgnoreErrors = new wxCheckBox( m_panel33, wxID_ANY, _("Ignore further errors"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxIgnoreErrors->SetToolTip( _("Hide further error messages during the current process") ); - - bSizer177->Add( m_checkBoxIgnoreErrors, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 5 ); + m_checkBoxCustom = new wxCheckBox( m_panel33, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer177->Add( m_checkBoxCustom, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 5 ); wxBoxSizer* bSizer25; bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - m_buttonIgnore = new wxButton( m_panel33, wxID_OK, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonIgnore->SetDefault(); - m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + m_buttonCustom1 = new wxButton( m_panel33, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonCustom1->SetDefault(); + m_buttonCustom1->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer25->Add( m_buttonCustom1, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_buttonRetry = new wxButton( m_panel33, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonRetry->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + m_buttonCustom2 = new wxButton( m_panel33, wxID_ANY, _("dummy"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonCustom2->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + bSizer25->Add( m_buttonCustom2, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - m_buttonAbort = new wxButton( m_panel33, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); + m_buttonCancel = new wxButton( m_panel33, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); + m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - bSizer25->Add( m_buttonAbort, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + bSizer25->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); bSizer177->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -2930,193 +2912,19 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS this->Centre( wxBOTH ); // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonIgnore->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); - m_buttonRetry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); -} - -ErrorDlgGenerated::~ErrorDlgGenerated() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ErrorDlgGenerated::OnClose ) ); - m_buttonIgnore->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnIgnore ), NULL, this ); - m_buttonRetry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnRetry ), NULL, this ); - m_buttonAbort->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ErrorDlgGenerated::OnAbort ), NULL, this ); - -} - -WarningDlgGenerated::WarningDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxSize( 300,160 ), wxDefaultSize ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,130 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); - bSizer26->Add( m_textCtrl8, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticline7 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer24->Add( m_staticline7, 0, wxEXPAND|wxTOP, 5 ); - - m_panel34 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel34->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); - - wxBoxSizer* bSizer178; - bSizer178 = new wxBoxSizer( wxVERTICAL ); - - m_checkBoxDontShowAgain = new wxCheckBox( m_panel34, wxID_ANY, _("Do not show this dialog again"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer178->Add( m_checkBoxDontShowAgain, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonIgnore = new wxButton( m_panel34, wxID_IGNORE, _("&Ignore"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonIgnore->SetDefault(); - m_buttonIgnore->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonIgnore, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonSwitch = new wxButton( m_panel34, wxID_MORE, _("&Switch"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonSwitch->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonSwitch, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_buttonAbort = new wxButton( m_panel34, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonAbort->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonAbort, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); - - - bSizer178->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - m_panel34->SetSizer( bSizer178 ); - m_panel34->Layout(); - bSizer178->Fit( m_panel34 ); - bSizer24->Add( m_panel34, 0, wxEXPAND, 5 ); - - - this->SetSizer( bSizer24 ); - this->Layout(); - bSizer24->Fit( this ); - - this->Centre( wxBOTH ); - - // 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 ); -} - -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 ); - -} - -QuestionDlgGenerated::QuestionDlgGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxSize( 300,160 ), wxDefaultSize ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - - bSizer24->Add( 0, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer26; - bSizer26 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmap10 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer26->Add( m_bitmap10, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_textCtrl8 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,130 ), wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); - bSizer26->Add( m_textCtrl8, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer24->Add( bSizer26, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_staticline8 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer24->Add( m_staticline8, 0, wxEXPAND|wxTOP, 5 ); - - m_panel35 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel35->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); - - wxBoxSizer* bSizer179; - bSizer179 = new wxBoxSizer( wxVERTICAL ); - - m_checkBox = new wxCheckBox( m_panel35, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer179->Add( m_checkBox, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonYes = new wxButton( m_panel35, wxID_YES, _("&Yes"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonYes->SetDefault(); - m_buttonYes->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonYes, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonNo = new wxButton( m_panel35, wxID_NO, _("&No"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonNo->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonNo, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - m_buttonCancel = new wxButton( m_panel35, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,30 ), 0 ); - m_buttonCancel->SetFont( wxFont( 10, 70, 90, 90, false, wxEmptyString ) ); - - bSizer25->Add( m_buttonCancel, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - - bSizer179->Add( bSizer25, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - - m_panel35->SetSizer( bSizer179 ); - m_panel35->Layout(); - bSizer179->Fit( m_panel35 ); - bSizer24->Add( m_panel35, 0, wxEXPAND, 5 ); - - - this->SetSizer( bSizer24 ); - this->Layout(); - bSizer24->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); - m_buttonYes->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); - m_buttonNo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MessageDlgGenerated::OnClose ) ); + m_buttonCustom1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnButton1 ), NULL, this ); + m_buttonCustom2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnButton2 ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnCancel ), NULL, this ); } -QuestionDlgGenerated::~QuestionDlgGenerated() +MessageDlgGenerated::~MessageDlgGenerated() { // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( QuestionDlgGenerated::OnClose ) ); - m_buttonYes->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnYes ), NULL, this ); - m_buttonNo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnNo ), NULL, this ); - m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( QuestionDlgGenerated::OnCancel ), NULL, this ); + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MessageDlgGenerated::OnClose ) ); + m_buttonCustom1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnButton1 ), NULL, this ); + m_buttonCustom2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnButton2 ), NULL, this ); + m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MessageDlgGenerated::OnCancel ), NULL, this ); } @@ -3738,7 +3546,7 @@ SyncPreviewDlgGenerated::SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID i fgSizer11->Add( m_bitmapDeleteLeft, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); m_bitmapData = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bitmapData->SetToolTip( _("Total amount of data that will be transferred") ); + m_bitmapData->SetToolTip( _("Total bytes to copy") ); fgSizer11->Add( m_bitmapData, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -3777,7 +3585,7 @@ SyncPreviewDlgGenerated::SyncPreviewDlgGenerated( wxWindow* parent, wxWindowID i m_staticTextData = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextData->Wrap( -1 ); - m_staticTextData->SetToolTip( _("Total amount of data that will be transferred") ); + m_staticTextData->SetToolTip( _("Total bytes to copy") ); fgSizer11->Add( m_staticTextData, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); diff --git a/ui/gui_generated.h b/ui/gui_generated.h index cb608374..fa388377 100644 --- a/ui/gui_generated.h +++ b/ui/gui_generated.h @@ -77,6 +77,7 @@ protected: wxMenuItem* m_menuItemNew; wxMenuItem* m_menuItemLoad; wxMenuItem* m_menuItemSave; + wxMenuItem* m_menuItemSaveAs; wxMenu* m_menuAdvanced; wxMenu* m_menuLanguages; wxMenuItem* m_menuItemGlobSett; @@ -169,9 +170,10 @@ protected: virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnCompare( wxCommandEvent& event ) { event.Skip(); } virtual void OnStartSync( wxCommandEvent& event ) { event.Skip(); } - virtual void OnNewConfig( wxCommandEvent& event ) { event.Skip(); } - virtual void OnLoadConfig( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSaveConfig( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigNew( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigLoad( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigSave( wxCommandEvent& event ) { event.Skip(); } + virtual void OnConfigSaveAs( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuQuit( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuGlobalSettings( wxCommandEvent& event ) { event.Skip(); } virtual void OnMenuBatchJob( wxCommandEvent& event ) { event.Skip(); } @@ -321,8 +323,8 @@ protected: wxPanel* m_panelLogfile; wxStaticText* m_staticText94; zen::DirPickerCtrl* m_dirPickerLogfileDir; - wxButton* m_buttonSave; wxButton* m_buttonLoad; + wxButton* m_buttonSave; wxButton* m_button6; // Virtual event handlers, overide them in your derived class @@ -335,8 +337,8 @@ protected: virtual void OnRemoveTopFolderPair( wxCommandEvent& event ) { event.Skip(); } virtual void OnChangeErrorHandling( wxCommandEvent& event ) { event.Skip(); } virtual void OnChangeMaxLogCountTxt( wxCommandEvent& event ) { event.Skip(); } - virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } virtual void OnLoadBatchJob( wxCommandEvent& event ) { event.Skip(); } + virtual void OnSaveBatchJob( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } @@ -607,7 +609,7 @@ class AboutDlgGenerated : public wxDialog private: protected: - wxPanel* m_panel5; + wxPanel* m_panelLogo; wxStaticBitmap* m_bitmap11; wxStaticText* m_build; wxPanel* m_panel33; @@ -625,19 +627,19 @@ protected: wxHyperlinkCtrl* m_hyperlink18; wxHyperlinkCtrl* m_hyperlink14; wxHyperlinkCtrl* m_hyperlink21; - wxHyperlinkCtrl* m_hyperlink1; - wxStaticBitmap* m_bitmap9; - wxHyperlinkCtrl* m_hyperlink2; - wxStaticBitmap* m_bitmap10; - wxScrolledWindow* m_scrolledWindowTranslators; - wxBoxSizer* bSizerTranslators; - wxStaticText* m_staticText54; - wxFlexGridSizer* fgSizerTranslators; wxPanel* m_panel40; wxPanel* m_panel39; wxStaticText* m_staticText83; wxHyperlinkCtrl* m_hyperlink3; wxStaticBitmap* m_bitmapPaypal; + wxScrolledWindow* m_scrolledWindowTranslators; + wxBoxSizer* bSizerTranslators; + wxStaticText* m_staticText54; + wxFlexGridSizer* fgSizerTranslators; + wxHyperlinkCtrl* m_hyperlink1; + wxStaticBitmap* m_bitmap9; + wxHyperlinkCtrl* m_hyperlink2; + wxStaticBitmap* m_bitmap10; wxStaticBitmap* m_bitmap13; wxHyperlinkCtrl* m_hyperlink5; wxButton* m_buttonOkay; @@ -655,95 +657,33 @@ public: }; /////////////////////////////////////////////////////////////////////////////// -/// Class ErrorDlgGenerated +/// Class MessageDlgGenerated /////////////////////////////////////////////////////////////////////////////// -class ErrorDlgGenerated : public wxDialog +class MessageDlgGenerated : public wxDialog { private: protected: - wxStaticBitmap* m_bitmap10; - wxTextCtrl* m_textCtrl8; + wxStaticBitmap* m_bitmapMsgType; + wxTextCtrl* m_textCtrlMessage; wxStaticLine* m_staticline6; wxPanel* m_panel33; - wxCheckBox* m_checkBoxIgnoreErrors; - wxButton* m_buttonIgnore; - wxButton* m_buttonRetry; - 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 OnRetry( wxCommandEvent& event ) { event.Skip(); } - virtual void OnAbort( wxCommandEvent& event ) { event.Skip(); } - - -public: - - ErrorDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Error"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~ErrorDlgGenerated(); - -}; - -/////////////////////////////////////////////////////////////////////////////// -/// Class WarningDlgGenerated -/////////////////////////////////////////////////////////////////////////////// -class WarningDlgGenerated : public wxDialog -{ -private: - -protected: - wxTextCtrl* m_textCtrl8; - wxStaticLine* m_staticline7; - wxPanel* m_panel34; - 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(); } - - -public: - wxStaticBitmap* m_bitmap10; - - WarningDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Warning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~WarningDlgGenerated(); - -}; - -/////////////////////////////////////////////////////////////////////////////// -/// Class QuestionDlgGenerated -/////////////////////////////////////////////////////////////////////////////// -class QuestionDlgGenerated : public wxDialog -{ -private: - -protected: - wxStaticBitmap* m_bitmap10; - wxTextCtrl* m_textCtrl8; - wxStaticLine* m_staticline8; - wxPanel* m_panel35; - wxCheckBox* m_checkBox; - wxButton* m_buttonYes; - wxButton* m_buttonNo; + wxCheckBox* m_checkBoxCustom; + wxButton* m_buttonCustom1; + wxButton* m_buttonCustom2; wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnYes( wxCommandEvent& event ) { event.Skip(); } - virtual void OnNo( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButton1( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButton2( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } public: - QuestionDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Question"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); - ~QuestionDlgGenerated(); + MessageDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("dummy"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER ); + ~MessageDlgGenerated(); }; diff --git a/ui/gui_status_handler.cpp b/ui/gui_status_handler.cpp index 65e40410..57785403 100644 --- a/ui/gui_status_handler.cpp +++ b/ui/gui_status_handler.cpp @@ -10,6 +10,7 @@ #include "msg_popup.h" #include "main_dlg.h" #include "exec_finished_box.h" +#include "../lib/generate_logfile.h" using namespace zen; using namespace xmlAccess; @@ -54,7 +55,7 @@ CompareStatusHandler::~CompareStatusHandler() mainDlg.m_buttonAbort->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CompareStatusHandler::OnAbortCompare), nullptr, this); if (abortIsRequested()) - mainDlg.pushStatusInformation(_("Operation aborted!")); + mainDlg.flashStatusInformation(_("Operation aborted!")); } @@ -103,7 +104,7 @@ ProcessCallback::Response CompareStatusHandler::reportError(const std::wstring& bool ignoreNextErrors = false; switch (showErrorDlg(&mainDlg, - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT, + ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_CANCEL, message, &ignoreNextErrors)) { case ReturnErrorDlg::BUTTON_IGNORE: @@ -113,7 +114,7 @@ ProcessCallback::Response CompareStatusHandler::reportError(const std::wstring& case ReturnErrorDlg::BUTTON_RETRY: return ProcessCallback::RETRY; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnErrorDlg::BUTTON_CANCEL: abortThisProcess(); } @@ -126,7 +127,7 @@ void CompareStatusHandler::reportFatalError(const std::wstring& errorMessage) { forceUiRefresh(); - showErrorDlg(&mainDlg, ReturnErrorDlg::BUTTON_ABORT, errorMessage, nullptr); + showFatalErrorDlg(&mainDlg, ReturnFatalErrorDlg::BUTTON_CANCEL, errorMessage, nullptr); } @@ -140,7 +141,7 @@ void CompareStatusHandler::reportWarning(const std::wstring& warningMessage, boo //show pop-up and ask user how to handle warning bool dontWarnAgain = false; switch (showWarningDlg(&mainDlg, - ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_ABORT, + ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_CANCEL, warningMessage, dontWarnAgain)) { case ReturnWarningDlg::BUTTON_IGNORE: @@ -149,7 +150,7 @@ void CompareStatusHandler::reportWarning(const std::wstring& warningMessage, boo case ReturnWarningDlg::BUTTON_SWITCH: assert(false); - case ReturnWarningDlg::BUTTON_ABORT: + case ReturnWarningDlg::BUTTON_CANCEL: abortThisProcess(); break; } @@ -178,13 +179,15 @@ void CompareStatusHandler::abortThisProcess() SyncStatusHandler::SyncStatusHandler(MainDialog* parentDlg, OnGuiError handleError, - const wxString& jobName, + const std::wstring& jobName, const std::wstring& execWhenFinished, std::vector<std::wstring>& execFinishedHistory) : parentDlg_(parentDlg), syncStatusFrame(*this, *this, parentDlg, true, jobName, execWhenFinished, execFinishedHistory), - handleError_(handleError) + handleError_(handleError), + jobName_(jobName) { + totalTime.Start(); //measure total time } @@ -193,19 +196,37 @@ SyncStatusHandler::~SyncStatusHandler() const int totalErrors = errorLog.getItemCount(TYPE_ERROR | TYPE_FATAL_ERROR); //evaluate before finalizing log //finalize error log + //finalize error log + std::wstring finalStatus; if (abortIsRequested()) - errorLog.logMsg(_("Synchronization aborted!"), TYPE_ERROR); + { + finalStatus = _("Synchronization aborted!"); + errorLog.logMsg(finalStatus, TYPE_ERROR); + } else if (totalErrors > 0) - errorLog.logMsg(_("Synchronization completed with errors!"), TYPE_WARNING); + { + finalStatus = _("Synchronization completed with errors!"); + errorLog.logMsg(finalStatus, TYPE_WARNING); + } else { if (getObjectsTotal(PHASE_SYNCHRONIZING) == 0 && //we're past "initNewPhase(PHASE_SYNCHRONIZING)" at this point! getDataTotal (PHASE_SYNCHRONIZING) == 0) - errorLog.logMsg(_("Nothing to synchronize!"), TYPE_INFO); //even if "ignored conflicts" occurred! + finalStatus = _("Nothing to synchronize!"); //even if "ignored conflicts" occurred! else - errorLog.logMsg(_("Synchronization completed successfully!"), TYPE_INFO); + finalStatus = _("Synchronization completed successfully!"); + errorLog.logMsg(finalStatus, TYPE_INFO); } + const Utf8String logStream = generateLogStream(errorLog, jobName_, finalStatus, + getObjectsCurrent(PHASE_SYNCHRONIZING), getDataCurrent(PHASE_SYNCHRONIZING), + getObjectsTotal (PHASE_SYNCHRONIZING), getDataTotal (PHASE_SYNCHRONIZING), totalTime.Time() / 1000); + try + { + saveToLastSyncsLog(logStream); //throw FileError + } + catch (FileError&) {} + bool showFinalResults = true; //execute "on completion" command (even in case of ignored errors) @@ -272,7 +293,7 @@ ProcessCallback::Response SyncStatusHandler::reportError(const std::wstring& err bool ignoreNextErrors = false; switch (showErrorDlg(parentDlg_, - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT, + ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_CANCEL, errorMessage, &ignoreNextErrors)) { @@ -285,7 +306,7 @@ ProcessCallback::Response SyncStatusHandler::reportError(const std::wstring& err case ReturnErrorDlg::BUTTON_RETRY: return ProcessCallback::RETRY; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnErrorDlg::BUTTON_CANCEL: errorLog.logMsg(errorMessage, TYPE_ERROR); abortThisProcess(); break; @@ -308,21 +329,18 @@ void SyncStatusHandler::reportFatalError(const std::wstring& errorMessage) forceUiRefresh(); bool ignoreNextErrors = false; - switch (showErrorDlg(parentDlg_, - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_ABORT, - errorMessage, &ignoreNextErrors)) + switch (showFatalErrorDlg(parentDlg_, + ReturnFatalErrorDlg::BUTTON_IGNORE | ReturnFatalErrorDlg::BUTTON_CANCEL, + errorMessage, &ignoreNextErrors)) { - case ReturnErrorDlg::BUTTON_IGNORE: + case ReturnFatalErrorDlg::BUTTON_IGNORE: if (ignoreNextErrors) //falsify only handleError_ = ON_GUIERROR_IGNORE; break; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnFatalErrorDlg::BUTTON_CANCEL: abortThisProcess(); break; - - case ReturnErrorDlg::BUTTON_RETRY: - assert(false); } } break; @@ -349,7 +367,7 @@ void SyncStatusHandler::reportWarning(const std::wstring& warningMessage, bool& bool dontWarnAgain = false; switch (showWarningDlg(parentDlg_, - ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_ABORT, + ReturnWarningDlg::BUTTON_IGNORE | ReturnWarningDlg::BUTTON_CANCEL, warningMessage, dontWarnAgain)) { case ReturnWarningDlg::BUTTON_IGNORE: //no unhandled error situation! @@ -358,7 +376,7 @@ void SyncStatusHandler::reportWarning(const std::wstring& warningMessage, bool& case ReturnWarningDlg::BUTTON_SWITCH: assert(false); - case ReturnWarningDlg::BUTTON_ABORT: + case ReturnWarningDlg::BUTTON_CANCEL: abortThisProcess(); break; } diff --git a/ui/gui_status_handler.h b/ui/gui_status_handler.h index ebc59473..0bda9923 100644 --- a/ui/gui_status_handler.h +++ b/ui/gui_status_handler.h @@ -9,6 +9,7 @@ #include <wx/event.h> #include <zen/error_log.h> +#include <wx/stopwatch.h> #include "progress_indicator.h" #include "../lib/status_handler.h" #include "../lib/process_xml.h" @@ -49,7 +50,7 @@ class SyncStatusHandler : public zen::StatusHandler public: SyncStatusHandler(MainDialog* parentDlg, xmlAccess::OnGuiError handleError, - const wxString& jobName, + const std::wstring& jobName, const std::wstring& execWhenFinished, std::vector<std::wstring>& execFinishedHistory); ~SyncStatusHandler(); @@ -70,6 +71,8 @@ private: SyncStatus syncStatusFrame; //the window managed by SyncStatus has longer lifetime than this handler! xmlAccess::OnGuiError handleError_; zen::ErrorLog errorLog; + const std::wstring jobName_; + wxStopWatch totalTime; }; diff --git a/ui/main_dlg.cpp b/ui/main_dlg.cpp index 1ea2f29f..03a94e33 100644 --- a/ui/main_dlg.cpp +++ b/ui/main_dlg.cpp @@ -9,7 +9,6 @@ #include <stdexcept> #include <wx/clipbrd.h> #include <wx/dataobj.h> -#include <wx/ffile.h> #include <wx/imaglist.h> #include <wx/wupdlock.h> #include <wx/msgdlg.h> @@ -29,7 +28,6 @@ #include "check_version.h" #include "gui_status_handler.h" #include "sync_cfg.h" -#include <wx+/string_conv.h> #include "small_dlgs.h" #include <wx+/mouse_move_dlg.h> #include "progress_indicator.h" @@ -45,6 +43,7 @@ #include <wx+/toggle_button.h> #include "folder_pair.h" #include <wx+/rtl.h> +#include <wx+/serialize.h> #include "search.h" #include "../lib/help_provider.h" #include "batch_config.h" @@ -514,7 +513,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, wxAuiPaneInfo().Name(wxT("Panel6")).Layer(4).Bottom().Row(1).Position(2).Caption(_("Select view")).MinSize(m_bpButtonSyncDirNone->GetSize().GetWidth(), m_panelViewFilter->GetSize().GetHeight())); auiMgr.AddPane(m_panelStatistics, - wxAuiPaneInfo().Name(wxT("Panel7")).Layer(4).Bottom().Row(1).Position(3).Caption(_("Statistics")).MinSize(bSizerData->GetSize().GetWidth() / 2, m_panelStatistics->GetSize().GetHeight())); + wxAuiPaneInfo().Name(wxT("Panel7")).Layer(4).Bottom().Row(1).Position(3).Caption(_("Statistics")).MinSize(m_bitmapData->GetSize().GetWidth() + m_staticTextData->GetSize().GetWidth(), m_panelStatistics->GetSize().GetHeight())); auiMgr.Update(); @@ -601,11 +600,22 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, //menu icons: workaround for wxWidgets: small hack to update menu items: actually this is a wxWidgets bug (affects Windows- and Linux-build) MenuItemUpdater updateMenuFile(*m_menuFile); - updateMenuFile.markForUpdate(m_menuItem10, GlobalResources::getImage(wxT("compareSmall"))); - updateMenuFile.markForUpdate(m_menuItem11, GlobalResources::getImage(wxT("syncSmall"))); - //updateMenuFile.markForUpdate(m_menuItemNew, GlobalResources::getImage(wxT("newSmall"))); - updateMenuFile.markForUpdate(m_menuItemSave, GlobalResources::getImage(wxT("saveSmall"))); - updateMenuFile.markForUpdate(m_menuItemLoad, GlobalResources::getImage(wxT("loadSmall"))); + + const int dummySize = 5; + wxImage dummyImg(dummySize, dummySize); + if (!dummyImg.HasAlpha()) + dummyImg.InitAlpha(); + std::fill(dummyImg.GetAlpha(), dummyImg.GetAlpha() + dummySize * dummySize, wxIMAGE_ALPHA_TRANSPARENT); + + updateMenuFile.markForUpdate(m_menuItem10, GlobalResources::getImage(L"compareSmall")); + updateMenuFile.markForUpdate(m_menuItem11, GlobalResources::getImage(L"syncSmall")); + + updateMenuFile.markForUpdate(m_menuItemNew, dummyImg); //it's ridiculous, but wxWidgets screws up aligning short-cut label texts if we don't set an image! + //updateMenuFile.markForUpdate(m_menuItemSave, dummyImg); // + updateMenuFile.markForUpdate(m_menuItemSave, GlobalResources::getImage(L"saveSmall")); + + //updateMenuFile.markForUpdate(m_menuItemSaveAs, GlobalResources::getImage(L"saveSmall")); + updateMenuFile.markForUpdate(m_menuItemLoad, GlobalResources::getImage(L"loadSmall")); MenuItemUpdater updateMenuAdv(*m_menuAdvanced); updateMenuAdv.markForUpdate(m_menuItemGlobSett, GlobalResources::getImage(L"settingsSmall")); @@ -613,7 +623,7 @@ void MainDialog::init(const xmlAccess::XmlGuiConfig& guiCfg, MenuItemUpdater updateMenuHelp(*m_menuHelp); updateMenuHelp.markForUpdate(m_menuItemManual, GlobalResources::getImage(L"helpSmall")); - updateMenuHelp.markForUpdate(m_menuItemAbout, GlobalResources::getImage(L"aboutSmall")); + updateMenuHelp.markForUpdate(m_menuItemAbout, GlobalResources::getImage(L"aboutSmall")); #ifdef FFS_LINUX m_menuItemCheckVer->Enable(zen::isPortableVersion()); //disable update check for Linux installer-based version -> handled by .deb @@ -856,29 +866,6 @@ void MainDialog::setManualFilter(const std::vector<FileSystemObject*>& selection } -void MainDialog::OnIdleEvent(wxEvent& event) -{ - //small routine to restore status information after some time - if (!stackObjects.empty()) //check if there is some work to do - { - wxMilliClock_t currentTime = wxGetLocalTimeMillis(); - if (currentTime - lastStatusChange > 2500) //restore stackObject after two seconds - { - lastStatusChange = currentTime; - - m_staticTextStatusMiddle->SetLabel(stackObjects.top()); - stackObjects.pop(); - - if (stackObjects.empty()) - m_staticTextStatusMiddle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //reset color - - m_panelStatusBar->Layout(); - } - } - - event.Skip(); -} - namespace { //fast replacement for wxString modelling exponential growth @@ -995,7 +982,6 @@ public: deletionCount(0) { mainDlg->disableAllElements(true); //disable everything except abort button - mainDlg->clearStatusBar(); //register abort button mainDlg->m_buttonAbort->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ManualDeletionHandler::OnAbortDeletion), nullptr, this ); @@ -1021,7 +1007,7 @@ public: bool ignoreNextErrors = false; switch (showErrorDlg(mainDlg, - ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_ABORT, + ReturnErrorDlg::BUTTON_IGNORE | ReturnErrorDlg::BUTTON_RETRY | ReturnErrorDlg::BUTTON_CANCEL, errorMessage, &ignoreNextErrors)) { case ReturnErrorDlg::BUTTON_IGNORE: @@ -1029,7 +1015,7 @@ public: return DeleteFilesHandler::IGNORE_ERROR; case ReturnErrorDlg::BUTTON_RETRY: return DeleteFilesHandler::RETRY; - case ReturnErrorDlg::BUTTON_ABORT: + case ReturnErrorDlg::BUTTON_CANCEL: throw AbortDeleteProcess(); } @@ -1043,14 +1029,8 @@ public: if (updateUiIsAllowed()) //test if specific time span between ui updates is over { - wxString statusMessage = replaceCpy(_P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount), - L"%x", zen::toGuiString(deletionCount), false); - - if (mainDlg->m_staticTextStatusMiddle->GetLabel() != statusMessage) - { - mainDlg->m_staticTextStatusMiddle->SetLabel(statusMessage); - mainDlg->m_panelStatusBar->Layout(); - } + mainDlg->setStatusInformation(replaceCpy(_P("Object deleted successfully!", "%x objects deleted successfully!", deletionCount), + L"%x", zen::toGuiString(deletionCount), false)); updateUiNow(); } @@ -1227,29 +1207,58 @@ void MainDialog::openExternalApplication(const wxString& commandline, const zen: } -void MainDialog::pushStatusInformation(const wxString& text) +void MainDialog::setStatusInformation(const wxString& msg) { - lastStatusChange = wxGetLocalTimeMillis(); - stackObjects.push(m_staticTextStatusMiddle->GetLabel()); - m_staticTextStatusMiddle->SetLabel(text); - m_staticTextStatusMiddle->SetForegroundColour(wxColour(31, 57, 226)); //highlight color: blue - m_panelStatusBar->Layout(); + if (statusMsgStack.empty()) + { + if (m_staticTextStatusMiddle->GetLabel() != msg) + { + m_staticTextStatusMiddle->SetLabel(msg); + m_panelStatusBar->Layout(); + } + } + else + statusMsgStack[0] = msg; //statusMsgStack, index 0 is main status, while 1, 2, ... are temporary status texts in reverse order of screen appearance +} + + +void MainDialog::flashStatusInformation(const wxString& text) +{ + if (statusMsgStack.empty()) + { + statusMsgStack.push_back(m_staticTextStatusMiddle->GetLabel()); + + lastStatusChange = wxGetLocalTimeMillis(); + m_staticTextStatusMiddle->SetLabel(text); + m_staticTextStatusMiddle->SetForegroundColour(wxColour(31, 57, 226)); //highlight color: blue + m_panelStatusBar->Layout(); + } + else + statusMsgStack.insert(statusMsgStack.begin() + 1, text); } -void MainDialog::clearStatusBar() +void MainDialog::OnIdleEvent(wxEvent& event) { - while (!stackObjects.empty()) - stackObjects.pop(); + //small routine to restore status information after some time + if (!statusMsgStack.empty()) //check if there is some work to do + { + wxMilliClock_t currentTime = wxGetLocalTimeMillis(); + if (currentTime - lastStatusChange > 2500) //restore stackObject after two seconds + { + lastStatusChange = currentTime; - m_staticTextStatusMiddle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //reset color - bSizerStatusLeftDirectories->Show(false); - bSizerStatusLeftFiles ->Show(false); + m_staticTextStatusMiddle->SetLabel(statusMsgStack.back()); + statusMsgStack.pop_back(); - m_staticTextStatusMiddle->SetLabel(wxEmptyString); + if (statusMsgStack.empty()) + m_staticTextStatusMiddle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //reset color + + m_panelStatusBar->Layout(); + } + } - bSizerStatusRightDirectories->Show(false); - bSizerStatusRightFiles ->Show(false); + event.Skip(); } @@ -1267,7 +1276,7 @@ void MainDialog::disableAllElements(bool enableAbort) m_bpButtonSyncConfig ->Disable(); m_buttonStartSync ->Disable(); m_gridMain ->Disable(); - m_panelCenter ->Disable(); + m_gridMain ->Disable(); m_panelStatistics ->Disable(); m_gridNavi ->Disable(); m_panelDirectoryPairs->Disable(); @@ -1303,7 +1312,7 @@ void MainDialog::enableAllElements() m_bpButtonSyncConfig ->Enable(); m_buttonStartSync ->Enable(); m_gridMain ->Enable(); - m_panelCenter ->Enable(); + m_gridMain ->Enable(); m_panelStatistics ->Enable(); m_gridNavi ->Enable(); m_panelDirectoryPairs->Enable(); @@ -1326,21 +1335,11 @@ namespace { void updateSizerOrientation(wxBoxSizer& sizer, wxWindow& window) { - if (window.GetSize().GetWidth() > window.GetSize().GetHeight()) //check window NOT sizer width! + const int newOrientation = window.GetSize().GetWidth() > window.GetSize().GetHeight() ? wxHORIZONTAL : wxVERTICAL; //check window NOT sizer width! + if (sizer.GetOrientation() != newOrientation) { - if (sizer.GetOrientation() != wxHORIZONTAL) - { - sizer.SetOrientation(wxHORIZONTAL); - window.Layout(); - } - } - else - { - if (sizer.GetOrientation() != wxVERTICAL) - { - sizer.SetOrientation(wxVERTICAL); - window.Layout(); - } + sizer.SetOrientation(newOrientation); + window.Layout(); } } } @@ -1360,7 +1359,27 @@ void MainDialog::OnResizeViewPanel(wxEvent& event) void MainDialog::OnResizeStatisticsPanel(wxEvent& event) { - updateSizerOrientation(*bSizerStatistics, *m_panelStatistics); + //updateSizerOrientation(*bSizerStatistics, *m_panelStatistics); + + //we need something more fancy: + const int parentOrient = m_panelStatistics->GetSize().GetWidth() > m_panelStatistics->GetSize().GetHeight() ? wxHORIZONTAL : wxVERTICAL; //check window NOT sizer width! + if (bSizerStatistics->GetOrientation() != parentOrient) + { + bSizerStatistics->SetOrientation(parentOrient); + + //apply opposite orientation for child sizers + const int childOrient = parentOrient == wxHORIZONTAL ? wxVERTICAL : wxHORIZONTAL; + wxSizerItemList& sl = bSizerStatistics->GetChildren(); + for (auto iter = sl.begin(); iter != sl.end(); ++iter) //yet another wxWidgets bug keeps us from using std::for_each + { + wxSizerItem& szItem = **iter; + if (auto sizerChild = dynamic_cast<wxBoxSizer*>(szItem.GetSizer())) + if (sizerChild->GetOrientation() != childOrient) + sizerChild->SetOrientation(childOrient); + } + m_panelStatistics->Layout(); + } + event.Skip(); } @@ -2202,7 +2221,29 @@ void MainDialog::addFileToCfgHistory(const std::vector<wxString>& filenames) } -void MainDialog::OnSaveConfig(wxCommandEvent& event) +void MainDialog::OnConfigSave(wxCommandEvent& event) +{ + //if we work on a single named configuration document: save directly if changed + //else: always show file dialog + if (activeConfigFiles.size() == 1 && activeConfigFiles[0] != lastRunConfigName()) + { + const wxString filename = activeConfigFiles[0]; + + //don't overwrite .ffs_batch! + using namespace xmlAccess; + if (getXmlType(utfCvrtTo<Zstring>(filename)) == XML_TYPE_GUI) //throw() + { + if (lastConfigurationSaved != getConfig()) + trySaveConfig(&filename); + return; + } + } + + trySaveConfig(nullptr); +} + + +void MainDialog::OnConfigSaveAs(wxCommandEvent& event) { trySaveConfig(nullptr); } @@ -2239,7 +2280,7 @@ bool MainDialog::trySaveConfig(const wxString* fileName) //return true if saved xmlAccess::writeConfig(guiCfg, toZ(targetFilename)); //write config to XML setLastUsedConfig(targetFilename, guiCfg); - pushStatusInformation(_("Configuration saved!")); + flashStatusInformation(_("Configuration saved!")); return true; } catch (const xmlAccess::FfsXmlError& e) @@ -2250,7 +2291,51 @@ bool MainDialog::trySaveConfig(const wxString* fileName) //return true if saved } -void MainDialog::OnLoadConfig(wxCommandEvent& event) +bool MainDialog::saveOldConfig() //return false on user abort +{ + if (lastConfigurationSaved != getConfig()) + { + //notify user about changed settings + if (globalSettings->optDialogs.popupOnConfigChange) + if (activeConfigFiles.size() == 1 && activeConfigFiles[0] != lastRunConfigName()) + //only if check is active and non-default config file loaded + { + const wxString filename = activeConfigFiles[0]; + + bool neverSave = !globalSettings->optDialogs.popupOnConfigChange; + CheckBox cb(_("Never save changes"), neverSave); + + switch (showQuestionDlg(this, + ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_NO | ReturnQuestionDlg::BUTTON_CANCEL, + replaceCpy(_("Do you want to save changes to %x?"), L"%x", fmtFileName(afterLast(utfCvrtTo<Zstring>(filename), FILE_NAME_SEPARATOR))), + filename, //caption + _("Save"), _("Don't Save"), + &cb)) + { + case ReturnQuestionDlg::BUTTON_YES: + + using namespace xmlAccess; + return trySaveConfig(getXmlType(utfCvrtTo<Zstring>(filename)) == XML_TYPE_GUI ? //don't overwrite .ffs_batch! + &filename : + nullptr); + + case ReturnQuestionDlg::BUTTON_NO: + globalSettings->optDialogs.popupOnConfigChange = !neverSave; + break; + + case ReturnQuestionDlg::BUTTON_CANCEL: + return false; + } + } + + //discard current config selection, this ensures next app start will load <last session> instead of the original non-modified config selection + setLastUsedConfig(std::vector<wxString>(), getConfig()); + } + return true; +} + + +void MainDialog::OnConfigLoad(wxCommandEvent& event) { wxFileDialog filePicker(this, wxEmptyString, @@ -2270,7 +2355,7 @@ void MainDialog::OnLoadConfig(wxCommandEvent& event) } -void MainDialog::OnNewConfig(wxCommandEvent& event) +void MainDialog::OnConfigNew(wxCommandEvent& event) { if (!saveOldConfig()) //notify user about changed settings return; @@ -2305,45 +2390,6 @@ void MainDialog::OnLoadFromHistory(wxCommandEvent& event) } -bool MainDialog::saveOldConfig() //return false on user abort -{ - if (lastConfigurationSaved != getConfig()) - { - //notify user about changed settings - if (!globalSettings->optDialogs.popupOnConfigChange) - //discard current config selection, this ensures next app start will load <last session> instead of the original non-modified config selection - setLastUsedConfig(std::vector<wxString>(), getConfig()); - else if (activeConfigFiles.size() == 1 && activeConfigFiles[0] != lastRunConfigName() /*|| activeConfigFiles.size() > 1*/) - //only if check is active and non-default config file loaded - { - const wxString filename = activeConfigFiles[0]; - - bool neverSave = !globalSettings->optDialogs.popupOnConfigChange; - CheckBox cb(_("Never save changes"), neverSave); - - switch (showQuestionDlg(this, - ReturnQuestionDlg::BUTTON_YES | ReturnQuestionDlg::BUTTON_NO | ReturnQuestionDlg::BUTTON_CANCEL, - _("Save changes to current configuration?"), &cb)) - { - case ReturnQuestionDlg::BUTTON_YES: - return trySaveConfig(endsWith(filename, L".ffs_gui") ? &filename : nullptr); //don't overwrite .ffs_batch! - - case ReturnQuestionDlg::BUTTON_NO: - globalSettings->optDialogs.popupOnConfigChange = !neverSave; - //by choosing "no" user actively discards current config selection - //this ensures next app start will load <last session> instead of the original non-modified config selection - setLastUsedConfig(std::vector<wxString>(), getConfig()); - break; - - case ReturnQuestionDlg::BUTTON_CANCEL: - return false; - } - } - } - return true; -} - - void MainDialog::loadConfiguration(const wxString& filename) { std::vector<wxString> filenames; @@ -2369,7 +2415,7 @@ void MainDialog::loadConfiguration(const std::vector<wxString>& filenames) xmlAccess::convertConfig(toZ(filenames), newGuiCfg); //throw FfsXmlError setLastUsedConfig(filenames, newGuiCfg); - pushStatusInformation(_("Configuration loaded!")); + //flashStatusInformation(_("Configuration loaded!")); -> irrelvant!? } catch (const xmlAccess::FfsXmlError& error) { @@ -2434,7 +2480,7 @@ void MainDialog::OnClose(wxCloseEvent& event) const bool cancelled = !saveOldConfig(); //notify user about changed settings if (cancelled) { - //attention: this Veto() would NOT cancel system shutdown since saveOldConfig() shows modal dialog + //attention: this Veto() will NOT cancel system shutdown since saveOldConfig() blocks on modal dialog event.Veto(); return; @@ -2892,7 +2938,6 @@ void MainDialog::updateFilterButtons() void MainDialog::OnCompare(wxCommandEvent& event) { //PERF_START; - clearStatusBar(); wxBusyCursor dummy; //show hourglass cursor @@ -2961,7 +3006,7 @@ void MainDialog::OnCompare(wxCommandEvent& event) //prepare status information if (allElementsEqual(folderCmp)) - pushStatusInformation(_("All directories in sync!")); + flashStatusInformation(_("All directories in sync!")); } @@ -3097,8 +3142,6 @@ void MainDialog::OnStartSync(wxCommandEvent& event) if (folderCmp.empty()) //check if user aborted or error occured, ect... return; - //pushStatusInformation(_("Please run a Compare first before synchronizing!")); - //return; } //show sync preview screen @@ -3117,7 +3160,6 @@ void MainDialog::OnStartSync(wxCommandEvent& event) wxBusyCursor dummy; //show hourglass cursor - clearStatusBar(); try { //PERF_START; @@ -3421,8 +3463,6 @@ void MainDialog::updateGridViewData() //status bar wxWindowUpdateLocker dummy(m_panelStatusBar); //avoid display distortion - clearStatusBar(); - //################################################# //update status information bSizerStatusLeftDirectories->Show(foldersOnLeftView > 0); @@ -3440,7 +3480,7 @@ void MainDialog::updateGridViewData() replace(statusMiddleNew, L"%x", toGuiString(gridDataView->rowsOnView()), false); replace(statusMiddleNew, L"%y", toGuiString(gridDataView->rowsTotal ()), false); } - setText(*m_staticTextStatusMiddle, statusMiddleNew); + setStatusInformation(statusMiddleNew); } bSizerStatusRightDirectories->Show(foldersOnRightView > 0); @@ -3734,46 +3774,46 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) if (filePicker.ShowModal() != wxID_OK) return; - const wxString newFileName = filePicker.GetPath(); + const Zstring filename = utfCvrtTo<Zstring>(filePicker.GetPath()); - typedef Zbase<char> UtfString; //perf: wxString doesn't model exponential growth and so is out, std::string doesn't give performance guarantee! - UtfString exportString; + Utf8String buffer; //perf: wxString doesn't model exponential growth and so is out, std::string doesn't give performance guarantee! + buffer += BYTE_ORDER_MARK_UTF8; //write legend - exportString += utfCvrtTo<UtfString>(_("Legend")) + '\n'; + buffer += utfCvrtTo<Utf8String>(_("Legend")) + '\n'; if (showSyncAction_) { - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_EQUAL)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_EQUAL)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_CREATE_NEW_LEFT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_CREATE_NEW_LEFT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_CREATE_NEW_RIGHT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_CREATE_NEW_RIGHT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_OVERWRITE_LEFT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_OVERWRITE_LEFT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_OVERWRITE_RIGHT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_OVERWRITE_RIGHT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_DELETE_LEFT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_DELETE_LEFT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_DELETE_RIGHT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_DELETE_RIGHT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_DO_NOTHING)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_DO_NOTHING)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getSyncOpDescription(SO_UNRESOLVED_CONFLICT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(SO_UNRESOLVED_CONFLICT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_EQUAL)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_EQUAL)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_CREATE_NEW_LEFT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_CREATE_NEW_LEFT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_CREATE_NEW_RIGHT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_CREATE_NEW_RIGHT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_OVERWRITE_LEFT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_OVERWRITE_LEFT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_OVERWRITE_RIGHT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_OVERWRITE_RIGHT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_DELETE_LEFT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_DELETE_LEFT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_DELETE_RIGHT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_DELETE_RIGHT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_DO_NOTHING)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_DO_NOTHING)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getSyncOpDescription(SO_UNRESOLVED_CONFLICT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(SO_UNRESOLVED_CONFLICT)) + '\n'; } else { - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_EQUAL)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_EQUAL)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_DIFFERENT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_DIFFERENT)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_LEFT_SIDE_ONLY)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_LEFT_SIDE_ONLY)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_RIGHT_SIDE_ONLY)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_RIGHT_SIDE_ONLY)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_LEFT_NEWER)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_LEFT_NEWER)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_RIGHT_NEWER)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_RIGHT_NEWER)) + '\n'; - exportString += "\"" + utfCvrtTo<UtfString>(getCategoryDescription(FILE_CONFLICT)) + "\";" + utfCvrtTo<UtfString>(getSymbol(FILE_CONFLICT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_EQUAL)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_EQUAL)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_DIFFERENT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_DIFFERENT)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_LEFT_SIDE_ONLY)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_LEFT_SIDE_ONLY)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_RIGHT_SIDE_ONLY)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_RIGHT_SIDE_ONLY)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_LEFT_NEWER)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_LEFT_NEWER)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_RIGHT_NEWER)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_RIGHT_NEWER)) + '\n'; + buffer += "\"" + utfCvrtTo<Utf8String>(getCategoryDescription(FILE_CONFLICT)) + "\";" + utfCvrtTo<Utf8String>(getSymbol(FILE_CONFLICT)) + '\n'; } - exportString += '\n'; + buffer += '\n'; //base folders - exportString += utfCvrtTo<UtfString>(_("Folder pairs")) + '\n' ; + buffer += utfCvrtTo<Utf8String>(_("Folder pairs")) + '\n' ; std::for_each(begin(folderCmp), end(folderCmp), [&](BaseDirMapping& baseMap) { - exportString += utfCvrtTo<UtfString>(baseMap.getBaseDirPf<LEFT_SIDE >()) + ';'; - exportString += utfCvrtTo<UtfString>(baseMap.getBaseDirPf<RIGHT_SIDE>()) + '\n'; + buffer += utfCvrtTo<Utf8String>(baseMap.getBaseDirPf<LEFT_SIDE >()) + ';'; + buffer += utfCvrtTo<Utf8String>(baseMap.getBaseDirPf<RIGHT_SIDE>()) + '\n'; }); - exportString += '\n'; + buffer += '\n'; //write header auto provLeft = m_gridMain->getDataProvider(gridview::COMP_LEFT); @@ -3791,9 +3831,9 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) auto addCellValue = [&](const wxString& val) { if (val.find(L';') != wxString::npos) - exportString += '\"' + utfCvrtTo<UtfString>(val) + '\"'; + buffer += '\"' + utfCvrtTo<Utf8String>(val) + '\"'; else - exportString += utfCvrtTo<UtfString>(val); + buffer += utfCvrtTo<Utf8String>(val); }; if (provLeft && provMiddle && provRight) @@ -3802,13 +3842,13 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) [&](const Grid::ColumnAttribute& ca) { addCellValue(provLeft->getColumnLabel(ca.type_)); - exportString += ';'; + buffer += ';'; }); std::for_each(colAttrMiddle.begin(), colAttrMiddle.end(), [&](const Grid::ColumnAttribute& ca) { addCellValue(provMiddle->getColumnLabel(ca.type_)); - exportString += ';'; + buffer += ';'; }); if (!colAttrRight.empty()) { @@ -3816,11 +3856,11 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) [&](const Grid::ColumnAttribute& ca) { addCellValue(provRight->getColumnLabel(ca.type_)); - exportString += ';'; + buffer += ';'; }); addCellValue(provRight->getColumnLabel(colAttrRight.back().type_)); } - exportString += '\n'; + buffer += '\n'; //main grid const size_t rowCount = m_gridMain->getRowCount(); @@ -3830,13 +3870,13 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) [&](const Grid::ColumnAttribute& ca) { addCellValue(provLeft->getValue(row, ca.type_)); - exportString += ';'; + buffer += ';'; }); std::for_each(colAttrMiddle.begin(), colAttrMiddle.end(), [&](const Grid::ColumnAttribute& ca) { addCellValue(provMiddle->getValue(row, ca.type_)); - exportString += ';'; + buffer += ';'; }); if (!colAttrRight.empty()) { @@ -3844,23 +3884,26 @@ void MainDialog::OnMenuExportFileList(wxCommandEvent& event) [&](const Grid::ColumnAttribute& ca) { addCellValue(provRight->getValue(row, ca.type_)); - exportString += ';'; + buffer += ';'; }); addCellValue(provRight->getValue(row, colAttrRight.back().type_)); } - exportString += '\n'; + buffer += '\n'; } - //write export file - wxFFile output(newFileName.c_str(), L"w"); //don't write in binary mode - if (output.IsOpened()) + //write file + try + { + replace(buffer, '\n', LINE_BREAK); + + saveBinStream(filename, buffer); //throw FileError + + flashStatusInformation(_("File list exported!")); + } + catch (const FileError& e) { - output.Write(BYTE_ORDER_MARK_UTF8, sizeof(BYTE_ORDER_MARK_UTF8) - 1); - output.Write(exportString.c_str(), exportString.size()); - pushStatusInformation(_("File list exported!")); + wxMessageBox(e.toString(), _("Error"), wxOK | wxICON_ERROR, this); } - else - wxMessageBox(replaceCpy(_("Cannot write file %x."), L"%x", fmtFileName(toZ(newFileName))), _("Error"), wxOK | wxICON_ERROR, this); } } diff --git a/ui/main_dlg.h b/ui/main_dlg.h index b9f3fe0d..0e9a7830 100644 --- a/ui/main_dlg.h +++ b/ui/main_dlg.h @@ -112,8 +112,8 @@ private: void OnIdleEvent(wxEvent& event); //delayed status information restore - void pushStatusInformation(const wxString& text); - void clearStatusBar(); + void setStatusInformation(const wxString& msg); //set main status + void flashStatusInformation(const wxString& msg); //temporarily show different status //events void onGridButtonEvent (wxKeyEvent& event); @@ -159,9 +159,10 @@ private: void OnSyncDirRight( wxCommandEvent& event); void OnSyncDirNone( wxCommandEvent& event); - void OnNewConfig( wxCommandEvent& event); - void OnSaveConfig( wxCommandEvent& event); - void OnLoadConfig( wxCommandEvent& event); + void OnConfigNew( wxCommandEvent& event); + void OnConfigSave( wxCommandEvent& event); + void OnConfigSaveAs( wxCommandEvent& event); + void OnConfigLoad( wxCommandEvent& event); void OnLoadFromHistory( wxCommandEvent& event); void OnCfgHistoryKeyEvent( wxKeyEvent& event); @@ -242,7 +243,7 @@ private: //*********************************************** //status information wxLongLong lastStatusChange; - std::stack<wxString> stackObjects; + std::vector<wxString> statusMsgStack; //compare status panel (hidden on start, shown when comparing) std::unique_ptr<CompareStatus> compareStatus; //always bound diff --git a/ui/msg_popup.cpp b/ui/msg_popup.cpp index 142d2e9e..09bf24c9 100644 --- a/ui/msg_popup.cpp +++ b/ui/msg_popup.cpp @@ -9,179 +9,191 @@ #include <wx+/mouse_move_dlg.h> #include "gui_generated.h" - using namespace zen; -class ErrorDlg : public ErrorDlgGenerated +class ErrorDlg : public MessageDlgGenerated { public: ErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, + const wxString& caption, //optional bool* ignoreNextErrors); private: - void OnClose(wxCloseEvent& event); - void OnIgnore(wxCommandEvent& event); - void OnRetry(wxCommandEvent& event); - void OnAbort(wxCommandEvent& event); + void OnClose (wxCloseEvent& event) { EndModal(ReturnErrorDlg::BUTTON_CANCEL); } + void OnCancel(wxCommandEvent& event) { EndModal(ReturnErrorDlg::BUTTON_CANCEL); } + void OnButton1(wxCommandEvent& event); + void OnButton2(wxCommandEvent& event); bool* ignoreErrors; + wxButton& buttonIgnore; // + wxButton& buttonRetry; // map generic controls + wxCheckBox& checkBoxIgnoreErrors; // }; -ErrorDlg::ErrorDlg(wxWindow* parent, const int activeButtons, const wxString& messageText, bool* ignoreNextErrors) : - ErrorDlgGenerated(parent), - ignoreErrors(ignoreNextErrors) +ErrorDlg::ErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, const wxString& caption, bool* ignoreNextErrors) : + MessageDlgGenerated(parent), + ignoreErrors(ignoreNextErrors), + buttonIgnore(*m_buttonCustom1), + buttonRetry (*m_buttonCustom2), + checkBoxIgnoreErrors(*m_checkBoxCustom) { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getImage(L"error")); - m_textCtrl8->SetValue(messageText); + SetTitle(!caption.empty() ? caption : _("Error")); + m_bitmapMsgType->SetBitmap(GlobalResources::getImage(L"error")); + m_textCtrlMessage->SetValue(messageText); + checkBoxIgnoreErrors.SetLabel(_("Ignore further errors")); + buttonIgnore.SetLabel(_("&Ignore")); + buttonRetry .SetLabel(_("&Retry")); + buttonIgnore.SetId(wxID_IGNORE); + buttonRetry .SetId(wxID_RETRY); if (ignoreNextErrors) - m_checkBoxIgnoreErrors->SetValue(*ignoreNextErrors); + checkBoxIgnoreErrors.SetValue(*ignoreNextErrors); else - m_checkBoxIgnoreErrors->Hide(); + checkBoxIgnoreErrors.Hide(); if (~activeButtons & ReturnErrorDlg::BUTTON_IGNORE) { - m_buttonIgnore->Hide(); - m_checkBoxIgnoreErrors->Hide(); + buttonIgnore.Hide(); + checkBoxIgnoreErrors.Hide(); } if (~activeButtons & ReturnErrorDlg::BUTTON_RETRY) - m_buttonRetry->Hide(); + buttonRetry.Hide(); - if (~activeButtons & ReturnErrorDlg::BUTTON_ABORT) - m_buttonAbort->Hide(); + if (~activeButtons & ReturnErrorDlg::BUTTON_CANCEL) + m_buttonCancel->Hide(); //set button focus precedence if (activeButtons & ReturnErrorDlg::BUTTON_RETRY) - m_buttonRetry->SetFocus(); + buttonRetry.SetFocus(); else if (activeButtons & ReturnErrorDlg::BUTTON_IGNORE) - m_buttonIgnore->SetFocus(); - else if (activeButtons & ReturnErrorDlg::BUTTON_ABORT) - m_buttonAbort->SetFocus(); + buttonIgnore.SetFocus(); + else if (activeButtons & ReturnErrorDlg::BUTTON_CANCEL) + m_buttonCancel->SetFocus(); Fit(); //child-element widths have changed: image was set } -void ErrorDlg::OnClose(wxCloseEvent& event) -{ - EndModal(ReturnErrorDlg::BUTTON_ABORT); -} - - -void ErrorDlg::OnIgnore(wxCommandEvent& event) +void ErrorDlg::OnButton1(wxCommandEvent& event) //ignore { - if (ignoreErrors) *ignoreErrors = m_checkBoxIgnoreErrors->GetValue(); + if (ignoreErrors) + *ignoreErrors = checkBoxIgnoreErrors.GetValue(); EndModal(ReturnErrorDlg::BUTTON_IGNORE); } -void ErrorDlg::OnRetry(wxCommandEvent& event) +void ErrorDlg::OnButton2(wxCommandEvent& event) //retry { - if (ignoreErrors) *ignoreErrors = m_checkBoxIgnoreErrors->GetValue(); + if (ignoreErrors) + *ignoreErrors = checkBoxIgnoreErrors.GetValue(); EndModal(ReturnErrorDlg::BUTTON_RETRY); } -void ErrorDlg::OnAbort(wxCommandEvent& event) +ReturnErrorDlg::ButtonPressed zen::showErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool* ignoreNextErrors) { - if (ignoreErrors) *ignoreErrors = m_checkBoxIgnoreErrors->GetValue(); - EndModal(ReturnErrorDlg::BUTTON_ABORT); + ErrorDlg errorDlg(parent, activeButtons, messageText, wxString(), ignoreNextErrors); + errorDlg.Raise(); + return static_cast<ReturnErrorDlg::ButtonPressed>(errorDlg.ShowModal()); } +//######################################################################################## -ReturnErrorDlg::ButtonPressed zen::showErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool* ignoreNextErrors) +ReturnFatalErrorDlg::ButtonPressed zen::showFatalErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool* ignoreNextErrors) { - ErrorDlg errorDlg(parent, activeButtons, messageText, ignoreNextErrors); + ErrorDlg errorDlg(parent, activeButtons, messageText, _("Fatal Error"), ignoreNextErrors); errorDlg.Raise(); - return static_cast<ReturnErrorDlg::ButtonPressed>(errorDlg.ShowModal()); + return static_cast<ReturnFatalErrorDlg::ButtonPressed>(errorDlg.ShowModal()); } -//######################################################################################## +//######################################################################################## -class WarningDlg : public WarningDlgGenerated +class WarningDlg : public MessageDlgGenerated { public: WarningDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool& dontShowAgain); private: - void OnClose(wxCloseEvent& event); - void OnIgnore(wxCommandEvent& event); - void OnSwitch(wxCommandEvent& event); - void OnAbort(wxCommandEvent& event); + void OnClose (wxCloseEvent& event) { EndModal(ReturnWarningDlg::BUTTON_CANCEL); } + void OnCancel(wxCommandEvent& event) { EndModal(ReturnWarningDlg::BUTTON_CANCEL); } + void OnButton1(wxCommandEvent& event); + void OnButton2(wxCommandEvent& event); + bool& dontShowAgain; + wxButton& buttonIgnore; // + wxButton& buttonSwitch; // map generic controls + wxCheckBox& checkBoxDontShowAgain; // }; WarningDlg::WarningDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool& dontShowDlgAgain) : - WarningDlgGenerated(parent), - dontShowAgain(dontShowDlgAgain) + MessageDlgGenerated(parent), + dontShowAgain(dontShowDlgAgain), + buttonIgnore(*m_buttonCustom1), + buttonSwitch(*m_buttonCustom2), + checkBoxDontShowAgain(*m_checkBoxCustom) + { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getImage(L"warning")); - m_textCtrl8->SetValue(messageText); - m_checkBoxDontShowAgain->SetValue(dontShowAgain); + SetTitle(_("Warning")); + m_bitmapMsgType->SetBitmap(GlobalResources::getImage(L"warning")); + m_textCtrlMessage->SetValue(messageText); + checkBoxDontShowAgain.SetLabel(_("Do not show this dialog again")); + buttonIgnore.SetLabel(_("&Ignore")); + buttonSwitch.SetLabel(_("&Switch")); + buttonIgnore.SetId(wxID_IGNORE); + buttonSwitch.SetId(wxID_MORE); + + checkBoxDontShowAgain.SetValue(dontShowAgain); if (~activeButtons & ReturnWarningDlg::BUTTON_IGNORE) { - m_buttonIgnore->Hide(); - m_checkBoxDontShowAgain->Hide(); + buttonIgnore.Hide(); + checkBoxDontShowAgain.Hide(); } if (~activeButtons & ReturnWarningDlg::BUTTON_SWITCH) - m_buttonSwitch->Hide(); + buttonSwitch.Hide(); - if (~activeButtons & ReturnWarningDlg::BUTTON_ABORT) - m_buttonAbort->Hide(); + if (~activeButtons & ReturnWarningDlg::BUTTON_CANCEL) + m_buttonCancel->Hide(); //set button focus precedence if (activeButtons & ReturnWarningDlg::BUTTON_IGNORE) - m_buttonIgnore->SetFocus(); - else if (activeButtons & ReturnWarningDlg::BUTTON_ABORT) - m_buttonAbort->SetFocus(); + buttonIgnore.SetFocus(); + else if (activeButtons & ReturnWarningDlg::BUTTON_CANCEL) + m_buttonCancel->SetFocus(); Fit(); //child-element widths have changed: image was set } -void WarningDlg::OnClose(wxCloseEvent& event) -{ - EndModal(ReturnWarningDlg::BUTTON_ABORT); -} - - -void WarningDlg::OnIgnore(wxCommandEvent& event) +void WarningDlg::OnButton1(wxCommandEvent& event) //ignore { - dontShowAgain = m_checkBoxDontShowAgain->GetValue(); + dontShowAgain = checkBoxDontShowAgain.GetValue(); EndModal(ReturnWarningDlg::BUTTON_IGNORE); } -void WarningDlg::OnSwitch(wxCommandEvent& event) +void WarningDlg::OnButton2(wxCommandEvent& event) //switch { - dontShowAgain = m_checkBoxDontShowAgain->GetValue(); + dontShowAgain = checkBoxDontShowAgain.GetValue(); EndModal(ReturnWarningDlg::BUTTON_SWITCH); } -void WarningDlg::OnAbort(wxCommandEvent& event) -{ - dontShowAgain = m_checkBoxDontShowAgain->GetValue(); - EndModal(ReturnWarningDlg::BUTTON_ABORT); -} - - ReturnWarningDlg::ButtonPressed zen::showWarningDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool& dontShowAgain) { WarningDlg warningDlg(parent, activeButtons, messageText, dontShowAgain); @@ -191,77 +203,98 @@ ReturnWarningDlg::ButtonPressed zen::showWarningDlg(wxWindow* parent, int active //######################################################################################## -class QuestionDlg : public QuestionDlgGenerated +class QuestionDlg : public MessageDlgGenerated { public: - QuestionDlg(wxWindow* parent, int activeButtons, const wxString& messageText, CheckBox* checkbox); + QuestionDlg(wxWindow* parent, int activeButtons, const wxString& messageText, const wxString& caption, const wxString& labelYes, const wxString& labelNo, CheckBox* checkbox); private: void OnClose (wxCloseEvent& event) { EndModal(ReturnQuestionDlg::BUTTON_CANCEL); } void OnCancel(wxCommandEvent& event) { EndModal(ReturnQuestionDlg::BUTTON_CANCEL); } - void OnYes(wxCommandEvent& event); - void OnNo (wxCommandEvent& event); + void OnButton1(wxCommandEvent& event); + void OnButton2(wxCommandEvent& event); CheckBox* checkbox_; //optional + wxButton& buttonYes; // map generic controls + wxButton& buttonNo; // }; -QuestionDlg::QuestionDlg(wxWindow* parent, int activeButtons, const wxString& messageText, CheckBox* checkbox) : - QuestionDlgGenerated(parent), - checkbox_(checkbox) +QuestionDlg::QuestionDlg(wxWindow* parent, + int activeButtons, + const wxString& messageText, + const wxString& caption, //optional + const wxString& labelYes, + const wxString& labelNo, + CheckBox* checkbox) : + MessageDlgGenerated(parent), + checkbox_(checkbox), + buttonYes(*m_buttonCustom1), + buttonNo (*m_buttonCustom2) { #ifdef FFS_WIN new zen::MouseMoveWindow(*this); //allow moving main dialog by clicking (nearly) anywhere...; ownership passed to "this" #endif - m_bitmap10->SetBitmap(GlobalResources::getImage(L"question")); - m_textCtrl8->SetValue(messageText); + SetTitle(!caption.empty()? caption : _("Question")); + m_bitmapMsgType->SetBitmap(GlobalResources::getImage(L"question")); + m_textCtrlMessage->SetValue(messageText); + buttonYes.SetLabel(!labelYes.empty() ? labelYes : _("&Yes")); + buttonNo .SetLabel(!labelNo .empty() ? labelNo : _("&No")); + buttonYes.SetId(wxID_YES); + buttonNo .SetId(wxID_NO); if (checkbox_) { - m_checkBox->SetValue(checkbox_->value_); - m_checkBox->SetLabel(checkbox_->label_); + m_checkBoxCustom->SetValue(checkbox_->value_); + m_checkBoxCustom->SetLabel(checkbox_->label_); } else - m_checkBox->Hide(); + m_checkBoxCustom->Hide(); if (~activeButtons & ReturnQuestionDlg::BUTTON_YES) - m_buttonYes->Hide(); + buttonYes.Hide(); if (~activeButtons & ReturnQuestionDlg::BUTTON_NO) - m_buttonNo->Hide(); + buttonNo.Hide(); if (~activeButtons & ReturnQuestionDlg::BUTTON_CANCEL) m_buttonCancel->Hide(); //set button focus precedence if (activeButtons & ReturnQuestionDlg::BUTTON_YES) - m_buttonYes->SetFocus(); + buttonYes.SetFocus(); else if (activeButtons & ReturnQuestionDlg::BUTTON_CANCEL) m_buttonCancel->SetFocus(); else if (activeButtons & ReturnQuestionDlg::BUTTON_NO) - m_buttonNo->SetFocus(); + buttonNo.SetFocus(); Fit(); //child-element widths have changed: image was set } -void QuestionDlg::OnYes(wxCommandEvent& event) +void QuestionDlg::OnButton1(wxCommandEvent& event) //yes { if (checkbox_) - checkbox_->value_ = m_checkBox->GetValue(); + checkbox_->value_ = m_checkBoxCustom->GetValue(); EndModal(ReturnQuestionDlg::BUTTON_YES); } -void QuestionDlg::OnNo(wxCommandEvent& event) +void QuestionDlg::OnButton2(wxCommandEvent& event) //no { if (checkbox_) - checkbox_->value_ = m_checkBox->GetValue(); + checkbox_->value_ = m_checkBoxCustom->GetValue(); EndModal(ReturnQuestionDlg::BUTTON_NO); } -ReturnQuestionDlg::ButtonPressed zen::showQuestionDlg(wxWindow* parent, int activeButtons, const wxString& messageText, CheckBox* checkbox) + +ReturnQuestionDlg::ButtonPressed zen::showQuestionDlg(wxWindow* parent, + int activeButtons, + const wxString& messageText, + const wxString& caption, //optional + const wxString& labelYes, const wxString& labelNo, + CheckBox* checkbox) { - QuestionDlg qtnDlg(parent, activeButtons, messageText, checkbox); + QuestionDlg qtnDlg(parent, activeButtons, messageText, caption, labelYes, labelNo, checkbox); qtnDlg.Raise(); return static_cast<ReturnQuestionDlg::ButtonPressed>(qtnDlg.ShowModal()); } diff --git a/ui/msg_popup.h b/ui/msg_popup.h index 19a3c84f..48a4e8cb 100644 --- a/ui/msg_popup.h +++ b/ui/msg_popup.h @@ -21,19 +21,30 @@ struct ReturnErrorDlg { BUTTON_IGNORE = 1, BUTTON_RETRY = 2, - BUTTON_ABORT = 4 + BUTTON_CANCEL = 4 }; }; ReturnErrorDlg::ButtonPressed showErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool* ignoreNextErrors); //ignoreNextErrors may be nullptr +struct ReturnFatalErrorDlg +{ + enum ButtonPressed + { + BUTTON_IGNORE = ReturnErrorDlg::BUTTON_IGNORE, + BUTTON_CANCEL = ReturnErrorDlg::BUTTON_CANCEL + }; +}; +ReturnFatalErrorDlg::ButtonPressed showFatalErrorDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool* ignoreNextErrors); //ignoreNextErrors may be nullptr + + struct ReturnWarningDlg { enum ButtonPressed { BUTTON_IGNORE = 1, BUTTON_SWITCH = 2, - BUTTON_ABORT = 4 + BUTTON_CANCEL = 4 }; }; ReturnWarningDlg::ButtonPressed showWarningDlg(wxWindow* parent, int activeButtons, const wxString& messageText, bool& dontShowAgain); @@ -57,7 +68,13 @@ struct CheckBox bool& value_; //in/out }; -ReturnQuestionDlg::ButtonPressed showQuestionDlg(wxWindow* parent, int activeButtons, const wxString& messageText, CheckBox* checkbox = nullptr); +ReturnQuestionDlg::ButtonPressed showQuestionDlg(wxWindow* parent, + int activeButtons, + const wxString& messageText, + const wxString& caption = wxString(), + const wxString& labelYes = wxString(), //overwrite default "Yes, No" labels + const wxString& labelNo = wxString(), // + CheckBox* checkbox = nullptr); } #endif // MESSAGEPOPUP_H_INCLUDED diff --git a/ui/small_dlgs.cpp b/ui/small_dlgs.cpp index 0dd85593..bfe8de9c 100644 --- a/ui/small_dlgs.cpp +++ b/ui/small_dlgs.cpp @@ -9,7 +9,6 @@ #include "msg_popup.h" #include "../lib/resources.h" #include "../algorithm.h" -#include <wx+/string_conv.h> #include <wx+/format_unit.h> #include <wx+/choice_enum.h> #include "../synchronization.h" @@ -25,6 +24,7 @@ #include <wx+/image_tools.h> #include <zen/stl_tools.h> #include "../lib/hard_filter.h" +#include "../version/version.h" using namespace zen; @@ -44,7 +44,6 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) { m_bitmap9 ->SetBitmap(GlobalResources::getImage(L"website")); m_bitmap10->SetBitmap(GlobalResources::getImage(L"email")); - m_bitmap11->SetBitmap(GlobalResources::getImage(L"logo")); m_bitmap13->SetBitmap(GlobalResources::getImage(L"gpl")); //m_bitmapTransl->SetBitmap(GlobalResources::getImage(wxT("translation"))); m_bitmapPaypal->SetBitmap(GlobalResources::getImage(L"paypal")); @@ -71,6 +70,9 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) bSizerTranslators->Fit(m_scrolledWindowTranslators); +#ifdef FFS_WIN + new zen::MouseMoveWindow(*this); //-> put *after* creating credits +#endif //build information wxString build = __TDATE__; @@ -92,12 +94,33 @@ AboutDlg::AboutDlg(wxWindow* parent) : AboutDlgGenerated(parent) //m_animationControl1->SetAnimation(GlobalResources::instance().animationMoney); //m_animationControl1->Play(); - m_buttonOkay->SetFocus(); Fit(); //child-element widths have changed: image was set -#ifdef FFS_WIN - new zen::MouseMoveWindow(*this); //-> put *after* creating credit control -#endif + //generate logo + //-> put *after* first Fit() + Layout(); //make sure m_panelLogo has final width (required by wxGTK) + + wxBitmap bmpLogo; + { + wxImage tmp = GlobalResources::getImage(L"logo").ConvertToImage(); + tmp.Resize(wxSize(m_panelLogo->GetClientSize().GetWidth(), tmp.GetHeight()), wxPoint(0, 0), 255, 255, 255); //enlarge to fit full width + bmpLogo = wxBitmap(tmp); + } + { + wxMemoryDC dc; + dc.SelectObject(bmpLogo); + + dc.SetTextForeground(*wxBLACK); + dc.SetFont(wxFont(18, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, L"Tahoma")); + dc.DrawLabel(wxString(L"FreeFileSync ") + zen::currentVersion, wxNullBitmap, wxRect(0, 0, bmpLogo.GetWidth(), bmpLogo.GetHeight()), wxALIGN_CENTER); + + dc.SelectObject(wxNullBitmap); + } + m_bitmap11->SetBitmap(bmpLogo); + + Fit(); //child-element widths have changed: image was set + + m_buttonOkay->SetFocus(); } @@ -170,7 +193,7 @@ FilterDlg::FilterDlg(wxWindow* parent, add(USIZE_KB, _("KB")). add(USIZE_MB, _("MB")); - m_bitmap26->SetBitmap(GlobalResources::getImage(L"filterOn")); + m_bitmap26->SetBitmap(GlobalResources::getImage(L"filter")); m_bpButtonHelp->SetBitmapLabel(GlobalResources::getImage(L"help")); setFilter(filter); diff --git a/ui/sync_cfg.cpp b/ui/sync_cfg.cpp index b88d40f0..794569cc 100644 --- a/ui/sync_cfg.cpp +++ b/ui/sync_cfg.cpp @@ -10,7 +10,6 @@ #include "dir_name.h" #include <wx/wupdlock.h> #include <wx+/mouse_move_dlg.h> -#include <wx+/string_conv.h> #include <wx+/dir_picker.h> #include <wx+/rtl.h> #include "gui_generated.h" @@ -223,7 +222,7 @@ SyncCfgDialog::SyncCfgDialog(wxWindow* parent, //a proper set-method may be in order some time... setEnumVal(enumDelhandDescr, *m_choiceHandleDeletion, syncCfg.handleDeletion); - customDelFolder.setName(toWx(syncCfg.customDeletionDirectory)); + customDelFolder.setName(utfCvrtTo<wxString>(syncCfg.customDeletionDirectory)); updateGui(); //error handling @@ -353,7 +352,7 @@ void SyncCfgDialog::OnApply(wxCommandEvent& event) //write configuration to main dialog syncCfgOut.directionCfg = currentDirectionCfg; syncCfgOut.handleDeletion = getEnumVal(enumDelhandDescr, *m_choiceHandleDeletion); - syncCfgOut.customDeletionDirectory = toZ(customDelFolder.getName()); + syncCfgOut.customDeletionDirectory = utfCvrtTo<Zstring>(customDelFolder.getName()); if (refHandleError) *refHandleError = getEnumVal(enumErrhandDescr, *m_choiceHandleError); |