mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
Make configuration check reusable.
Instead of passing a parameter to decide if a dialog box should be shown pass a pointer to the parent widget and make it static. This allows calling it from outside while keeping the possibility to not show a warning. Change-Id: I72fa53a7e8a83d527c22b698dfa434c24100ac29
This commit is contained in:
parent
9acd70288d
commit
3933afcc09
2 changed files with 19 additions and 19 deletions
|
|
@ -356,7 +356,7 @@ void RbUtilQt::updateSettings()
|
||||||
" or review your settings."));
|
" or review your settings."));
|
||||||
configDialog();
|
configDialog();
|
||||||
}
|
}
|
||||||
else if(chkConfig(false)) {
|
else if(chkConfig(0)) {
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
QMessageBox::critical(this, tr("Configuration error"),
|
QMessageBox::critical(this, tr("Configuration error"),
|
||||||
tr("Your configuration is invalid. This is most likely due "
|
tr("Your configuration is invalid. This is most likely due "
|
||||||
|
|
@ -387,7 +387,7 @@ void RbUtilQt::updateDevice()
|
||||||
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
|
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
|
||||||
|
|
||||||
/* Disable the whole tab widget if configuration is invalid */
|
/* Disable the whole tab widget if configuration is invalid */
|
||||||
bool configurationValid = !chkConfig(false);
|
bool configurationValid = !chkConfig(0);
|
||||||
ui.tabWidget->setEnabled(configurationValid);
|
ui.tabWidget->setEnabled(configurationValid);
|
||||||
ui.menuA_ctions->setEnabled(configurationValid);
|
ui.menuA_ctions->setEnabled(configurationValid);
|
||||||
|
|
||||||
|
|
@ -451,7 +451,7 @@ void RbUtilQt::updateManual()
|
||||||
|
|
||||||
void RbUtilQt::completeInstall()
|
void RbUtilQt::completeInstall()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||||
tr("Do you really want to perform a complete installation?\n\n"
|
tr("Do you really want to perform a complete installation?\n\n"
|
||||||
"This will install Rockbox %1. To install the most recent "
|
"This will install Rockbox %1. To install the most recent "
|
||||||
|
|
@ -507,7 +507,7 @@ void RbUtilQt::completeInstall()
|
||||||
|
|
||||||
void RbUtilQt::smallInstall()
|
void RbUtilQt::smallInstall()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||||
tr("Do you really want to perform a minimal installation? "
|
tr("Do you really want to perform a minimal installation? "
|
||||||
"A minimal installation will contain only the absolutely "
|
"A minimal installation will contain only the absolutely "
|
||||||
|
|
@ -581,7 +581,7 @@ void RbUtilQt::installdone(bool error)
|
||||||
|
|
||||||
void RbUtilQt::installBtn()
|
void RbUtilQt::installBtn()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
install();
|
install();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -684,7 +684,7 @@ bool RbUtilQt::installBootloaderAuto()
|
||||||
|
|
||||||
void RbUtilQt::installBootloaderBtn()
|
void RbUtilQt::installBootloaderBtn()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(QMessageBox::question(this, tr("Confirm Installation"),
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
||||||
tr("Do you really want to install the Bootloader?"),
|
tr("Do you really want to install the Bootloader?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
||||||
|
|
@ -846,7 +846,7 @@ void RbUtilQt::installBootloaderPost(bool error)
|
||||||
|
|
||||||
void RbUtilQt::installFontsBtn()
|
void RbUtilQt::installFontsBtn()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
||||||
RockboxInfo installInfo(mountpoint);
|
RockboxInfo installInfo(mountpoint);
|
||||||
if(installInfo.revision().isEmpty() && installInfo.release().isEmpty()) {
|
if(installInfo.revision().isEmpty() && installInfo.release().isEmpty()) {
|
||||||
|
|
@ -910,7 +910,7 @@ void RbUtilQt::installFonts()
|
||||||
|
|
||||||
void RbUtilQt::installVoice()
|
void RbUtilQt::installVoice()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
|
|
||||||
if(m_gotInfo == false)
|
if(m_gotInfo == false)
|
||||||
{
|
{
|
||||||
|
|
@ -980,7 +980,7 @@ void RbUtilQt::installVoice()
|
||||||
|
|
||||||
void RbUtilQt::installDoomBtn()
|
void RbUtilQt::installDoomBtn()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(!hasDoom()){
|
if(!hasDoom()){
|
||||||
QMessageBox::critical(this, tr("Error"),
|
QMessageBox::critical(this, tr("Error"),
|
||||||
tr("Your device doesn't have a doom plugin. Aborting."));
|
tr("Your device doesn't have a doom plugin. Aborting."));
|
||||||
|
|
@ -1031,7 +1031,7 @@ void RbUtilQt::installDoom()
|
||||||
|
|
||||||
void RbUtilQt::installThemes()
|
void RbUtilQt::installThemes()
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
|
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
|
||||||
tw->setModal(true);
|
tw->setModal(true);
|
||||||
tw->show();
|
tw->show();
|
||||||
|
|
@ -1039,7 +1039,7 @@ void RbUtilQt::installThemes()
|
||||||
|
|
||||||
void RbUtilQt::createTalkFiles(void)
|
void RbUtilQt::createTalkFiles(void)
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
|
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
|
||||||
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
||||||
installWindow->show();
|
installWindow->show();
|
||||||
|
|
@ -1048,16 +1048,16 @@ void RbUtilQt::createTalkFiles(void)
|
||||||
|
|
||||||
void RbUtilQt::createVoiceFile(void)
|
void RbUtilQt::createVoiceFile(void)
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
||||||
|
|
||||||
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
||||||
installWindow->show();
|
installWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RbUtilQt::uninstall(void)
|
void RbUtilQt::uninstall(void)
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
UninstallWindow *uninstallWindow = new UninstallWindow(this);
|
UninstallWindow *uninstallWindow = new UninstallWindow(this);
|
||||||
uninstallWindow->show();
|
uninstallWindow->show();
|
||||||
|
|
||||||
|
|
@ -1065,7 +1065,7 @@ void RbUtilQt::uninstall(void)
|
||||||
|
|
||||||
void RbUtilQt::uninstallBootloader(void)
|
void RbUtilQt::uninstallBootloader(void)
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(QMessageBox::question(this, tr("Confirm Uninstallation"),
|
if(QMessageBox::question(this, tr("Confirm Uninstallation"),
|
||||||
tr("Do you really want to uninstall the Bootloader?"),
|
tr("Do you really want to uninstall the Bootloader?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
||||||
|
|
@ -1117,7 +1117,7 @@ void RbUtilQt::uninstallBootloader(void)
|
||||||
|
|
||||||
void RbUtilQt::downloadManual(void)
|
void RbUtilQt::downloadManual(void)
|
||||||
{
|
{
|
||||||
if(chkConfig(true)) return;
|
if(chkConfig(this)) return;
|
||||||
if(QMessageBox::question(this, tr("Confirm download"),
|
if(QMessageBox::question(this, tr("Confirm download"),
|
||||||
tr("Do you really want to download the manual? The manual will be saved "
|
tr("Do you really want to download the manual? The manual will be saved "
|
||||||
"to the root folder of your player."),
|
"to the root folder of your player."),
|
||||||
|
|
@ -1290,7 +1290,7 @@ QUrl RbUtilQt::proxy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RbUtilQt::chkConfig(bool warn)
|
bool RbUtilQt::chkConfig(QWidget *parent)
|
||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
if(RbSettings::value(RbSettings::Platform).toString().isEmpty()
|
if(RbSettings::value(RbSettings::Platform).toString().isEmpty()
|
||||||
|
|
@ -1298,7 +1298,7 @@ bool RbUtilQt::chkConfig(bool warn)
|
||||||
|| !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isWritable()) {
|
|| !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isWritable()) {
|
||||||
error = true;
|
error = true;
|
||||||
|
|
||||||
if(warn) QMessageBox::critical(this, tr("Configuration error"),
|
if(parent) QMessageBox::critical(parent, tr("Configuration error"),
|
||||||
tr("Your configuration is invalid. Please go to the configuration "
|
tr("Your configuration is invalid. Please go to the configuration "
|
||||||
"dialog and make sure the selected values are correct."));
|
"dialog and make sure the selected values are correct."));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class RbUtilQt : public QMainWindow
|
||||||
public:
|
public:
|
||||||
RbUtilQt(QWidget *parent = 0);
|
RbUtilQt(QWidget *parent = 0);
|
||||||
static QList<QTranslator*> translators;
|
static QList<QTranslator*> translators;
|
||||||
|
static bool chkConfig(QWidget *parent = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RbUtilQtFrm ui;
|
Ui::RbUtilQtFrm ui;
|
||||||
|
|
@ -58,7 +59,6 @@ class RbUtilQt : public QMainWindow
|
||||||
ProgressLoggerGui *logger;
|
ProgressLoggerGui *logger;
|
||||||
ZipInstaller *installer;
|
ZipInstaller *installer;
|
||||||
QUrl proxy(void);
|
QUrl proxy(void);
|
||||||
bool chkConfig(bool);
|
|
||||||
|
|
||||||
volatile bool m_installed;
|
volatile bool m_installed;
|
||||||
volatile bool m_error;
|
volatile bool m_error;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue