--- Vago/trunk/Vago/utilvago.cpp 2016/09/17 13:32:34 1052 +++ s10k/Vago/utilvago.cpp 2017/12/30 13:57:32 1093 @@ -6,9 +6,47 @@ void openLogFile(){ QDesktopServices::openUrl(QUrl("file:///"+getAppPath()+"/"+GlobalVars::AppLogName)); } -void showAndLogErrorPopUp(Logger *logger, const QString &message){ +void showAndLogWarningPopUp(const QString &message){ + LOG_WARNING << message; - logger->writeString(message); + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText(message); + msgBox.exec(); +} + +//Same of above but allow open log file (doesn't write in log file!!) +void showWarningPopUpLogButton(const QString &message){ + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText(message); + QPushButton *viewb = msgBox.addButton("View log", QMessageBox::ActionRole); + msgBox.setStandardButtons(QMessageBox::Close); + msgBox.exec(); + if(msgBox.clickedButton() == (QAbstractButton*)(viewb)){ + openLogFile(); + } +} + +//Same of above but also writtes directly to the log file the error +void showAndLogWarningPopUpLogButton(const QString &message){ + + LOG_WARNING << message; + + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText(message); + QPushButton *viewb = msgBox.addButton("View log", QMessageBox::ActionRole); + msgBox.setStandardButtons(QMessageBox::Close); + msgBox.exec(); + if(msgBox.clickedButton() == (QAbstractButton*)(viewb)){ + openLogFile(); + } +} + +void showAndLogErrorPopUp(const QString &message){ + + LOG_ERROR << message; QMessageBox msgBox; msgBox.setIcon(QMessageBox::Critical); @@ -30,9 +68,9 @@ void showErrorPopUpLogButton(const QStri } //Same of above but also writtes directly to the log file the error -void showAndLogErrorPopUpLogButton(Logger *logger, const QString &message){ +void showAndLogErrorPopUpLogButton(const QString &message){ - logger->writeString(message); + LOG_ERROR << message; QMessageBox msgBox; msgBox.setIcon(QMessageBox::Critical); @@ -79,14 +117,14 @@ QString getXmlToolsExecutableAbsolutePat QString getOniSplitExecutable(){ #ifdef Q_OS_MAC - return getMonoExecutablePath() + " " + getOniSplitExecutableAbsolutePath(); + return getMonoExecutablePath() + " " + Util::String::insertQuotes(getOniSplitExecutableAbsolutePath()); #else - return getOniSplitExecutableAbsolutePath(); + return Util::String::insertQuotes(getOniSplitExecutableAbsolutePath()); #endif } QString getXmlToolsExecutable(){ - return getXmlToolsExecutableAbsolutePath(); + return Util::String::insertQuotes(getXmlToolsExecutableAbsolutePath()); } #ifdef Q_OS_MAC @@ -105,4 +143,8 @@ QString getMonoExecutablePath(){ } #endif +QString getDateTimeFormatForFilename(const QDateTime ¤tDateTime){ + return currentDateTime.toString("yyyy-MM-dd_hh-mm-ss"); +} + }