Refactor the method name.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-09 13:31:33 +02:00
parent da827ad952
commit ca24b201e1
6 changed files with 38 additions and 38 deletions

View File

@ -186,7 +186,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
{ {
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
if (topWinAllowsPop) if (topWinAllowsPop)
{ {
@ -541,7 +541,7 @@ void VApplication::InitOptions()
qDebug()<<"Command-line arguments:"<<this->arguments(); qDebug()<<"Command-line arguments:"<<this->arguments();
qDebug()<<"Process ID:"<<this->applicationPid(); qDebug()<<"Process ID:"<<this->applicationPid();
if (VApplication::CheckGUI())// By default console version uses system locale if (VApplication::IsGUIMode())// By default console version uses system locale
{ {
LoadTranslation(ValentinaSettings()->GetLocale()); LoadTranslation(ValentinaSettings()->GetLocale());
} }
@ -666,7 +666,7 @@ VSettings *VApplication::ValentinaSettings()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VApplication::CheckGUI() bool VApplication::IsGUIMode()
{ {
return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsGuiEnabled(); return (VCommandLine::instance != nullptr) && VCommandLine::instance->IsGuiEnabled();
} }

View File

@ -77,7 +77,7 @@ public:
static void DrMingw(); static void DrMingw();
void CollectReports() const; void CollectReports() const;
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU) #endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
bool static CheckGUI(); bool static IsGUIMode();
virtual void OpenSettings() Q_DECL_OVERRIDE; virtual void OpenSettings() Q_DECL_OVERRIDE;
VSettings *ValentinaSettings(); VSettings *ValentinaSettings();

View File

@ -68,7 +68,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
#endif #endif
const QString mask = fileName+QLatin1Literal("_"); const QString mask = fileName+QLatin1Literal("_");
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
ui->lineEditFileName->setText(mask); ui->lineEditFileName->setText(mask);
} }

View File

@ -364,7 +364,7 @@ QSharedPointer<VMeasurements> MainWindow::OpenMeasurementFile(const QString &pat
qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Wrong units.")), qCCritical(vMainWindow, "%s\n\n%s", qUtf8Printable(tr("Wrong units.")),
qUtf8Printable(tr("Application doesn't support standard table with inches."))); qUtf8Printable(tr("Application doesn't support standard table with inches.")));
m->clear(); m->clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_DATAERR); qApp->exit(V_EX_DATAERR);
} }
@ -377,7 +377,7 @@ QSharedPointer<VMeasurements> MainWindow::OpenMeasurementFile(const QString &pat
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
m->clear(); m->clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -435,7 +435,7 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height)
if (qApp->patternType() != m->Type()) if (qApp->patternType() != m->Type())
{ {
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match."))); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match.")));
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_DATAERR); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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 qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -2340,7 +2340,7 @@ void MainWindow::FullParseFile()
{ {
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc)."))); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc).")));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Bad id.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
SetEnabledGUI(false); SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
Clear(); Clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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()); qCDebug(vMainWindow, "Error type: %d", lock->GetLockError());
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("This file already opened in another window."))); qCCritical(vMainWindow, "%s", qUtf8Printable(tr("This file already opened in another window.")));
Clear(); Clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -3428,7 +3428,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
Clear(); Clear();
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.") qCCritical(vMainWindow, "%s", qUtf8Printable(tr("The measurements file '%1' could not be found.")
.arg(path))); .arg(path)));
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -3441,7 +3441,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
.arg(newPath))); .arg(newPath)));
qApp->setOpeningPattern();// End opening file qApp->setOpeningPattern();// End opening file
Clear(); Clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -3463,7 +3463,7 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
qApp->setOpeningPattern();// End opening file qApp->setOpeningPattern();// End opening file
Clear(); Clear();
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }
@ -3639,7 +3639,7 @@ QString MainWindow::CheckPathToMeasurements(const QString &patternPath, const QS
QFileInfo table(path); QFileInfo table(path);
if (table.exists() == false) if (table.exists() == false)
{ {
if (!qApp->CheckGUI()) if (!qApp->IsGUIMode())
{ {
return QString();// console mode doesn't support fixing path to a measurement file 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) void MainWindow::SetSize(const QString &text)
{ {
if (not qApp->CheckGUI()) if (not qApp->IsGUIMode())
{ {
if (this->isWindowModified() || not curFile.isEmpty()) if (this->isWindowModified() || not curFile.isEmpty())
{ {
@ -3894,7 +3894,7 @@ void MainWindow::SetSize(const QString &text)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetHeight(const QString &text) void MainWindow::SetHeight(const QString &text)
{ {
if (not qApp->CheckGUI()) if (not qApp->IsGUIMode())
{ {
if (this->isWindowModified() || not curFile.isEmpty()) if (this->isWindowModified() || not curFile.isEmpty())
{ {
@ -3936,7 +3936,7 @@ void MainWindow::ProcessCMD()
auto args = cmd->OptInputFileNames(); auto args = cmd->OptInputFileNames();
//Before we load pattern show window. //Before we load pattern show window.
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
show(); show();
ReopenFilesAfterCrash(args); ReopenFilesAfterCrash(args);
@ -3955,7 +3955,7 @@ void MainWindow::ProcessCMD()
{ {
const bool loaded = LoadPattern(args.at(static_cast<int>(i)), cmd->OptMeasurePath()); const bool loaded = LoadPattern(args.at(static_cast<int>(i)), cmd->OptMeasurePath());
if (not loaded && not VApplication::CheckGUI()) if (not loaded && not VApplication::IsGUIMode())
{ {
return; // process only one input file 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 qApp->exit(V_EX_OK);// close program after processing in console mode
} }

View File

@ -104,7 +104,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
{ {
lGenerator.SetDetails(listDetails); lGenerator.SetDetails(listDetails);
DialogLayoutProgress progress(listDetails.count(), this); DialogLayoutProgress progress(listDetails.count(), this);
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start); connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged); connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged);
@ -134,7 +134,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
margins = lGenerator.GetFields(); margins = lGenerator.GetFields();
paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight()); paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight());
isLayoutStale = false; isLayoutStale = false;
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
QApplication::alert(this); QApplication::alert(this);
} }
@ -142,7 +142,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
case LayoutErrors::ProcessStoped: case LayoutErrors::ProcessStoped:
case LayoutErrors::PrepareLayoutError: case LayoutErrors::PrepareLayoutError:
case LayoutErrors::EmptyPaperError: case LayoutErrors::EmptyPaperError:
if (VApplication::CheckGUI()) if (VApplication::IsGUIMode())
{ {
QApplication::alert(this); QApplication::alert(this);
} }

View File

@ -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 qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")), //-V807
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error can't convert value.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error empty parameter.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error wrong id.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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.")), qCCritical(vXML, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Error parsing file.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); 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)."))); qCCritical(vXML, "%s", qUtf8Printable(tr("Error parsing file (std::bad_alloc).")));
emit SetEnabledGUI(false); emit SetEnabledGUI(false);
if (not VApplication::CheckGUI()) if (not VApplication::IsGUIMode())
{ {
qApp->exit(V_EX_NOINPUT); qApp->exit(V_EX_NOINPUT);
} }