mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:55:44 +00:00
UI} Options: Import without app restarting
This commit is contained in:
parent
c72995cd85
commit
f7e88f91df
@ -167,11 +167,12 @@ void OptionsController::exportBackup()
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
if (confManager()->exportBackup(path)) {
|
||||
windowManager()->showInfoDialog(tr("Backup Exported Successfully"));
|
||||
} else {
|
||||
windowManager()->showErrorBox(tr("Cannot Export Backup"));
|
||||
}
|
||||
const bool ok = confManager()->exportBackup(path);
|
||||
|
||||
const auto icon = ok ? QMessageBox::Information : QMessageBox::Critical;
|
||||
const auto title = ok ? tr("Backup Exported Successfully") : tr("Cannot Export Backup");
|
||||
|
||||
windowManager()->showMessageBox(icon, title, tr("Export Backup"));
|
||||
}
|
||||
|
||||
void OptionsController::importBackup()
|
||||
@ -182,14 +183,16 @@ void OptionsController::importBackup()
|
||||
|
||||
const bool ok = confManager()->importBackup(path);
|
||||
|
||||
windowManager()->processRestartRequired(
|
||||
ok ? tr("Backup Imported Successfully") : tr("Cannot Import Backup"));
|
||||
const auto icon = ok ? QMessageBox::Information : QMessageBox::Critical;
|
||||
const auto title = ok ? tr("Backup Imported Successfully") : tr("Cannot Import Backup");
|
||||
|
||||
windowManager()->showMessageBox(icon, title, tr("Import Backup"));
|
||||
}
|
||||
|
||||
void OptionsController::confirmImportBackup()
|
||||
{
|
||||
windowManager()->showConfirmBox([&] { importBackup(); },
|
||||
tr("Program will be restarted after successful import. Continue?\n\n"
|
||||
tr("All Options and Programs will be replaced after successful import. Continue?\n\n"
|
||||
"Make sure that you have a fresh backup."),
|
||||
tr("Import Backup"));
|
||||
}
|
||||
|
@ -654,12 +654,12 @@ bool WindowManager::checkPassword(bool temporary)
|
||||
|
||||
void WindowManager::showErrorBox(const QString &text, const QString &title, QWidget *parent)
|
||||
{
|
||||
showErrorDialog(text, title, parent);
|
||||
showMessageBox(QMessageBox::Warning, text, title, parent);
|
||||
}
|
||||
|
||||
void WindowManager::showInfoBox(const QString &text, const QString &title, QWidget *parent)
|
||||
{
|
||||
showInfoDialog(text, title, parent);
|
||||
showMessageBox(QMessageBox::Information, text, title, parent);
|
||||
}
|
||||
|
||||
void WindowManager::showConfirmBox(const std::function<void()> &onConfirmed, const QString &text,
|
||||
@ -694,25 +694,12 @@ void WindowManager::showQuestionBox(const std::function<void(bool confirmed)> &o
|
||||
DialogUtil::showDialog(box);
|
||||
}
|
||||
|
||||
void WindowManager::showErrorDialog(const QString &text, const QString &title, QWidget *parent)
|
||||
void WindowManager::showMessageBox(
|
||||
QMessageBox::Icon icon, const QString &text, const QString &title, QWidget *parent)
|
||||
{
|
||||
auto box = DialogUtil::createMessageBox(
|
||||
{
|
||||
.icon = QMessageBox::Warning,
|
||||
.buttons = QMessageBox::Ok,
|
||||
.text = text,
|
||||
.title = title,
|
||||
},
|
||||
parent);
|
||||
|
||||
DialogUtil::showDialog(box);
|
||||
}
|
||||
|
||||
void WindowManager::showInfoDialog(const QString &text, const QString &title, QWidget *parent)
|
||||
{
|
||||
auto box = DialogUtil::createMessageBox(
|
||||
{
|
||||
.icon = QMessageBox::Information,
|
||||
.icon = icon,
|
||||
.buttons = QMessageBox::Ok,
|
||||
.text = text,
|
||||
.title = title,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef WINDOWMANAGER_H
|
||||
#define WINDOWMANAGER_H
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
|
||||
#include <form/form_types.h>
|
||||
@ -132,10 +133,8 @@ public slots:
|
||||
void showQuestionBox(const std::function<void(bool confirmed)> &onFinished, const QString &text,
|
||||
const QString &title = QString(), QWidget *parent = nullptr);
|
||||
|
||||
static void showErrorDialog(
|
||||
const QString &text, const QString &title = QString(), QWidget *parent = nullptr);
|
||||
static void showInfoDialog(
|
||||
const QString &text, const QString &title = QString(), QWidget *parent = nullptr);
|
||||
static void showMessageBox(QMessageBox::Icon icon, const QString &text,
|
||||
const QString &title = QString(), QWidget *parent = nullptr);
|
||||
|
||||
static bool showPasswordDialog(QString &password, int *unlockType = nullptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user