mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-27 16:17:21 -08:00
Relocate showToast from settings to MainWindow
This commit is contained in:
parent
191efea6a8
commit
5929d59c9c
5 changed files with 34 additions and 15 deletions
|
@ -594,8 +594,10 @@ void MainWindow::on_settingsBtn_clicked()
|
||||||
ui->settingsBtn->setStyleSheet("background: black");
|
ui->settingsBtn->setStyleSheet("background: black");
|
||||||
ui->settingsBtn->setIcon(QIcon(":/resources/settings-inverted.png"));
|
ui->settingsBtn->setIcon(QIcon(":/resources/settings-inverted.png"));
|
||||||
|
|
||||||
// Create widget
|
// Create widget and make necessary connections
|
||||||
settingsChooserWindow = new settingsChooser();
|
settingsChooserWindow = new settingsChooser();
|
||||||
|
connect(settingsChooserWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
|
||||||
|
connect(settingsChooserWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
|
||||||
ui->stackedWidget->insertWidget(2, settingsChooserWindow);
|
ui->stackedWidget->insertWidget(2, settingsChooserWindow);
|
||||||
global::mainwindow::tabSwitcher::settingsChooserWidgetCreated = true;
|
global::mainwindow::tabSwitcher::settingsChooserWidgetCreated = true;
|
||||||
|
|
||||||
|
|
22
settings.cpp
22
settings.cpp
|
@ -327,6 +327,10 @@ settings::settings(QWidget *parent) :
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global::device::isWifiAble == false) {
|
if(global::device::isWifiAble == false) {
|
||||||
|
ui->checkOtaUpdateLabel->hide();
|
||||||
|
ui->checkOtaUpdateBtn->hide();
|
||||||
|
ui->checkOtaUpdateLabel->deleteLater();
|
||||||
|
ui->checkOtaUpdateBtn->deleteLater();
|
||||||
ui->checkOtaUpdateGridLayout->deleteLater();
|
ui->checkOtaUpdateGridLayout->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,8 +875,8 @@ void settings::openUpdateDialog() {
|
||||||
// Show the dialog
|
// Show the dialog
|
||||||
generalDialogWindow = new generalDialog(this);
|
generalDialogWindow = new generalDialog(this);
|
||||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
|
connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
||||||
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
|
connect(generalDialogWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
|
||||||
generalDialogWindow->show();
|
generalDialogWindow->show();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
@ -893,16 +897,10 @@ void settings::openUpdateDialogOTA(bool open) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings::showToast(QString messageToDisplay) {
|
void settings::showToastNative(QString messageToDisplay) {
|
||||||
global::toast::message = messageToDisplay;
|
emit showToast(messageToDisplay);
|
||||||
toastWindow = new toast(this);
|
|
||||||
toastWindow->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
connect(toastWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
|
|
||||||
connect(toastWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
|
|
||||||
toastWindow->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings::closeIndefiniteToast() {
|
void settings::closeIndefiniteToastNative() {
|
||||||
// Warning: use with caution
|
emit closeIndefiniteToast();
|
||||||
toastWindow->close();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,10 @@ private slots:
|
||||||
void openUpdateDialog();
|
void openUpdateDialog();
|
||||||
void launchOtaUpdater();
|
void launchOtaUpdater();
|
||||||
void openUpdateDialogOTA(bool open);
|
void openUpdateDialogOTA(bool open);
|
||||||
|
void showToastNative(QString messageToDisplay);
|
||||||
|
void closeIndefiniteToastNative();
|
||||||
|
|
||||||
|
signals:
|
||||||
void showToast(QString messageToDisplay);
|
void showToast(QString messageToDisplay);
|
||||||
void closeIndefiniteToast();
|
void closeIndefiniteToast();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ settingsChooser::settingsChooser(QWidget *parent) :
|
||||||
stylesheetFile.close();
|
stylesheetFile.close();
|
||||||
|
|
||||||
// UI tweaks
|
// UI tweaks
|
||||||
if(checkconfig("/opt/inkbox_kobox_support") != true) {
|
if(checkconfig("/opt/inkbox_kobox_support") == false) {
|
||||||
ui->koboxSettingsBtn->hide();
|
ui->koboxSettingsBtn->hide();
|
||||||
ui->line_3->hide();
|
ui->line_3->hide();
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,8 @@ void settingsChooser::on_inkboxSettingsBtn_clicked()
|
||||||
{
|
{
|
||||||
settingsWindow = new settings();
|
settingsWindow = new settings();
|
||||||
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
settingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(settingsWindow, SIGNAL(showToast(QString)), SLOT(showToastNative(QString)));
|
||||||
|
connect(settingsWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToastNative()));
|
||||||
settingsWindow->showFullScreen();
|
settingsWindow->showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,3 +84,11 @@ void settingsChooser::on_koboxSettingsBtn_clicked()
|
||||||
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
koboxSettingsWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
koboxSettingsWindow->showFullScreen();
|
koboxSettingsWindow->showFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void settingsChooser::showToastNative(QString messageToDisplay) {
|
||||||
|
emit showToast(messageToDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settingsChooser::closeIndefiniteToastNative() {
|
||||||
|
emit closeIndefiniteToast();
|
||||||
|
}
|
||||||
|
|
|
@ -25,8 +25,13 @@ public:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_inkboxSettingsBtn_clicked();
|
void on_inkboxSettingsBtn_clicked();
|
||||||
|
|
||||||
void on_koboxSettingsBtn_clicked();
|
void on_koboxSettingsBtn_clicked();
|
||||||
|
void showToastNative(QString messageToDisplay);
|
||||||
|
void closeIndefiniteToastNative();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void showToast(QString messageToDisplay);
|
||||||
|
void closeIndefiniteToast();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::settingsChooser *ui;
|
Ui::settingsChooser *ui;
|
||||||
|
|
Loading…
Reference in a new issue