Commit 9ca5908d authored by Fabio Bas's avatar Fabio Bas
Browse files

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
parent a9ffbf5d
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "dlg_settings.h" #include "dlg_settings.h"
#include "main.h" #include "main.h"
#include "settingscache.h" #include "settingscache.h"
#include "priceupdater.h"
GeneralSettingsPage::GeneralSettingsPage() GeneralSettingsPage::GeneralSettingsPage()
{ {
...@@ -538,10 +539,10 @@ DeckEditorSettingsPage::DeckEditorSettingsPage() ...@@ -538,10 +539,10 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
switch(settingsCache->getPriceTagSource()) switch(settingsCache->getPriceTagSource())
{ {
case 0: case AbstractPriceUpdater::BLPPriceSource:
priceTagSource0->setChecked(true); priceTagSource0->setChecked(true);
break; break;
case 1: case AbstractPriceUpdater::DBPriceSource:
priceTagSource1->setChecked(true); priceTagSource1->setChecked(true);
break; break;
} }
...@@ -578,11 +579,11 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked) ...@@ -578,11 +579,11 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
if(!checked) if(!checked)
return; return;
int source=0; int source=AbstractPriceUpdater::BLPPriceSource;
if(priceTagSource0->isChecked()) if(priceTagSource0->isChecked())
source=0; source=AbstractPriceUpdater::BLPPriceSource;
if(priceTagSource1->isChecked()) if(priceTagSource1->isChecked())
source=1; source=AbstractPriceUpdater::DBPriceSource;
emit priceTagSourceChanged(source); emit priceTagSourceChanged(source);
} }
......
...@@ -14,6 +14,8 @@ class QNetworkAccessManager; ...@@ -14,6 +14,8 @@ class QNetworkAccessManager;
class AbstractPriceUpdater : public QWidget class AbstractPriceUpdater : public QWidget
{ {
Q_OBJECT Q_OBJECT
public:
enum PriceSource { BLPPriceSource, DBPriceSource };
protected: protected:
const DeckList *deck; const DeckList *deck;
QNetworkAccessManager *nam; QNetworkAccessManager *nam;
......
...@@ -648,10 +648,10 @@ void TabDeckEditor::actUpdatePrices() ...@@ -648,10 +648,10 @@ void TabDeckEditor::actUpdatePrices()
switch(settingsCache->getPriceTagSource()) switch(settingsCache->getPriceTagSource())
{ {
case 0: case AbstractPriceUpdater::BLPPriceSource:
up = new BLPPriceUpdater(deckModel->getDeckList()); up = new BLPPriceUpdater(deckModel->getDeckList());
break; break;
case 1: case AbstractPriceUpdater::DBPriceSource:
up = new DBPriceUpdater(deckModel->getDeckList()); up = new DBPriceUpdater(deckModel->getDeckList());
break; break;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment