Ejemplo n.º 1
0
void SettingsManager::load()
{
    QString path = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/";
    QDir dir;
    if(!dir.mkpath(path))
    {
        return;
    }
    QWebSettings::setIconDatabasePath(path);
    QSettings settings("PayableOnDeath", "Surfer");
    setImagesEnabled(settings.value("webkit/images", true).toBool());
    setJavascriptEnabled(settings.value("webkit/javascript", true).toBool());
    setJavaEnabled(settings.value("webkit/java", true).toBool());
    setPluginsEnabled(settings.value("webkit/plugins", true).toBool());
    setPrivateBrowsingEnabled(settings.value("webkit/private_browsing", false).toBool());
    setMainWindowGeometry(settings.value("geometry/main_window").toRect());
    setHistoryDialogGeometry(settings.value("geometry/history_dialog").toRect());
    setBookmarksDialogGeometry(settings.value("geometry/bookmarks_dialog").toRect());
    setSettingsDialogGeometry(settings.value("geometry/settings_dialog").toRect());
    setDownloadDialogGeometry(settings.value("geometry/download_dialog").toRect());
    setMaximumCacheSize(settings.value("extension/cache/maximum_size", 50 * 1024 * 1024).toLongLong());
    setHistoryExpirationDays(settings.value("extension/history/expiration_days", 7).toInt());
    setDownloadPath(settings.value("extension/download/path", "").toString());
    setSansFontFamily(settings.value("font/sans/family").toString());
    setSerifFontFamily(settings.value("font/serif/family").toString());
    setMonoFontFamily(settings.value("font/mono/family").toString());
    setStandardFontSize(settings.value("font/standard/size", 12).toInt());
    setMonoFontSize(settings.value("font/mono/size", 12).toInt());
}
Ejemplo n.º 2
0
void SettingsManager::reset()
{
    setImagesEnabled(true);
    setJavascriptEnabled(true);
    setJavaEnabled(true);
    setPluginsEnabled(true);
    setPrivateBrowsingEnabled(false);
    setMaximumCacheSize(50 * 1024 * 1024);
    setHistoryExpirationDays(7);
    setDownloadPath("");
    setStandardFontSize(12);
    setMonoFontSize(12);
}
Ejemplo n.º 3
0
void SettingsDialog::showGeneralTab() {
    if (!m_generalTab) {
        m_generalTab = new QWidget(m_stack);
        m_downloadsCheckBox = new QCheckBox(tr("Start downloads &automatically"), m_generalTab);
        m_downloadsCheckBox->setChecked(Settings::startTransfersAutomatically());
        m_downloadPathEdit = new QLineEdit(Settings::downloadPath(), m_generalTab);
        m_downloadPathButton = new QPushButton(QIcon::fromTheme("document-open"), tr("Browse"), m_generalTab);
        m_expirySpinBox = new QSpinBox(m_generalTab);
        m_expirySpinBox->setSuffix(tr(" day(s)"));
        m_expirySpinBox->setRange(-1, 90);
        m_expirySpinBox->setValue(Settings::readArticleExpiry());
        m_downloadsSpinBox = new QSpinBox(m_generalTab);
        m_downloadsSpinBox->setRange(1, MAX_CONCURRENT_TRANSFERS);
        m_downloadsSpinBox->setValue(Settings::maximumConcurrentTransfers());
        
        QFormLayout *form = new QFormLayout(m_generalTab);
        form->addRow(tr("&Delete read articles older than (-1 to disable):"), m_expirySpinBox);
        form->addRow(tr("Download &path:"), m_downloadPathEdit);
        form->addWidget(m_downloadPathButton);
        form->addRow(tr("&Maximum concurrent downloads:"), m_downloadsSpinBox);
        form->addRow(m_downloadsCheckBox);

        connect(m_expirySpinBox, SIGNAL(valueChanged(int)), Settings::instance(), SLOT(setReadArticleExpiry(int)));
        connect(m_downloadsCheckBox, SIGNAL(toggled(bool)),
                Settings::instance(), SLOT(setStartTransfersAutomatically(bool)));
        connect(m_downloadPathEdit, SIGNAL(textChanged(QString)), Settings::instance(), SLOT(setDownloadPath(QString)));
        connect(m_downloadPathButton, SIGNAL(clicked()), this, SLOT(showFileDialog()));
        connect(m_downloadsSpinBox, SIGNAL(valueChanged(int)),
                Settings::instance(), SLOT(setMaximumConcurrentTransfers(int)));
        
        m_stack->addWidget(m_generalTab);
    }
    
    m_stack->setCurrentWidget(m_generalTab);
}