From b874491d9ca359d9d3080265c6d1210c0191e589 Mon Sep 17 00:00:00 2001 From: Triplehx3 Date: Sun, 23 Nov 2025 01:35:33 +0000 Subject: [PATCH] Add dev mode flag to cmake and adjust spacing --- CMakeLists.txt | 8 ++++++++ src/mainwindow.cpp | 14 ++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54d9c14..dbe7288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,14 @@ project(SOM LANGUAGES CXX) find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets) +option(DEV_BUILD "Enable developer-mode build" OFF) + +if(DEV_BUILD) + add_compile_definitions(DEV_BUILD=1) +else() + add_compile_definitions(DEV_BUILD=0) +endif() + qt_standard_project_setup() qt_add_executable(som diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a8f313f..badc138 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -28,7 +28,7 @@ void MainWindow::createActions() connect(exitAct, &QAction::triggered, this, &QWidget::close); settingsAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::WeatherSnow), - tr("&Settings"), this); + tr("&Settings"), this); connect(settingsAct, &QAction::triggered, this, &MainWindow::settings); aboutAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout), @@ -36,7 +36,7 @@ void MainWindow::createActions() connect(aboutAct, &QAction::triggered, this, &MainWindow::about); aboutQtAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout), - tr("About &Qt"), this); + tr("About &Qt"), this); connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt); } @@ -146,11 +146,13 @@ void MainWindow::settings() void MainWindow::loadPlugins() { +#if DEV_BUILD + pluginsDir = QDir(QCoreApplication::applicationDirPath()); + pluginsDir.cd("plugins"); +#else pluginsDir = QDir("/usr/lib"); pluginsDir.cd("som"); - //pluginsDir = QDir(QCoreApplication::applicationDirPath()); - //pluginsDir.cd("plugins"); - +#endif const auto entryList = pluginsDir.entryList(QDir::Files); for (const QString &fileName : entryList) { @@ -193,7 +195,7 @@ void MainWindow::populateMenu(QObject *plugin) } void MainWindow::addToMenu(QObject *plugin, const QString &text, - QMenu *menu, Member member) + QMenu *menu, Member member) { auto action = new QAction(text, plugin); connect(action, &QAction::triggered, this, member);