From ca24b201e19630039c68006e97b3d9788afc5875 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 9 Dec 2015 13:31:33 +0200 Subject: [PATCH] Refactor the method name. --HG-- branch : develop --- src/app/valentina/core/vapplication.cpp | 6 +-- src/app/valentina/core/vapplication.h | 2 +- .../valentina/dialogs/dialogsavelayout.cpp | 2 +- src/app/valentina/mainwindow.cpp | 48 +++++++++---------- src/app/valentina/mainwindowsnogui.cpp | 6 +-- src/app/valentina/xml/vpattern.cpp | 12 ++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index e68906f3c..82e4a83d4 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -186,7 +186,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) { - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { if (topWinAllowsPop) { @@ -541,7 +541,7 @@ void VApplication::InitOptions() qDebug()<<"Command-line arguments:"<arguments(); qDebug()<<"Process ID:"<applicationPid(); - if (VApplication::CheckGUI())// By default console version uses system locale + if (VApplication::IsGUIMode())// By default console version uses system locale { LoadTranslation(ValentinaSettings()->GetLocale()); } @@ -666,7 +666,7 @@ VSettings *VApplication::ValentinaSettings() } //--------------------------------------------------------------------------------------------------------------------- -bool VApplication::CheckGUI() +bool VApplication::IsGUIMode() { return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsGuiEnabled(); } diff --git a/src/app/valentina/core/vapplication.h b/src/app/valentina/core/vapplication.h index b87b27a18..6f3bd27e3 100644 --- a/src/app/valentina/core/vapplication.h +++ b/src/app/valentina/core/vapplication.h @@ -77,7 +77,7 @@ public: static void DrMingw(); void CollectReports() const; #endif // defined(Q_OS_WIN) && defined(Q_CC_GNU) - bool static CheckGUI(); + bool static IsGUIMode(); virtual void OpenSettings() Q_DECL_OVERRIDE; VSettings *ValentinaSettings(); diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index d5378ae12..2faf6a0b9 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -68,7 +68,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget * #endif const QString mask = fileName+QLatin1Literal("_"); - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { ui->lineEditFileName->setText(mask); } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 45955fd2c..c6664c430 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -364,7 +364,7 @@ QSharedPointer MainWindow::OpenMeasurementFile(const QString &pat qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Wrong units.")), qUtf8Printable(tr("Application doesn't support standard table with inches."))); m->clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_DATAERR); } @@ -377,7 +377,7 @@ QSharedPointer MainWindow::OpenMeasurementFile(const QString &pat qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); m->clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -413,7 +413,7 @@ bool MainWindow::LoadMeasurements(const QString &path) { qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -435,7 +435,7 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height) if (qApp->patternType() != m->Type()) { qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match."))); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_DATAERR); } @@ -457,7 +457,7 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height) { qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2286,7 +2286,7 @@ void MainWindow::FullParseFile() qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2297,7 +2297,7 @@ void MainWindow::FullParseFile() qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2308,7 +2308,7 @@ void MainWindow::FullParseFile() qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2319,7 +2319,7 @@ void MainWindow::FullParseFile() qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2330,7 +2330,7 @@ void MainWindow::FullParseFile() qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2340,7 +2340,7 @@ void MainWindow::FullParseFile() { qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc)."))); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2384,7 +2384,7 @@ void MainWindow::GlobalChangePP(const QString &patternPiece) qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Bad id.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -2395,7 +2395,7 @@ void MainWindow::GlobalChangePP(const QString &patternPiece) qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3368,7 +3368,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); Clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3388,7 +3388,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu qCDebug(vMainWindow, "Error type: %d", lock->GetLockError()); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("This file already opened in another window."))); Clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3428,7 +3428,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu Clear(); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.") .arg(path))); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3441,7 +3441,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu .arg(newPath))); qApp->setOpeningPattern();// End opening file Clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3463,7 +3463,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qApp->setOpeningPattern();// End opening file Clear(); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -3639,7 +3639,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS QFileInfo table(path); if (table.exists() == false) { - if (!qApp->CheckGUI()) + if (!qApp->IsGUIMode()) { return QString();// console mode doesn't support fixing path to a measurement file } @@ -3856,7 +3856,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::SetSize(const QString &text) { - if (not qApp->CheckGUI()) + if (not qApp->IsGUIMode()) { if (this->isWindowModified() || not curFile.isEmpty()) { @@ -3894,7 +3894,7 @@ void MainWindow::SetSize(const QString &text) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::SetHeight(const QString &text) { - if (not qApp->CheckGUI()) + if (not qApp->IsGUIMode()) { if (this->isWindowModified() || not curFile.isEmpty()) { @@ -3936,7 +3936,7 @@ void MainWindow::ProcessCMD() auto args = cmd->OptInputFileNames(); //Before we load pattern show window. - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { show(); ReopenFilesAfterCrash(args); @@ -3955,7 +3955,7 @@ void MainWindow::ProcessCMD() { const bool loaded = LoadPattern(args.at(static_cast(i)), cmd->OptMeasurePath()); - if (not loaded && not VApplication::CheckGUI()) + if (not loaded && not VApplication::IsGUIMode()) { return; // process only one input file } @@ -3987,7 +3987,7 @@ void MainWindow::ProcessCMD() } } - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_OK);// close program after processing in console mode } diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 8c1c301e4..8f37e420f 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -104,7 +104,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator) { lGenerator.SetDetails(listDetails); DialogLayoutProgress progress(listDetails.count(), this); - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start); connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged); @@ -134,7 +134,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator) margins = lGenerator.GetFields(); paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight()); isLayoutStale = false; - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { QApplication::alert(this); } @@ -142,7 +142,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator) case LayoutErrors::ProcessStoped: case LayoutErrors::PrepareLayoutError: case LayoutErrors::EmptyPaperError: - if (VApplication::CheckGUI()) + if (VApplication::IsGUIMode()) { QApplication::alert(this); } diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 196510b84..2ffd7e561 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -358,7 +358,7 @@ void VPattern::LiteParseTree(const Document &parse) qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807 qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -369,7 +369,7 @@ void VPattern::LiteParseTree(const Document &parse) qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -380,7 +380,7 @@ void VPattern::LiteParseTree(const Document &parse) qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -391,7 +391,7 @@ void VPattern::LiteParseTree(const Document &parse) qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -402,7 +402,7 @@ void VPattern::LiteParseTree(const Document &parse) qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); } @@ -412,7 +412,7 @@ void VPattern::LiteParseTree(const Document &parse) { qCCritical(vXML, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc)."))); emit SetEnabledGUI(false); - if (not VApplication::CheckGUI()) + if (not VApplication::IsGUIMode()) { qApp->exit(V_EX_NOINPUT); }