QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) : QWidget( parent ) , mLayer( 0 ) , mEditIndex( 0 ) , mEditing( false ) , mSymbol( 0 ) { setupUi( this ); mDeleteButton->hide(); connect( mFieldCombo, SIGNAL( fieldChanged( QString ) ), SLOT( fieldChanged( QString ) ) ); connect( fieldRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( rowRadio, SIGNAL( clicked() ), SLOT( reloadStyles() ) ); connect( mNewButton, SIGNAL( clicked() ), SLOT( addNewRule() ) ); connect( mSaveRule, SIGNAL( clicked() ), SLOT( saveRule() ) ); connect( mCancelButton, SIGNAL( clicked() ), SLOT( cancelRule() ) ); connect( mDeleteButton, SIGNAL( clicked() ), SLOT( deleteRule() ) ); connect( listView, SIGNAL( clicked( QModelIndex ) ), SLOT( ruleClicked( QModelIndex ) ) ); connect( btnChangeIcon , SIGNAL( clicked() ), SLOT( updateIcon() ) ); connect( btnBuildExpression , SIGNAL( clicked() ), SLOT( setExpression() ) ); connect( mPresetsList , SIGNAL( currentIndexChanged( int ) ), SLOT( presetSet( int ) ) ); btnBackgroundColor->setAllowAlpha( true ); btnBackgroundColor->setShowNoColor( true ); btnTextColor->setAllowAlpha( true ); btnTextColor->setShowNoColor( true ); mPresetsModel = new QStandardItemModel( listView ); mModel = new QStandardItemModel( listView ); listView->setModel( mModel ); mPresetsList->setModel( mPresetsModel ); setPresets( defaultPresets() ); }
ColorSchemePresetsWidget::ColorSchemePresetsWidget(const ColorSchemePresets & presets, QWidget * parent) : QWidget(parent) , m_ui{ new Ui_ColorSchemePresetWidget } { initialize(); setPresets(presets); }
void EqualizerPresetManager::slotDefault() { int button = KMessageBox::warningYesNo( this, i18n( "All presets will be deleted and defaults will be restored. Are you sure?" ) ); if ( button != KMessageBox::Yes ) return; // Preserve the 'Manual' preset QList<int> manualGains = m_presets[ i18n("Manual") ]; // Delete all presets m_presets.clear(); // Create predefined presets 'Zero' and 'Manual' QList<int> zeroGains; zeroGains << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; m_presets[ i18n("Zero") ] = zeroGains; m_presets[ i18n("Manual") ] = manualGains; // Load the default presets QFile file( KStandardDirs::locate( "data", "amarok/data/equalizer_presets.xml" ) ); QTextStream stream( &file ); stream.setCodec( "UTF8" ); QDomDocument d; if( !file.open( QIODevice::ReadOnly ) || !d.setContent( stream.readAll() ) ) return; QDomNode n = d.namedItem( "equalizerpresets" ).namedItem("preset"); for( ; !n.isNull(); n = n.nextSibling() ) { QDomElement e = n.toElement(); QString title = e.attribute( "name" ); QList<int> gains; gains << e.namedItem( "b0" ).toElement().text().toInt(); gains << e.namedItem( "b1" ).toElement().text().toInt(); gains << e.namedItem( "b2" ).toElement().text().toInt(); gains << e.namedItem( "b3" ).toElement().text().toInt(); gains << e.namedItem( "b4" ).toElement().text().toInt(); gains << e.namedItem( "b5" ).toElement().text().toInt(); gains << e.namedItem( "b6" ).toElement().text().toInt(); gains << e.namedItem( "b7" ).toElement().text().toInt(); gains << e.namedItem( "b8" ).toElement().text().toInt(); gains << e.namedItem( "b9" ).toElement().text().toInt(); m_presets[ title ] = gains; } file.close(); // Update listview setPresets( m_presets ); }