void AdBlockManager::load() { if (m_loaded) { return; } m_loaded = true; Settings settings; settings.beginGroup("AdBlock"); m_enabled = settings.value("enabled", m_enabled).toBool(); QDateTime lastUpdate = settings.value("lastUpdate", QDateTime()).toDateTime(); settings.endGroup(); m_subscription = new AdBlockSubscription(); connect(m_subscription, SIGNAL(rulesChanged()), this, SIGNAL(rulesChanged())); connect(m_subscription, SIGNAL(rulesUpdated()), this, SLOT(rulesUpdated())); if (lastUpdate.addDays(3) < QDateTime::currentDateTime()) { m_subscription->scheduleUpdate(); } }
void QgsFieldConditionalFormatWidget::saveRule() { QList<QgsConditionalStyle> styles = getStyles(); QgsConditionalStyle style = QgsConditionalStyle(); style.setRule( mRuleEdit->text() ); style.setName( mNameEdit->text() ); QColor backColor = btnBackgroundColor->color(); QColor fontColor = btnTextColor->color(); QFont font = mFontFamilyCmbBx->currentFont(); font.setBold( mFontBoldBtn->isChecked() ); font.setItalic( mFontItalicBtn->isChecked() ); font.setStrikeOut( mFontStrikethroughBtn->isChecked() ); font.setUnderline( mFontUnderlineBtn->isChecked() ); style.setFont( font ); style.setBackgroundColor( backColor ); style.setTextColor( fontColor ); if ( mSymbol && checkIcon->isChecked() ) { style.setSymbol( mSymbol ); } else { style.setSymbol( 0 ); } if ( mEditing ) { styles.replace( mEditIndex, style ); } else { styles.append( style ); } QString fieldName; if ( fieldRadio->isChecked() ) { fieldName = mFieldCombo->currentField(); mLayer->conditionalStyles()->setFieldStyles( fieldName, styles ); } if ( rowRadio->isChecked() ) { mLayer->conditionalStyles()->setRowStyles( styles ); } pages->setCurrentIndex( 0 ); reloadStyles(); emit rulesUpdated( fieldName ); reset(); }
void QgsFieldConditionalFormatWidget::deleteRule() { QList<QgsConditionalStyle> styles = getStyles(); styles.removeAt( mEditIndex ); QString fieldName; if ( fieldRadio->isChecked() ) { fieldName = mFieldCombo->currentField(); mLayer->conditionalStyles()->setFieldStyles( fieldName, styles ); } if ( rowRadio->isChecked() ) { mLayer->conditionalStyles()->setRowStyles( styles ); } pages->setCurrentIndex( 0 ); reloadStyles(); emit rulesUpdated( fieldName ); }