Add primitive support of low resolutions

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

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,14 +178,14 @@ 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); \
_buttons.insert(_buttons.begin()+id, button); \
_panels.push_back(panel); \
_signalMapper.setMapping(button, id); \
connect(button, SIGNAL(clicked()), &_signalMapper, SLOT(map())); \
connect(button, SIGNAL(clicked()), &_signalMapper, SLOT(map())); \
id++;
void wxUI::InitPanels()
@@ -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);