Create an enum for price sources
Probably settingscache would have been the correct place for the enum, but keeping it in the same class/file where price sources are defined sounds cleaner to me
This commit is contained in:
parent
a9ffbf5d2d
commit
9ca5908de5
3 changed files with 10 additions and 7 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "dlg_settings.h"
|
||||
#include "main.h"
|
||||
#include "settingscache.h"
|
||||
#include "priceupdater.h"
|
||||
|
||||
GeneralSettingsPage::GeneralSettingsPage()
|
||||
{
|
||||
|
@ -538,10 +539,10 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
|||
|
||||
switch(settingsCache->getPriceTagSource())
|
||||
{
|
||||
case 0:
|
||||
case AbstractPriceUpdater::BLPPriceSource:
|
||||
priceTagSource0->setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
case AbstractPriceUpdater::DBPriceSource:
|
||||
priceTagSource1->setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
@ -578,11 +579,11 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
|
|||
if(!checked)
|
||||
return;
|
||||
|
||||
int source=0;
|
||||
int source=AbstractPriceUpdater::BLPPriceSource;
|
||||
if(priceTagSource0->isChecked())
|
||||
source=0;
|
||||
source=AbstractPriceUpdater::BLPPriceSource;
|
||||
if(priceTagSource1->isChecked())
|
||||
source=1;
|
||||
source=AbstractPriceUpdater::DBPriceSource;
|
||||
|
||||
emit priceTagSourceChanged(source);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ class QNetworkAccessManager;
|
|||
class AbstractPriceUpdater : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum PriceSource { BLPPriceSource, DBPriceSource };
|
||||
protected:
|
||||
const DeckList *deck;
|
||||
QNetworkAccessManager *nam;
|
||||
|
|
|
@ -648,10 +648,10 @@ void TabDeckEditor::actUpdatePrices()
|
|||
|
||||
switch(settingsCache->getPriceTagSource())
|
||||
{
|
||||
case 0:
|
||||
case AbstractPriceUpdater::BLPPriceSource:
|
||||
up = new BLPPriceUpdater(deckModel->getDeckList());
|
||||
break;
|
||||
case 1:
|
||||
case AbstractPriceUpdater::DBPriceSource:
|
||||
up = new DBPriceUpdater(deckModel->getDeckList());
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue