refactor: MainWindow remove need created / onCreated methods

This commit is contained in:
sithlord48 2024-12-18 23:44:50 -05:00 committed by Nick Bolton
parent 784b2b2f6f
commit 1ff7d5f4aa
2 changed files with 11 additions and 22 deletions

View file

@ -116,8 +116,17 @@ MainWindow::MainWindow(ConfigScopes &configScopes, AppConfig &appConfig)
setupControls(); setupControls();
connectSlots(); connectSlots();
// handled by `onCreated` setIcon();
Q_EMIT created();
m_ConfigScopes.signalReady();
applyCloseToTray();
updateScreenName();
applyConfig();
restoreWindow();
qDebug().noquote() << "active settings path:" << m_ConfigScopes.activeFilePath();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -220,8 +229,6 @@ void MainWindow::connectSlots()
[this](const QString &line) { handleLogLine(line); } [this](const QString &line) { handleLogLine(line); }
); );
connect(this, &MainWindow::created, this, &MainWindow::onCreated);
connect(this, &MainWindow::shown, this, &MainWindow::onShown, Qt::QueuedConnection); connect(this, &MainWindow::shown, this, &MainWindow::onShown, Qt::QueuedConnection);
connect(&m_ConfigScopes, &ConfigScopes::saving, this, &MainWindow::onConfigScopesSaving, Qt::DirectConnection); connect(&m_ConfigScopes, &ConfigScopes::saving, this, &MainWindow::onConfigScopesSaving, Qt::DirectConnection);
@ -308,22 +315,6 @@ void MainWindow::onAppAboutToQuit()
} }
} }
void MainWindow::onCreated()
{
setIcon();
m_ConfigScopes.signalReady();
applyCloseToTray();
updateScreenName();
applyConfig();
restoreWindow();
qDebug().noquote() << "active settings path:" << m_ConfigScopes.activeFilePath();
}
void MainWindow::onShown() void MainWindow::onShown()
{ {
// if a critical error was shown just before the main window (i.e. on app // if a critical error was shown just before the main window (i.e. on app

View file

@ -95,7 +95,6 @@ public:
void autoAddScreen(const QString name); void autoAddScreen(const QString name);
signals: signals:
void created();
void shown(); void shown();
public slots: public slots:
@ -105,7 +104,6 @@ private slots:
// //
// Manual slots // Manual slots
// //
void onCreated();
void onShown(); void onShown();
void onConfigScopesSaving(); void onConfigScopesSaving();
void onAppConfigTlsChanged(); void onAppConfigTlsChanged();