Add primitive support of low resolutions

This commit is contained in:
Grégory Soutadé 2012-06-29 20:33:33 +02:00
parent 1aa37d3110
commit 51e348ef7b
16 changed files with 110 additions and 112 deletions

View File

@ -1,3 +1,11 @@
v0.4 (29/06/2012)
** User **
Add icons for low resolution
** Dev **
Primitive handle of low resolutions
v0.3 (31/05/2012) v0.3 (31/05/2012)
** User ** ** User **
New interface in Qt4 New interface in Qt4

View File

@ -33,12 +33,13 @@ enum {CUR_CREDIT, CUR_DEBIT, TOTAL_CREDIT, TOTAL_DEBIT, BALANCE, STATS_ROW, CATS
enum {VIRTUAL_MODE=0, REAL_MODE, CHECK_MODE}; enum {VIRTUAL_MODE=0, REAL_MODE, CHECK_MODE};
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _curMonth(-1), _curYear(-1), _inModification(false) AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution), _curMonth(-1), _curYear(-1), _inModification(false)
{ {
Init(kiss, parent, 0); Init(kiss, parent, 0);
} }
AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent, int month=-1, int year=-1, int mode=VIRTUAL_MODE) : KissPanel(kiss, parent), _curMonth(month), _curYear(year), _inModification(false) AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution, int month=-1, int year=-1, int mode=VIRTUAL_MODE) : KissPanel(kiss, parent, lowResolution), _curMonth(month), _curYear(year), _inModification(false)
{ {
Init(kiss, parent, mode); Init(kiss, parent, mode);
} }
@ -57,6 +58,9 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
std::vector<Category>::iterator categoryIt; std::vector<Category>::iterator categoryIt;
int nbCategories; int nbCategories;
_icons[KissPanel::LOW_RES_ICON] = USER_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = USER_ICON;
setLayout(hbox); setLayout(hbox);
_tree = new QTreeWidget(this); _tree = new QTreeWidget(this);
@ -234,19 +238,7 @@ KissPanel* AccountPanel::CreatePanel()
else if (_real->isChecked()) mode = REAL_MODE; else if (_real->isChecked()) mode = REAL_MODE;
else if (_check->isChecked()) mode = CHECK_MODE; else if (_check->isChecked()) mode = CHECK_MODE;
return new AccountPanel(_kiss, _wxUI, _curMonth, _curYear, mode); return new AccountPanel(_kiss, _wxUI, _lowResolution, _curMonth, _curYear, mode);
}
QPushButton* AccountPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(USER_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString AccountPanel::GetToolTip() QString AccountPanel::GetToolTip()

View File

@ -39,13 +39,13 @@ class AccountPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
AccountPanel(KissCount* kiss, wxUI *parent); AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
AccountPanel(KissCount* kiss, wxUI *parent, int month, int year, int mode); AccountPanel(KissCount* kiss, wxUI *parent, bool lowResolution, int month, int year, int mode);
void Init(KissCount* kiss, wxUI *parent, int curMode);
~AccountPanel(); ~AccountPanel();
void Init(KissCount* kiss, wxUI *parent, int curMode);
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -19,7 +19,8 @@
#include "ExportPanel.hpp" #include "ExportPanel.hpp"
ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(0) ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution), _operations(0)
{ {
DEFAULT_FONT(font); DEFAULT_FONT(font);
std::vector<Account>::iterator accountIt; std::vector<Account>::iterator accountIt;
@ -29,6 +30,9 @@ ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent
QVBoxLayout *vbox2 = new QVBoxLayout; QVBoxLayout *vbox2 = new QVBoxLayout;
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
_icons[KissPanel::LOW_RES_ICON] = EXPORT_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = EXPORT_ICON;
setLayout(vbox); setLayout(vbox);
_searchButton = new QPushButton(_("Search")); _searchButton = new QPushButton(_("Search"));
@ -61,19 +65,7 @@ ExportPanel::~ExportPanel()
KissPanel* ExportPanel::CreatePanel() KissPanel* ExportPanel::CreatePanel()
{ {
return new ExportPanel(_kiss, _wxUI); return new ExportPanel(_kiss, _wxUI, _lowResolution);
}
QPushButton* ExportPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(EXPORT_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString ExportPanel::GetToolTip() QString ExportPanel::GetToolTip()

View File

@ -38,11 +38,10 @@ class ExportPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
ExportPanel(KissCount* kiss, wxUI *parent); ExportPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
~ExportPanel(); ~ExportPanel();
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -22,7 +22,8 @@
#include "ImportPanel.hpp" #include "ImportPanel.hpp"
#include "grid/ChoiceDelegate.hpp" #include "grid/ChoiceDelegate.hpp"
ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent) ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution)
{ {
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
QVBoxLayout *vbox2 = new QVBoxLayout; QVBoxLayout *vbox2 = new QVBoxLayout;
@ -32,6 +33,9 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent
QGroupBox* staticAccount = new QGroupBox(_("Unresolved accounts")); QGroupBox* staticAccount = new QGroupBox(_("Unresolved accounts"));
QGroupBox* staticCategory = new QGroupBox(_("Unresolved categories")); QGroupBox* staticCategory = new QGroupBox(_("Unresolved categories"));
_icons[KissPanel::LOW_RES_ICON] = IMPORT_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = IMPORT_ICON;
setLayout(vbox); setLayout(vbox);
_fileTxt = new QLineEdit; _fileTxt = new QLineEdit;
@ -101,19 +105,7 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent
KissPanel* ImportPanel::CreatePanel() KissPanel* ImportPanel::CreatePanel()
{ {
return new ImportPanel(_kiss, _wxUI); return new ImportPanel(_kiss, _wxUI, _lowResolution);
}
QPushButton* ImportPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(IMPORT_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString ImportPanel::GetToolTip() QString ImportPanel::GetToolTip()

View File

@ -33,10 +33,9 @@ class ImportPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
ImportPanel(KissCount* kiss, wxUI *parent); ImportPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -26,7 +26,7 @@
enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, ACCOUNT_HIDDEN, NUMBER_COLS_ACCOUNT}; enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_VIRTUAL, ACCOUNT_BLOCKED, ACCOUNT_DELETE, ACCOUNT_HIDDEN, NUMBER_COLS_ACCOUNT};
enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY}; enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY};
PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _sharedWith(0), _curAccountRow(-1), _defaultSignalMapper(this), _virtualSignalMapper(this), _blockedSignalMapper(this), _deleteAccountSignalMapper(this), _deleteCategorySignalMapper(this), _backgroundColorSignalMapper(this), _foregroundColorSignalMapper(this), _fontSignalMapper(this), _inModification(false) PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent, bool lowResolution) : KissPanel(kiss, parent, lowResolution), _sharedWith(0), _curAccountRow(-1), _defaultSignalMapper(this), _virtualSignalMapper(this), _blockedSignalMapper(this), _deleteAccountSignalMapper(this), _deleteCategorySignalMapper(this), _backgroundColorSignalMapper(this), _foregroundColorSignalMapper(this), _fontSignalMapper(this), _inModification(false)
{ {
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout *hbox1 = new QHBoxLayout; QHBoxLayout *hbox1 = new QHBoxLayout;
@ -41,6 +41,9 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
std::list<QString> users; std::list<QString> users;
std::list<QString>::iterator it; std::list<QString>::iterator it;
_icons[KissPanel::LOW_RES_ICON] = PREFS_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = PREFS_ICON;
setLayout(vbox); setLayout(vbox);
staticUser = new QGroupBox(_("User")); staticUser = new QGroupBox(_("User"));
@ -183,19 +186,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
KissPanel* PreferencesPanel::CreatePanel() KissPanel* PreferencesPanel::CreatePanel()
{ {
return new PreferencesPanel(_kiss, _wxUI); return new PreferencesPanel(_kiss, _wxUI, _lowResolution);
}
QPushButton* PreferencesPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(PREFS_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString PreferencesPanel::GetToolTip() QString PreferencesPanel::GetToolTip()

View File

@ -31,10 +31,9 @@ class PreferencesPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
PreferencesPanel(KissCount* kiss, wxUI *parent); PreferencesPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -19,7 +19,8 @@
#include "SearchPanel.hpp" #include "SearchPanel.hpp"
SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _operations(0) SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution), _operations(0)
{ {
DEFAULT_FONT(font); DEFAULT_FONT(font);
std::vector<Account>::iterator accountIt; std::vector<Account>::iterator accountIt;
@ -29,6 +30,9 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent
QVBoxLayout *vbox2 = new QVBoxLayout; QVBoxLayout *vbox2 = new QVBoxLayout;
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
_icons[KissPanel::LOW_RES_ICON] = SEARCH_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = SEARCH_ICON;
setLayout(vbox); setLayout(vbox);
_searchButton = new QPushButton(_("Search")); _searchButton = new QPushButton(_("Search"));
@ -67,19 +71,7 @@ SearchPanel::~SearchPanel()
KissPanel* SearchPanel::CreatePanel() KissPanel* SearchPanel::CreatePanel()
{ {
return new SearchPanel(_kiss, _wxUI); return new SearchPanel(_kiss, _wxUI, _lowResolution);
}
QPushButton* SearchPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(SEARCH_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString SearchPanel::GetToolTip() QString SearchPanel::GetToolTip()

View File

@ -36,11 +36,10 @@ class SearchPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
SearchPanel(KissCount* kiss, wxUI *parent); SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
~SearchPanel(); ~SearchPanel();
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -25,7 +25,8 @@
#include "StatsPanel.hpp" #include "StatsPanel.hpp"
StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent), _plot(0) StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution), _plot(0)
{ {
QHBoxLayout *hbox = new QHBoxLayout(); QHBoxLayout *hbox = new QHBoxLayout();
QVBoxLayout *vbox = new QVBoxLayout(); QVBoxLayout *vbox = new QVBoxLayout();
@ -41,6 +42,9 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent),
int nbCategories; int nbCategories;
QListWidgetItem* item; QListWidgetItem* item;
_icons[KissPanel::LOW_RES_ICON] = STATS_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = STATS_ICON;
setLayout(vbox); setLayout(vbox);
_monthFrom = new QComboBox(parent); _monthFrom = new QComboBox(parent);
@ -195,19 +199,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent),
KissPanel* StatsPanel::CreatePanel() KissPanel* StatsPanel::CreatePanel()
{ {
return new StatsPanel(_kiss, _wxUI); return new StatsPanel(_kiss, _wxUI, _lowResolution);
}
QPushButton* StatsPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(STATS_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
} }
QString StatsPanel::GetToolTip() QString StatsPanel::GetToolTip()

View File

@ -31,10 +31,9 @@ class StatsPanel: public KissPanel
Q_OBJECT; Q_OBJECT;
public: public:
StatsPanel(KissCount* kiss, wxUI *parent); StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
KissPanel* CreatePanel(); KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip(); QString GetToolTip();
void OnShow(); void OnShow();

View File

@ -34,6 +34,7 @@ namespace view {
#define DELETE_ICON RESSOURCES_ROOT "icons/delete.png" #define DELETE_ICON RESSOURCES_ROOT "icons/delete.png"
#define CHECKED_ICON RESSOURCES_ROOT "icons/check.png" #define CHECKED_ICON RESSOURCES_ROOT "icons/check.png"
#define USER_ICON RESSOURCES_ROOT "icons/user.png" #define USER_ICON RESSOURCES_ROOT "icons/user.png"
#define STATS_ICON RESSOURCES_ROOT "icons/charts.png" #define STATS_ICON RESSOURCES_ROOT "icons/charts.png"
#define SEARCH_ICON RESSOURCES_ROOT "icons/search.png" #define SEARCH_ICON RESSOURCES_ROOT "icons/search.png"
@ -44,6 +45,16 @@ namespace view {
#define ABOUT_ICON RESSOURCES_ROOT "icons/about.png" #define ABOUT_ICON RESSOURCES_ROOT "icons/about.png"
#define QUIT_ICON RESSOURCES_ROOT "icons/exit.png" #define QUIT_ICON RESSOURCES_ROOT "icons/exit.png"
#define USER_LOW_ICON RESSOURCES_ROOT "icons/user_low.png"
#define STATS_LOW_ICON RESSOURCES_ROOT "icons/charts_low.png"
#define SEARCH_LOW_ICON RESSOURCES_ROOT "icons/search_low.png"
#define PREFS_LOW_ICON RESSOURCES_ROOT "icons/preferences_low.png"
#define IMPORT_LOW_ICON RESSOURCES_ROOT "icons/import_low.png"
#define EXPORT_LOW_ICON RESSOURCES_ROOT "icons/export_low.png"
#define CHANGE_USER_LOW_ICON RESSOURCES_ROOT "icons/switch_user_low.png"
#define ABOUT_LOW_ICON RESSOURCES_ROOT "icons/about_low.png"
#define QUIT_LOW_ICON RESSOURCES_ROOT "icons/exit_low.png"
#define LANG_ROOT RESSOURCES_ROOT "po/" #define LANG_ROOT RESSOURCES_ROOT "po/"
#endif #endif

View File

@ -31,6 +31,8 @@
#include "UsersDialog.hpp" #include "UsersDialog.hpp"
#include <QDesktopWidget>
QString wxUI::months[12] ; QString wxUI::months[12] ;
QColor wxUI::categoryColors[MAX_CATEGORY] = {QColor(0x00, 0x45, 0x86), QColor wxUI::categoryColors[MAX_CATEGORY] = {QColor(0x00, 0x45, 0x86),
QColor(0xFF, 0x3E, 0x0E), QColor(0xFF, 0x3E, 0x0E),
@ -51,6 +53,11 @@ wxUI::wxUI(KissCount* kiss, const QString& title)
_needReload(false) _needReload(false)
{ {
QPushButton* button; QPushButton* button;
QDesktopWidget desk;
bool lowRes;
int w;
lowRes = (desk.availableGeometry().width() <= 1024);
SetLanguage(""); SetLanguage("");
@ -61,21 +68,23 @@ wxUI::wxUI(KissCount* kiss, const QString& title)
_vbox = new QVBoxLayout; _vbox = new QVBoxLayout;
_buttonsBox = new QHBoxLayout; _buttonsBox = new QHBoxLayout;
button = new QPushButton(QIcon(CHANGE_USER_ICON), "", this); w = (lowRes) ? 64 : 128;
button->setFixedSize(128, 128);
button->setIconSize(QSize(128, 128)); button = new QPushButton(QIcon(lowRes ? CHANGE_USER_LOW_ICON : CHANGE_USER_ICON), "", this);
button->setFixedSize(w, w);
button->setIconSize(QSize(w, w));
connect(button, SIGNAL(clicked()), this, SLOT(OnButtonChangeUser())); connect(button, SIGNAL(clicked()), this, SLOT(OnButtonChangeUser()));
_buttonsBox->addWidget(button); _buttonsBox->addWidget(button);
button = new QPushButton(QIcon(ABOUT_ICON), "", this); button = new QPushButton(QIcon(lowRes ? ABOUT_LOW_ICON : ABOUT_ICON), "", this);
button->setFixedSize(128, 128); button->setFixedSize(w, w);
button->setIconSize(QSize(128, 128)); button->setIconSize(QSize(w, w));
connect(button, SIGNAL(clicked()), this, SLOT(OnButtonAbout())); connect(button, SIGNAL(clicked()), this, SLOT(OnButtonAbout()));
_buttonsBox->addWidget(button); _buttonsBox->addWidget(button);
button = new QPushButton(QIcon(QUIT_ICON), "", this); button = new QPushButton(QIcon(lowRes ? QUIT_LOW_ICON : QUIT_ICON), "", this);
button->setFixedSize(128, 128); button->setFixedSize(w, w);
button->setIconSize(QSize(128, 128)); button->setIconSize(QSize(w, w));
connect(button, SIGNAL(clicked()), this, SLOT(OnButtonQuit())); connect(button, SIGNAL(clicked()), this, SLOT(OnButtonQuit()));
_buttonsBox->addWidget(button); _buttonsBox->addWidget(button);
@ -169,14 +178,14 @@ bool wxUI::SetLanguage(QString language)
} }
#define ADD_PANEL(panelName) \ #define ADD_PANEL(panelName) \
panel = new panelName(_kiss, this); \ panel = new panelName(_kiss, this, lowRes); \
button = panel->GetButton(); \ button = panel->GetButton(); \
button->setToolTip(panel->GetToolTip()); \ button->setToolTip(panel->GetToolTip()); \
_buttonsBox->insertWidget(id, button); \ _buttonsBox->insertWidget(id, button); \
_buttons.insert(_buttons.begin()+id, button); \ _buttons.insert(_buttons.begin()+id, button); \
_panels.push_back(panel); \ _panels.push_back(panel); \
_signalMapper.setMapping(button, id); \ _signalMapper.setMapping(button, id); \
connect(button, SIGNAL(clicked()), &_signalMapper, SLOT(map())); \ connect(button, SIGNAL(clicked()), &_signalMapper, SLOT(map())); \
id++; id++;
void wxUI::InitPanels() void wxUI::InitPanels()
@ -185,6 +194,10 @@ void wxUI::InitPanels()
QPushButton* button; QPushButton* button;
_panels.clear(); _panels.clear();
int id=0; int id=0;
QDesktopWidget desk;
bool lowRes;
lowRes = (desk.availableGeometry().width() <= 1024);
ADD_PANEL(AccountPanel); ADD_PANEL(AccountPanel);
ADD_PANEL(StatsPanel); ADD_PANEL(StatsPanel);

View File

@ -105,7 +105,7 @@ private:
class KissPanel: public QFrame class KissPanel: public QFrame
{ {
public: public:
KissPanel(KissCount* kiss, wxUI* parent) : KissPanel(KissCount* kiss, wxUI* parent, bool lowResolution=false) :
QFrame(static_cast<QWidget*>(parent)), QFrame(static_cast<QWidget*>(parent)),
_kiss(kiss), _kiss(kiss),
_wxUI(parent), _wxUI(parent),
@ -114,17 +114,37 @@ public:
DEFAULT_FONT(font); DEFAULT_FONT(font);
hide(); hide();
setFont(font); setFont(font);
_lowResolution = lowResolution;
} }
virtual void OnShow()=0; virtual void OnShow()=0;
virtual KissPanel* CreatePanel()=0; virtual KissPanel* CreatePanel()=0;
virtual QPushButton* GetButton() {return 0;} virtual QPushButton* GetButton() {return createButton();}
virtual QString GetToolTip() {return "";} virtual QString GetToolTip() {return "";}
protected: protected:
KissCount* _kiss; KissCount* _kiss;
wxUI* _wxUI; wxUI* _wxUI;
QPushButton* _KissButton; QPushButton* _KissButton;
bool _lowResolution;
enum {LOW_RES_ICON=0, HIGH_RES_ICON, NB_ICONS};
QString _icons[NB_ICONS];
QPushButton* createButton()
{
int w;
if (!_KissButton)
{
w = (_lowResolution) ? 64 : 128;
_KissButton = new QPushButton(QIcon(_icons[(_lowResolution) ? LOW_RES_ICON : HIGH_RES_ICON]), "", this);
_KissButton->setFixedSize(w, w);
_KissButton->setIconSize(QSize(w, w));
}
return _KissButton;
}
}; };
#endif #endif