mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Simplify the message shown when another app instance is detected
This commit is contained in:
parent
98548b1b8b
commit
6b42e3b202
2 changed files with 6 additions and 39 deletions
|
@ -271,7 +271,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
[this](const QString &text) { settings_->setTheme(text.toLower()); });
|
[this](const QString &text) { settings_->setTheme(text.toLower()); });
|
||||||
connect(scaleFactorCombo_,
|
connect(scaleFactorCombo_,
|
||||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
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) {
|
connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||||
settings_->setTray(!isDisabled);
|
settings_->setTray(!isDisabled);
|
||||||
|
|
43
src/main.cpp
43
src/main.cpp
|
@ -24,10 +24,8 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QPalette>
|
#include <QMessageBox>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
@ -38,7 +36,6 @@
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "RunGuard.h"
|
#include "RunGuard.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "ui/RaisedButton.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
|
@ -99,41 +96,11 @@ main(int argc, char *argv[])
|
||||||
if (!guard.tryToRun()) {
|
if (!guard.tryToRun()) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
QFont font;
|
QMessageBox msgBox;
|
||||||
font.setWeight(60);
|
msgBox.setText("Another instance of Nheko is running");
|
||||||
|
msgBox.exec();
|
||||||
|
|
||||||
QWidget widget;
|
return 0;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_WIN)
|
||||||
|
|
Loading…
Reference in a new issue