Commit 36396395 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Main/MainWindow): remove `isInitiallyIconified` helper, set...

feat(ui/views/App/Main/MainWindow): remove `isInitiallyIconified` helper, set visibility directly with cpp
parent e3401603
...@@ -146,13 +146,11 @@ void App::initContentApp () { ...@@ -146,13 +146,11 @@ void App::initContentApp () {
#endif // ifndef __APPLE__ #endif // ifndef __APPLE__
if (m_parser.isSet("selftest")) { if (!m_parser.isSet("iconified"))
QTimer::singleShot(300, this, &App::quit); getMainWindow()->setVisible(true);
}
}
bool App::isInitiallyIconified () const { if (m_parser.isSet("selftest"))
return m_parser.isSet("iconified"); QTimer::singleShot(300, this, &App::quit);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -163,9 +161,9 @@ void App::parseArgs () { ...@@ -163,9 +161,9 @@ void App::parseArgs () {
m_parser.addVersionOption(); m_parser.addVersionOption();
m_parser.addOptions({ m_parser.addOptions({
{ "config", tr("commandLineOptionConfig"), "file" }, { "config", tr("commandLineOptionConfig"), "file" },
#ifndef __APPLE__ #ifndef __APPLE__
{ "iconified", tr("commandLineOptionIconified") }, { "iconified", tr("commandLineOptionIconified") },
#endif // __APPLE__ #endif // __APPLE__
{ "selftest", tr("commandLineOptionSelftest") }, { "selftest", tr("commandLineOptionSelftest") },
{ { "V", "verbose" }, tr("commandLineOptionVerbose") } { { "V", "verbose" }, tr("commandLineOptionVerbose") }
}); });
......
...@@ -54,11 +54,9 @@ public: ...@@ -54,11 +54,9 @@ public:
bool hasFocus () const; bool hasFocus () const;
Q_INVOKABLE QQuickWindow *getSettingsWindow () const;
void initContentApp (); void initContentApp ();
Q_INVOKABLE bool isInitiallyIconified () const; Q_INVOKABLE QQuickWindow *getSettingsWindow () const;
Q_INVOKABLE QString locale () const { Q_INVOKABLE QString locale () const {
return m_locale; return m_locale;
......
...@@ -65,6 +65,14 @@ Controls1.ApplicationWindow { ...@@ -65,6 +65,14 @@ Controls1.ApplicationWindow {
} }
} }
function _forceView (view, props) {
collapse.setCollapsed(true)
_updateSelectedEntry(view, props)
_currentView = view
contentLoader.setSource(view + '.qml', props || {})
}
function _setView (view, props) { function _setView (view, props) {
if (window.visibility === Window.Minimized) { if (window.visibility === Window.Minimized) {
window.visibility = Window.AutomaticVisibility window.visibility = Window.AutomaticVisibility
...@@ -72,12 +80,7 @@ Controls1.ApplicationWindow { ...@@ -72,12 +80,7 @@ Controls1.ApplicationWindow {
window.setVisible(true) window.setVisible(true)
} }
window.requestActivate() _forceView()
collapse.setCollapsed(true)
_updateSelectedEntry(view, props)
_currentView = view
contentLoader.setSource(view + '.qml', props || {})
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -91,7 +94,7 @@ Controls1.ApplicationWindow { ...@@ -91,7 +94,7 @@ Controls1.ApplicationWindow {
width: MainWindowStyle.width width: MainWindowStyle.width
title: MainWindowStyle.title title: MainWindowStyle.title
visible: true visible: false
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Menu bar. // Menu bar.
...@@ -104,10 +107,7 @@ Controls1.ApplicationWindow { ...@@ -104,10 +107,7 @@ Controls1.ApplicationWindow {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
Component.onCompleted: Utils.setTimeout(window, 0, function () { Component.onCompleted: Utils.setTimeout(window, 0, function () {
_setView('Home') _forceView('Home')
if (App.isInitiallyIconified()) {
window.hide()
}
}) })
onActiveFocusItemChanged: activeFocusItem == null && smartSearchBar.hideMenu() onActiveFocusItemChanged: activeFocusItem == null && smartSearchBar.hideMenu()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment