summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-14 20:51:49 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-14 21:10:54 +0100
commit3933afcc0942a635ff253a59d6138983e6fd90b8 (patch)
tree3b1b77a5f30954a5220eb1aa618364a3b0020720 /rbutil/rbutilqt/rbutilqt.cpp
parent9acd70288dfa47cac084b965a046df6f71d4ee26 (diff)
downloadrockbox-3933afcc0942a635ff253a59d6138983e6fd90b8.tar.gz
rockbox-3933afcc0942a635ff253a59d6138983e6fd90b8.tar.bz2
rockbox-3933afcc0942a635ff253a59d6138983e6fd90b8.zip
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
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index cb991a21b7..466f379666 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -356,7 +356,7 @@ void RbUtilQt::updateSettings()
" or review your settings."));
configDialog();
}
- else if(chkConfig(false)) {
+ else if(chkConfig(0)) {
QApplication::processEvents();
QMessageBox::critical(this, tr("Configuration error"),
tr("Your configuration is invalid. This is most likely due "
@@ -387,7 +387,7 @@ void RbUtilQt::updateDevice()
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
/* Disable the whole tab widget if configuration is invalid */
- bool configurationValid = !chkConfig(false);
+ bool configurationValid = !chkConfig(0);
ui.tabWidget->setEnabled(configurationValid);
ui.menuA_ctions->setEnabled(configurationValid);
@@ -451,7 +451,7 @@ void RbUtilQt::updateManual()
void RbUtilQt::completeInstall()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(QMessageBox::question(this, tr("Confirm Installation"),
tr("Do you really want to perform a complete installation?\n\n"
"This will install Rockbox %1. To install the most recent "
@@ -507,7 +507,7 @@ void RbUtilQt::completeInstall()
void RbUtilQt::smallInstall()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(QMessageBox::question(this, tr("Confirm Installation"),
tr("Do you really want to perform a minimal installation? "
"A minimal installation will contain only the absolutely "
@@ -581,7 +581,7 @@ void RbUtilQt::installdone(bool error)
void RbUtilQt::installBtn()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
install();
}
@@ -684,7 +684,7 @@ bool RbUtilQt::installBootloaderAuto()
void RbUtilQt::installBootloaderBtn()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(QMessageBox::question(this, tr("Confirm Installation"),
tr("Do you really want to install the Bootloader?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
@@ -846,7 +846,7 @@ void RbUtilQt::installBootloaderPost(bool error)
void RbUtilQt::installFontsBtn()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
RockboxInfo installInfo(mountpoint);
if(installInfo.revision().isEmpty() && installInfo.release().isEmpty()) {
@@ -910,7 +910,7 @@ void RbUtilQt::installFonts()
void RbUtilQt::installVoice()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(m_gotInfo == false)
{
@@ -980,7 +980,7 @@ void RbUtilQt::installVoice()
void RbUtilQt::installDoomBtn()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(!hasDoom()){
QMessageBox::critical(this, tr("Error"),
tr("Your device doesn't have a doom plugin. Aborting."));
@@ -1031,7 +1031,7 @@ void RbUtilQt::installDoom()
void RbUtilQt::installThemes()
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
tw->setModal(true);
tw->show();
@@ -1039,7 +1039,7 @@ void RbUtilQt::installThemes()
void RbUtilQt::createTalkFiles(void)
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show();
@@ -1048,16 +1048,16 @@ void RbUtilQt::createTalkFiles(void)
void RbUtilQt::createVoiceFile(void)
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
-
+
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show();
}
void RbUtilQt::uninstall(void)
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
UninstallWindow *uninstallWindow = new UninstallWindow(this);
uninstallWindow->show();
@@ -1065,7 +1065,7 @@ void RbUtilQt::uninstall(void)
void RbUtilQt::uninstallBootloader(void)
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(QMessageBox::question(this, tr("Confirm Uninstallation"),
tr("Do you really want to uninstall the Bootloader?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
@@ -1117,7 +1117,7 @@ void RbUtilQt::uninstallBootloader(void)
void RbUtilQt::downloadManual(void)
{
- if(chkConfig(true)) return;
+ if(chkConfig(this)) return;
if(QMessageBox::question(this, tr("Confirm download"),
tr("Do you really want to download the manual? The manual will be saved "
"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;
if(RbSettings::value(RbSettings::Platform).toString().isEmpty()
@@ -1298,7 +1298,7 @@ bool RbUtilQt::chkConfig(bool warn)
|| !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isWritable()) {
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 "
"dialog and make sure the selected values are correct."));
}