Add dev mode flag to cmake and adjust spacing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user