bool RarArchEngine::areExternalProgramsOK() { return (isProgramAvailable(QString("%1/bash").arg(TOOLS_PATH)) && isProgramAvailable(QString("%1/unrar").arg(TOOLS_PATH))); }
// constructor // Most of the interface is defined in the ui // // The UI dialog button box accept button is connected to the writeSettings // so slot so the settings on disk are always current to what is selected // and set using the UI // Settings::Settings(QWidget *parent) : QDialog(parent) { // setup the user interface ui.setupUi(this); // data members editor_string = QString(); // read the settings settings = new QSettings(ORG, APP, this); // preferences settings->beginGroup("Preferences"); ui.checkBox_usestartoptions->setChecked(settings->value("use_startoptions").toBool() ); ui.groupBox_startoptions->setEnabled(settings->value("use_startoptions").toBool() ); ui.checkBox_retainstate->setChecked(settings->value("retain_state").toBool() ); ui.checkBox_retainplaylist->setChecked(settings->value("retain_playlist").toBool() ); ui.checkBox_disabletooltips->setChecked(settings->value("disable_tooltips").toBool() ); ui.checkBox_disablexscreensaver->setChecked(settings->value("disable_xscreensaver").toBool() ); ui.checkBox_disabledpms->setChecked(settings->value("disable_dpms").toBool() ); ui.lineEdit_colorize->setText(settings->value("colorize_icons").toString() ); ui.checkBox_disableinternet->setChecked(settings->value("disable_internet").toBool() ); ui.checkBox_useyoutubedl->setChecked(settings->value("use_youtube-dl").toBool() ); ui.spinBox_youtubedl_timeout->setValue(settings->value("youtube-dl_timeout", 9).toInt() ); QDir res(":/stylesheets/stylesheets/"); QStringList styles = res.entryList(QDir::Files); styles << tr("None"); QString str = settings->value("style").toString(); styles.replaceInStrings(".qss", ""); if (! str.isEmpty() && ! styles.contains(str)) styles << str; styles.sort(Qt::CaseSensitive); ui.comboBox_style->clear(); ui.comboBox_style->addItems(styles); ui.comboBox_style->setCurrentText(str); settings->endGroup(); // notification settings settings->beginGroup("Notifications"); ui.checkBox_notifydaemon->setChecked(settings->value("use_notifications").toBool() ); settings->endGroup(); // start options settings->beginGroup("StartOptions"); ui.checkBox_fullscreen->setChecked(settings->value("start_fullscreen").toBool() ); ui.checkBox_shademode->setChecked(settings->value("start_shademode").toBool() ); ui.checkBox_gui->setChecked(settings->value("start_gui").toBool() ); ui.checkBox_icontheme->setChecked(settings->value("use_icon_theme").toBool() ); if (ui.checkBox_icontheme->isChecked() ) ui.lineEdit_icontheme->setEnabled(true); ui.lineEdit_icontheme->setText(settings->value("icon_theme_name").toString() ); ui.spinBox_loglevel->setValue(settings->value("log_level").toInt() ); ui.checkBox_visualizer->setChecked(settings->value("start_visualizer").toBool() ); ui.checkBox_nohardwaredecoding->setChecked(settings->value("no_hardware_decoding").toBool() ); ui.checkBox_subtitles->setChecked(settings->value("start_subtitles").toBool() ); ui.checkBox_streambuffering->setChecked(settings->value("use_stream_buffering").toBool() ); ui.checkBox_downloadbuffering->setChecked(settings->value("use_download_buffering").toBool() ); ui.lineEdit_audiocd->setText(settings->value("audio_cd_drive").toString() ); ui.lineEdit_dvd->setText(settings->value("dvd_drive").toString() ); ui.spinBox_connectionspeed->setValue(settings->value("connection_speed").toInt() ); ui.lineEdit_promoted->setText(settings->value("promoted-elements").toString() ); ui.lineEdit_blacklisted->setText(settings->value("blacklisted-elements").toString() ); settings->endGroup(); // external programs settings->beginGroup("ExternalPrograms"); editor_string = settings->value("text_editor").toString(); settings->endGroup(); // Set up the buttonGroup for the editing buttons bg01 = new QButtonGroup(this); bg01->addButton(ui.pushButton_editiconfile); bg01->addButton(ui.pushButton_editkeyfile); // Connect signals and slots connect(bg01, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(openEditor(QAbstractButton*))); connect(ui.toolButton_colorize, SIGNAL(clicked()), this, SLOT(callColorDialog())); connect(ui.lineEdit_colorize, SIGNAL(textChanged(const QString&)), this, SLOT(iconColorChanged(const QString&))); connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(writeSettings())); // See if we can find XScreenSaver and enable or disable controls // based on what we can find. If XScreenSaver is running it controls // blanking and powersaving. if (isProcessRunning("xscreensaver") ) { ui.checkBox_disablexscreensaver->setEnabled(true); ui.checkBox_disabledpms->setEnabled(false); } else { ui.checkBox_disablexscreensaver->setEnabled(false); ui.checkBox_disabledpms->setEnabled(true); } // else // See if we can find youtube-dl and disable settings if we can't if (isProgramAvailable("youtube-dl") ) { ui.checkBox_useyoutubedl->setEnabled(true); } else { ui.checkBox_useyoutubedl->setEnabled(false); } // We may have changed settings finding XScreensaver and youtube-dl so // make sure everything is in sync. this->writeSettings(); return; }
bool BzipArchEngine::areExternalProgramsOK() { return (isProgramAvailable(QString("%1/pbzip2").arg(TOOLS_PATH)) || isProgramAvailable(QString("%1/bzip2").arg(TOOLS_PATH))) && isProgramAvailable(QString("%1/bash").arg(TOOLS_PATH)) && isProgramAvailable(QString("%1/tar").arg(TOOLS_PATH)); }
bool XzipArchEngine::areExternalProgramsOK() { return isProgramAvailable(QString("%1/xz").arg(TOOLS_PATH)) && isProgramAvailable(QString("%1/bash").arg(TOOLS_PATH)) && isProgramAvailable(QString("%1/tar").arg(TOOLS_PATH)); }
QString BzipArchEngine::archiverPath() const { QString pgm = QString("%1/pbzip2").arg(TOOLS_PATH); if (isProgramAvailable(pgm)) return pgm; return QString("%1/bzip2").arg(TOOLS_PATH); }