Some minor Adblock dialog fixes to make loading of it smoother.

This commit is contained in:
Martin Rotter 2015-06-25 07:07:45 +02:00
parent 5a3f25c295
commit 838420b573
7 changed files with 23 additions and 20 deletions

View File

@ -96,7 +96,6 @@ void FeedsView::updateAutoUpdateStatus() {
if (!m_autoUpdateTimer->isActive()) {
m_autoUpdateTimer->setInterval(AUTO_UPDATE_INTERVAL);
m_autoUpdateTimer->start();
qDebug("Auto-update timer started with interval %d.", m_autoUpdateTimer->interval());
}
else {

0
src/miscellaneous/autosaver.cpp Normal file → Executable file
View File

View File

@ -69,9 +69,7 @@ QList<Language> Localization::installedLanguages() {
QTranslator translator;
// Iterate all found language files.
foreach (const QFileInfo &file, file_dir.entryInfoList(QStringList() << "rssguard-*.qm",
QDir::Files,
QDir::Name)) {
foreach (const QFileInfo &file, file_dir.entryInfoList(QStringList() << "rssguard-*.qm", QDir::Files, QDir::Name)) {
if (translator.load(file.absoluteFilePath())) {
Language new_language;
new_language.m_code = translator.translate("QObject", "LANG_ABBREV");

View File

@ -180,19 +180,20 @@ void AdBlockDialog::learnAboutRules() {
}
void AdBlockDialog::loadSubscriptions() {
setEnabled(false);
for (int i = 0; i < m_ui->m_tabs->count(); ++i) {
qobject_cast<AdBlockTreeWidget*>(m_ui->m_tabs->widget(i))->refresh();
}
setEnabled(true);
}
void AdBlockDialog::load()
{
void AdBlockDialog::load() {
if (m_loaded || !m_ui->m_checkEnable->isChecked()) {
return;
}
foreach (AdBlockSubscription* subscription, m_manager->subscriptions()) {
AdBlockTreeWidget* tree = new AdBlockTreeWidget(subscription, m_ui->m_tabs);
foreach (AdBlockSubscription *subscription, m_manager->subscriptions()) {
AdBlockTreeWidget *tree = new AdBlockTreeWidget(subscription, m_ui->m_tabs);
m_ui->m_tabs->addTab(tree, subscription->title());
}
@ -204,11 +205,10 @@ void AdBlockDialog::load()
QTimer::singleShot(100, this, SLOT(loadSubscriptions()));
}
void AdBlockDialog::closeEvent(QCloseEvent* ev)
{
void AdBlockDialog::closeEvent(QCloseEvent *event) {
if (m_ui->m_checkUseLimitedEasyList->isChecked() != m_useLimitedEasyList) {
m_manager->setUseLimitedEasyList(m_ui->m_checkUseLimitedEasyList->isChecked());
}
QWidget::closeEvent(ev);
QWidget::closeEvent(event);
}

View File

@ -61,7 +61,7 @@ class AdBlockDialog : public QDialog {
void load();
protected:
void closeEvent(QCloseEvent* ev);
void closeEvent(QCloseEvent *event);
private:
void setupMenu();

View File

@ -229,19 +229,19 @@ void AdBlockTreeWidget::refresh() {
m_itemChangingBlock = true;
clear();
QFont boldFont;
boldFont.setBold(true);
QFont bold_font;
bold_font.setBold(true);
m_topItem = new QTreeWidgetItem(this);
m_topItem->setText(0, m_subscription->title());
m_topItem->setFont(0, boldFont);
m_topItem->setFont(0, bold_font);
m_topItem->setExpanded(true);
addTopLevelItem(m_topItem);
const QVector<AdBlockRule*> &allRules = m_subscription->allRules();
const QVector<AdBlockRule*> &all_rules = m_subscription->allRules();
int index = 0;
foreach (const AdBlockRule *rule, allRules) {
foreach (const AdBlockRule *rule, all_rules) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_topItem);
item->setText(0, rule->filter());
item->setData(0, Qt::UserRole + 10, index);
@ -252,6 +252,10 @@ void AdBlockTreeWidget::refresh() {
adjustItemFeatures(item, rule);
index++;
if (index % 100 == 0) {
qApp->processEvents();
}
}
showRule(0);

View File

@ -87,7 +87,9 @@ void WebView::saveCurrentPageToFile() {
QString selected_file;
QString implicit_file_base_name = tr("source_page");
if (qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool()) {
// NOTE: It is good to always ask for destination here, since download manager
// is not displaying afterwards because this is *not* real download actually.
//if (qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::AlwaysPromptForFilename)).toBool()) {
QString filter_html = tr("HTML web pages (*.html)");
QString filter;
@ -104,7 +106,7 @@ void WebView::saveCurrentPageToFile() {
qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory,
QDir::toNativeSeparators(QFileInfo(selected_file).absolutePath()));
}
}
/*}
else {
QString base_folder = qApp->settings()->value(GROUP(Downloads), SETTING(Downloads::TargetDirectory)).toString();
@ -124,7 +126,7 @@ void WebView::saveCurrentPageToFile() {
selected_file = subsequent_file_name;
}
}
}*/
if (!selected_file.isEmpty()) {
QFile selected_file_handle(selected_file);