Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/playlistbrowser/DynamicBiasDialog.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 43 | { | |||
---|---|---|---|---|---|
65 | 65 | | |||
66 | // -- button box | 66 | // -- button box | ||
67 | QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); | 67 | QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); | ||
68 | m_mainLayout->addWidget( buttonBox ); | 68 | m_mainLayout->addWidget( buttonBox ); | ||
69 | 69 | | |||
70 | factoriesChanged(); | 70 | factoriesChanged(); | ||
71 | biasReplaced( Dynamic::BiasPtr(), m_bias ); | 71 | biasReplaced( Dynamic::BiasPtr(), m_bias ); | ||
72 | 72 | | |||
73 | connect( Dynamic::BiasFactory::instance(), SIGNAL(changed()), | 73 | connect( Dynamic::BiasFactory::instance(), &Dynamic::BiasFactory::changed, | ||
74 | this, SLOT(factoriesChanged()) ); | 74 | this, &PlaylistBrowserNS::BiasDialog::factoriesChanged ); | ||
75 | connect( m_biasSelection, SIGNAL(activated(int)), | 75 | connect( m_biasSelection, QOverload<int>::of(&KComboBox::activated), | ||
76 | this, SLOT(selectionChanged(int)) ); | 76 | this, &PlaylistBrowserNS::BiasDialog::selectionChanged ); | ||
77 | connect(buttonBox, SIGNAL(accepted()), | 77 | connect(buttonBox, &QDialogButtonBox::accepted, | ||
78 | this, SLOT(accept())); | 78 | this, &PlaylistBrowserNS::BiasDialog::accept); | ||
79 | connect(buttonBox, SIGNAL(rejected()), | 79 | connect(buttonBox, &QDialogButtonBox::rejected, | ||
80 | this, SLOT(reject())); | 80 | this, &PlaylistBrowserNS::BiasDialog::reject); | ||
81 | } | 81 | } | ||
82 | 82 | | |||
83 | void PlaylistBrowserNS::BiasDialog::accept() | 83 | void PlaylistBrowserNS::BiasDialog::accept() | ||
84 | { | 84 | { | ||
85 | // use the newly edited bias | 85 | // use the newly edited bias | ||
86 | m_origBias->replace( m_bias ); // tell the old bias it has just been replaced | 86 | m_origBias->replace( m_bias ); // tell the old bias it has just been replaced | ||
87 | QDialog::accept(); | 87 | QDialog::accept(); | ||
88 | } | 88 | } | ||
89 | 89 | | |||
90 | void PlaylistBrowserNS::BiasDialog::reject() | 90 | void PlaylistBrowserNS::BiasDialog::reject() | ||
91 | { | 91 | { | ||
92 | // do nothing. | 92 | // do nothing. | ||
93 | QDialog::reject(); | 93 | QDialog::reject(); | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | PlaylistBrowserNS::BiasDialog::~BiasDialog() | 96 | PlaylistBrowserNS::BiasDialog::~BiasDialog() | ||
97 | { } | 97 | { } | ||
98 | 98 | | |||
99 | void | 99 | void | ||
100 | PlaylistBrowserNS::BiasDialog::factoriesChanged() | 100 | PlaylistBrowserNS::BiasDialog::factoriesChanged() | ||
101 | { | 101 | { | ||
102 | m_biasSelection->clear(); | 102 | m_biasSelection->clear(); | ||
103 | 103 | | |||
104 | disconnect( Dynamic::BiasFactory::instance(), SIGNAL(changed()), | 104 | disconnect( Dynamic::BiasFactory::instance(), &Dynamic::BiasFactory::changed, | ||
105 | this, SLOT(factoriesChanged()) ); | 105 | this, &PlaylistBrowserNS::BiasDialog::factoriesChanged ); | ||
106 | 106 | | |||
107 | // -- add all the bias types to the list | 107 | // -- add all the bias types to the list | ||
108 | bool factoryFound = false; | 108 | bool factoryFound = false; | ||
109 | QList<Dynamic::AbstractBiasFactory*> factories = Dynamic::BiasFactory::factories(); | 109 | QList<Dynamic::AbstractBiasFactory*> factories = Dynamic::BiasFactory::factories(); | ||
110 | for( int i = 0; i < factories.count(); i++ ) | 110 | for( int i = 0; i < factories.count(); i++ ) | ||
111 | { | 111 | { | ||
112 | Dynamic::AbstractBiasFactory* factory = factories.at( i ); | 112 | Dynamic::AbstractBiasFactory* factory = factories.at( i ); | ||
113 | m_biasSelection->addItem( factory->i18nName(), QVariant( factory->name() ) ); | 113 | m_biasSelection->addItem( factory->i18nName(), QVariant( factory->name() ) ); | ||
Show All 12 Lines | |||||
126 | { | 126 | { | ||
127 | m_biasSelection->addItem( m_bias->name() ); | 127 | m_biasSelection->addItem( m_bias->name() ); | ||
128 | m_biasSelection->setCurrentIndex( m_biasSelection->count() - 1 ); | 128 | m_biasSelection->setCurrentIndex( m_biasSelection->count() - 1 ); | ||
129 | m_descriptionLabel->setText( i18n( "This bias is a replacement for another bias\n" | 129 | m_descriptionLabel->setText( i18n( "This bias is a replacement for another bias\n" | ||
130 | "which is currently not loaded or deactivated.\n" | 130 | "which is currently not loaded or deactivated.\n" | ||
131 | "The original bias name was %1.", m_bias->name() ) ); | 131 | "The original bias name was %1.", m_bias->name() ) ); | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | connect( Dynamic::BiasFactory::instance(), SIGNAL(changed()), | 134 | connect( Dynamic::BiasFactory::instance(), &Dynamic::BiasFactory::changed, | ||
135 | this, SLOT(factoriesChanged()) ); | 135 | this, &PlaylistBrowserNS::BiasDialog::factoriesChanged ); | ||
136 | } | 136 | } | ||
137 | 137 | | |||
138 | void | 138 | void | ||
139 | PlaylistBrowserNS::BiasDialog::selectionChanged( int index ) | 139 | PlaylistBrowserNS::BiasDialog::selectionChanged( int index ) | ||
140 | { | 140 | { | ||
141 | DEBUG_BLOCK; | 141 | DEBUG_BLOCK; | ||
142 | Q_ASSERT( m_biasSelection ); | 142 | Q_ASSERT( m_biasSelection ); | ||
143 | 143 | | |||
Show All 39 Lines | 181 | { | |||
183 | m_biasWidget->deleteLater(); | 183 | m_biasWidget->deleteLater(); | ||
184 | m_biasWidget = 0; | 184 | m_biasWidget = 0; | ||
185 | } | 185 | } | ||
186 | 186 | | |||
187 | m_bias = newBias; | 187 | m_bias = newBias; | ||
188 | if( !newBias ) | 188 | if( !newBias ) | ||
189 | return; | 189 | return; | ||
190 | 190 | | |||
191 | connect( newBias.data(), SIGNAL(replaced(Dynamic::BiasPtr,Dynamic::BiasPtr)), | 191 | connect( newBias.data(), &Dynamic::AbstractBias::replaced, | ||
192 | this, SLOT(biasReplaced(Dynamic::BiasPtr,Dynamic::BiasPtr)) ); | 192 | this, &PlaylistBrowserNS::BiasDialog::biasReplaced ); | ||
193 | 193 | | |||
194 | m_biasWidget = newBias->widget( 0 ); | 194 | m_biasWidget = newBias->widget( 0 ); | ||
195 | if( !m_biasWidget ) | 195 | if( !m_biasWidget ) | ||
196 | m_biasWidget = new QLabel( i18n("This bias has no settings.") ); | 196 | m_biasWidget = new QLabel( i18n("This bias has no settings.") ); | ||
197 | m_biasLayout->addWidget( m_biasWidget ); | 197 | m_biasLayout->addWidget( m_biasWidget ); | ||
198 | 198 | | |||
199 | factoriesChanged(); // update the bias description and select the new combo entry | 199 | factoriesChanged(); // update the bias description and select the new combo entry | ||
200 | } | 200 | } | ||
201 | 201 | | |||
202 | 202 | | |||
203 | 203 | |