Merge branch 'dev' of cybelle:kisscount into dev

This commit is contained in:
Grégory Soutadé 2012-08-03 21:00:52 +02:00
commit df4228d799
25 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)
** User **
New interface in Qt4

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

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};
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);
}
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);
}
@ -57,6 +58,9 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
std::vector<Category>::iterator categoryIt;
int nbCategories;
_icons[KissPanel::LOW_RES_ICON] = USER_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = USER_ICON;
setLayout(hbox);
_tree = new QTreeWidget(this);
@ -234,19 +238,7 @@ KissPanel* AccountPanel::CreatePanel()
else if (_real->isChecked()) mode = REAL_MODE;
else if (_check->isChecked()) mode = CHECK_MODE;
return new AccountPanel(_kiss, _wxUI, _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;
return new AccountPanel(_kiss, _wxUI, _lowResolution, _curMonth, _curYear, mode);
}
QString AccountPanel::GetToolTip()

View File

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

View File

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

View File

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

View File

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

View File

@ -33,10 +33,9 @@ class ImportPanel: public KissPanel
Q_OBJECT;
public:
ImportPanel(KissCount* kiss, wxUI *parent);
ImportPanel(KissCount* kiss, wxUI *parent, bool lowResolution);
KissPanel* CreatePanel();
QPushButton* GetButton();
QString GetToolTip();
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 {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;
QHBoxLayout *hbox1 = new QHBoxLayout;
@ -41,6 +41,9 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
std::list<QString> users;
std::list<QString>::iterator it;
_icons[KissPanel::LOW_RES_ICON] = PREFS_LOW_ICON;
_icons[KissPanel::HIGH_RES_ICON] = PREFS_ICON;
setLayout(vbox);
staticUser = new QGroupBox(_("User"));
@ -183,19 +186,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent) : KissPanel(ki
KissPanel* PreferencesPanel::CreatePanel()
{
return new PreferencesPanel(_kiss, _wxUI);
}
QPushButton* PreferencesPanel::GetButton()
{
if (!_KissButton)
{
_KissButton = new QPushButton(QIcon(PREFS_ICON), "", this);
_KissButton->setFixedSize(128, 128);
_KissButton->setIconSize(QSize(128, 128));
}
return _KissButton;
return new PreferencesPanel(_kiss, _wxUI, _lowResolution);
}
QString PreferencesPanel::GetToolTip()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,6 +34,7 @@ namespace view {
#define DELETE_ICON RESSOURCES_ROOT "icons/delete.png"
#define CHECKED_ICON RESSOURCES_ROOT "icons/check.png"
#define USER_ICON RESSOURCES_ROOT "icons/user.png"
#define STATS_ICON RESSOURCES_ROOT "icons/charts.png"
#define SEARCH_ICON RESSOURCES_ROOT "icons/search.png"
@ -44,6 +45,16 @@ namespace view {
#define ABOUT_ICON RESSOURCES_ROOT "icons/about.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/"
#endif

View File

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

View File

@ -105,7 +105,7 @@ private:
class KissPanel: public QFrame
{
public:
KissPanel(KissCount* kiss, wxUI* parent) :
KissPanel(KissCount* kiss, wxUI* parent, bool lowResolution=false) :
QFrame(static_cast<QWidget*>(parent)),
_kiss(kiss),
_wxUI(parent),
@ -114,17 +114,37 @@ public:
DEFAULT_FONT(font);
hide();
setFont(font);
_lowResolution = lowResolution;
}
virtual void OnShow()=0;
virtual KissPanel* CreatePanel()=0;
virtual QPushButton* GetButton() {return 0;}
virtual QPushButton* GetButton() {return createButton();}
virtual QString GetToolTip() {return "";}
protected:
KissCount* _kiss;
wxUI* _wxUI;
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