Gui: refactor hiddenMainWindow usage
This commit is contained in:
@@ -2304,6 +2304,14 @@ void Application::runApplication()
|
||||
Base::Console().Log("Finish: Event loop left\n");
|
||||
}
|
||||
|
||||
bool Application::hiddenMainWindow()
|
||||
{
|
||||
const std::map<std::string,std::string>& cfg = App::Application::Config();
|
||||
auto it = cfg.find("StartHidden");
|
||||
|
||||
return it != cfg.end();
|
||||
}
|
||||
|
||||
bool Application::testStatus(Status pos) const
|
||||
{
|
||||
return d->StatusBits.test((size_t)pos);
|
||||
|
||||
@@ -247,6 +247,8 @@ public:
|
||||
void tryClose( QCloseEvent * e );
|
||||
//@}
|
||||
|
||||
/// whenever GUI is about to start with the main window hidden
|
||||
static bool hiddenMainWindow();
|
||||
/// return the status bits
|
||||
bool testStatus(Status pos) const;
|
||||
/// set the status bits
|
||||
|
||||
@@ -1634,9 +1634,7 @@ void MainWindow::delayedStartup()
|
||||
throw;
|
||||
}
|
||||
|
||||
const std::map<std::string,std::string>& cfg = App::Application::Config();
|
||||
auto it = cfg.find("StartHidden");
|
||||
if (it != cfg.end()) {
|
||||
if (Application::hiddenMainWindow()) {
|
||||
QApplication::quit();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -408,24 +408,10 @@ void StartupPostProcess::setImportImageFormats()
|
||||
App::GetApplication().addImportType(filter.c_str(), "FreeCADGui");
|
||||
}
|
||||
|
||||
bool StartupPostProcess::hiddenMainWindow() const
|
||||
{
|
||||
const std::map<std::string,std::string>& cfg = App::Application::Config();
|
||||
bool hidden = false;
|
||||
auto it = cfg.find("StartHidden");
|
||||
if (it != cfg.end()) {
|
||||
hidden = true;
|
||||
}
|
||||
|
||||
return hidden;
|
||||
}
|
||||
|
||||
void StartupPostProcess::showMainWindow()
|
||||
{
|
||||
bool hidden = hiddenMainWindow();
|
||||
|
||||
// show splasher while initializing the GUI
|
||||
if (!hidden && !loadFromPythonModule) {
|
||||
if (!Application::hiddenMainWindow() && !loadFromPythonModule) {
|
||||
mainWindow->startSplasher();
|
||||
}
|
||||
|
||||
@@ -488,7 +474,7 @@ void StartupPostProcess::activateWorkbench()
|
||||
guiApp.activateWorkbench(start.c_str());
|
||||
|
||||
// show the main window
|
||||
if (!hiddenMainWindow()) {
|
||||
if (!Application::hiddenMainWindow()) {
|
||||
Base::Console().Log("Init: Showing main window\n");
|
||||
mainWindow->loadWindowSettings();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ private:
|
||||
void setStyleSheet();
|
||||
void autoloadModules(const QStringList& wb);
|
||||
void setImportImageFormats();
|
||||
bool hiddenMainWindow() const;
|
||||
void showMainWindow();
|
||||
void activateWorkbench();
|
||||
void checkParameters();
|
||||
|
||||
Reference in New Issue
Block a user