summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-22 20:26:50 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-22 20:26:50 +0300
commit6b42e3b20240964ca8c1cd35e369684b9d709c90 (patch)
tree006a5268cb8763eef639b2e2d031a80757e99871
parentMinor modal adjustments (diff)
downloadnheko-6b42e3b20240964ca8c1cd35e369684b9d709c90.tar.xz
Simplify the message shown when another app instance is detected
-rw-r--r--src/UserSettingsPage.cpp2
-rw-r--r--src/main.cpp43
2 files changed, 6 insertions, 39 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index ad5d484f..05fd54df 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -271,7 +271,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
                 [this](const QString &text) { settings_->setTheme(text.toLower()); });
         connect(scaleFactorCombo_,
                 static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
-                [this](const QString &factor) { utils::setScaleFactor(factor.toFloat()); });
+                [](const QString &factor) { utils::setScaleFactor(factor.toFloat()); });
 
         connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
                 settings_->setTray(!isDisabled);
diff --git a/src/main.cpp b/src/main.cpp
index 694811a7..d5651ff9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,10 +24,8 @@
 #include <QLabel>
 #include <QLayout>
 #include <QLibraryInfo>
-#include <QPalette>
+#include <QMessageBox>
 #include <QPoint>
-#include <QProcessEnvironment>
-#include <QPushButton>
 #include <QSettings>
 #include <QStandardPaths>
 #include <QTranslator>
@@ -38,7 +36,6 @@
 #include "MatrixClient.h"
 #include "RunGuard.h"
 #include "Utils.h"
-#include "ui/RaisedButton.h"
 #include "version.h"
 
 #if defined(Q_OS_LINUX)
@@ -99,41 +96,11 @@ main(int argc, char *argv[])
         if (!guard.tryToRun()) {
                 QApplication a(argc, argv);
 
-                QFont font;
-                font.setWeight(60);
+                QMessageBox msgBox;
+                msgBox.setText("Another instance of Nheko is running");
+                msgBox.exec();
 
-                QWidget widget;
-                QVBoxLayout layout(&widget);
-                layout.setContentsMargins(20, 10, 20, 20);
-                layout.setSpacing(0);
-
-                QHBoxLayout btnLayout;
-
-                QLabel msg("Another instance of nheko is currently running.");
-                msg.setWordWrap(true);
-                msg.setFont(font);
-
-                QPalette pal;
-
-                RaisedButton submitBtn("OK");
-                submitBtn.setBackgroundColor(pal.color(QPalette::Button));
-                submitBtn.setForegroundColor(pal.color(QPalette::ButtonText));
-                submitBtn.setFontSize(conf::btn::fontSize);
-                submitBtn.setCornerRadius(conf::btn::cornerRadius);
-
-                btnLayout.addStretch(1);
-                btnLayout.addWidget(&submitBtn);
-
-                layout.addWidget(&msg);
-                layout.addLayout(&btnLayout);
-
-                widget.setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
-                widget.move(screenCenter(widget.width(), widget.height()));
-                widget.show();
-
-                QObject::connect(&submitBtn, &QPushButton::clicked, &widget, &QWidget::close);
-
-                return a.exec();
+                return 0;
         }
 
 #if defined(Q_OS_LINUX) || defined(Q_OS_WIN)