2010-07-10 16:34:30 +02:00
|
|
|
/*
|
2011-01-29 13:04:15 +01:00
|
|
|
Copyright 2010-2011 Grégory Soutadé
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
This file is part of KissCount.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
KissCount is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
KissCount is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2010-07-10 16:34:30 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with KissCount. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-10 16:34:30 +02:00
|
|
|
*/
|
|
|
|
|
2010-05-14 15:04:01 +02:00
|
|
|
#ifndef WXUI_H
|
|
|
|
#define WXUI_H
|
|
|
|
|
2011-03-13 19:15:21 +01:00
|
|
|
class ImportEngine;
|
|
|
|
|
2011-08-25 17:45:41 +02:00
|
|
|
#include <QFrame>
|
|
|
|
#include <QLocale>
|
2011-09-04 11:21:30 +02:00
|
|
|
#include <QHBoxLayout>
|
2011-08-25 17:45:41 +02:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QScrollArea>
|
|
|
|
#include <QPushButton>
|
2011-09-04 19:25:53 +02:00
|
|
|
#include <QSignalMapper>
|
2011-08-25 17:45:41 +02:00
|
|
|
|
2011-08-20 14:02:47 +02:00
|
|
|
#include <controller/KissCount.hpp>
|
2011-08-20 11:43:12 +02:00
|
|
|
|
2011-11-05 18:28:05 +01:00
|
|
|
#include "view.hpp"
|
|
|
|
|
2011-08-25 17:45:41 +02:00
|
|
|
#include <qtranslator.h>
|
|
|
|
#include <qtextcodec.h>
|
2010-05-14 15:04:01 +02:00
|
|
|
|
2011-09-04 11:21:30 +02:00
|
|
|
#define _(s) QObject::trUtf8(s)
|
2011-02-05 21:02:03 +01:00
|
|
|
|
2010-05-14 15:04:01 +02:00
|
|
|
class KissCount;
|
2011-08-20 11:43:12 +02:00
|
|
|
class KissPanel;
|
2010-05-14 15:04:01 +02:00
|
|
|
class AccountPanel;
|
2010-05-17 18:03:21 +02:00
|
|
|
class PreferencesPanel;
|
2010-05-14 15:04:01 +02:00
|
|
|
|
2011-08-25 17:45:41 +02:00
|
|
|
class wxUI: public QFrame
|
2010-05-14 15:04:01 +02:00
|
|
|
{
|
2011-09-03 20:40:21 +02:00
|
|
|
Q_OBJECT;
|
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
public:
|
2011-08-16 18:22:35 +02:00
|
|
|
static const int MAX_CATEGORY = 12;
|
2011-08-27 18:35:36 +02:00
|
|
|
static QString months[MAX_CATEGORY];
|
2011-08-25 17:45:41 +02:00
|
|
|
static QColor categoryColors[MAX_CATEGORY];
|
2010-05-14 15:04:01 +02:00
|
|
|
|
2011-08-25 17:45:41 +02:00
|
|
|
wxUI(KissCount* kiss, const QString& title);
|
2010-08-26 21:28:15 +02:00
|
|
|
~wxUI();
|
2010-05-14 15:04:01 +02:00
|
|
|
|
2011-08-27 18:35:36 +02:00
|
|
|
bool SetLanguage(QString language);
|
2010-05-14 15:04:01 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
void ChangeUser();
|
|
|
|
void LoadUser();
|
2010-05-16 10:35:34 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
void ShowAccount();
|
|
|
|
void ShowSearch();
|
|
|
|
void ShowPreferences();
|
|
|
|
void GenerateMonth(int month, int year);
|
2011-11-01 18:01:17 +01:00
|
|
|
void UpdateStats();
|
2010-05-17 18:03:21 +02:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
void KillMe();
|
2010-06-27 21:39:49 +02:00
|
|
|
|
2010-12-20 19:28:24 +01:00
|
|
|
void ShowPanel(KissPanel* panel);
|
2010-08-26 21:28:15 +02:00
|
|
|
void NeedReload();
|
2010-06-27 21:39:49 +02:00
|
|
|
|
2011-08-25 17:45:41 +02:00
|
|
|
int _language;
|
2010-07-07 21:04:38 +02:00
|
|
|
|
2011-09-03 20:40:21 +02:00
|
|
|
private slots:
|
2011-09-04 19:25:53 +02:00
|
|
|
void OnButtonClicked(int id);
|
2011-09-03 20:40:21 +02:00
|
|
|
void OnButtonChangeUser();
|
|
|
|
void OnButtonAbout();
|
|
|
|
void OnButtonQuit();
|
2010-12-20 19:28:24 +01:00
|
|
|
|
2010-08-26 21:28:15 +02:00
|
|
|
private:
|
|
|
|
KissCount *_kiss;
|
2011-09-04 19:25:53 +02:00
|
|
|
QSignalMapper _signalMapper;
|
2011-09-04 11:21:30 +02:00
|
|
|
QVBoxLayout *_vbox;
|
|
|
|
QHBoxLayout *_buttonsBox;
|
2010-12-20 19:28:24 +01:00
|
|
|
KissPanel *_curPanel;
|
|
|
|
std::vector<KissPanel*> _panels;
|
2011-08-25 17:45:41 +02:00
|
|
|
std::vector<QPushButton*> _buttons;
|
|
|
|
QLocale *_locale;
|
2010-08-26 21:28:15 +02:00
|
|
|
bool _needReload;
|
2010-12-20 19:28:24 +01:00
|
|
|
|
|
|
|
void InitPanels();
|
|
|
|
void LoadPanels();
|
2011-08-25 17:45:41 +02:00
|
|
|
};
|
2010-12-20 19:28:24 +01:00
|
|
|
|
2011-10-31 10:56:46 +01:00
|
|
|
class KissPanel: public QFrame
|
2011-08-25 17:45:41 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
KissPanel(KissCount* kiss, wxUI* parent) :
|
2011-10-31 10:56:46 +01:00
|
|
|
QFrame(static_cast<QWidget*>(parent)),
|
2011-08-25 17:45:41 +02:00
|
|
|
_kiss(kiss),
|
|
|
|
_wxUI(parent),
|
|
|
|
_KissButton(0)
|
2011-11-05 18:28:05 +01:00
|
|
|
{
|
|
|
|
DEFAULT_FONT(font);
|
|
|
|
hide();
|
|
|
|
setFont(font);
|
|
|
|
}
|
2011-08-25 17:45:41 +02:00
|
|
|
|
2011-09-04 19:25:53 +02:00
|
|
|
virtual void OnShow()=0;
|
2011-08-25 17:45:41 +02:00
|
|
|
virtual KissPanel* CreatePanel()=0;
|
2011-09-04 19:25:53 +02:00
|
|
|
virtual QPushButton* GetButton() {return 0;}
|
2011-08-27 18:35:36 +02:00
|
|
|
virtual QString GetToolTip() {return "";}
|
2011-08-25 17:45:41 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
KissCount* _kiss;
|
|
|
|
wxUI* _wxUI;
|
|
|
|
QPushButton* _KissButton;
|
2010-05-14 15:04:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|