diff --git a/Makefile b/Makefile index fd6170d..ed9e175 100644 --- a/Makefile +++ b/Makefile @@ -17,25 +17,33 @@ LDFLAGS+=-lxml2 CXX=$(HOST)g++ -MOC_HEADERS=$(shell find src/view -name '*.hpp' -type f | tr '\n' ' ') SOURCES=$(shell find src -name '*.cpp' -type f | tr '\n' ' ') -MOCS=$(MOC_HEADERS:.hpp=.moc) OBJS=$(SOURCES:.cpp=.o) +MOC_HEADERS=$(shell find src/view -name '*.hpp' -type f | tr '\n' ' ') +MOCS=$(MOC_HEADERS:.hpp=.objs) +MOCS_OBJS=$(MOC_HEADERS:.hpp=.moc) -all: kc +all: mojito kc clean: find src -type f -name '*.[o~]' -exec rm -f \{\} \; find src -type f -name '*.moc' -exec rm -f \{\} \; + find src -type f -name '*.objs' -exec rm -f \{\} \; rm -f kc -%.o : $(MOCS) $(SOURCES) - $(CXX) $(CXXFLAGS) -c $< +%.o : %.cpp + $(CXX) $(CXXFLAGS) -c $< -o $@ -%.moc : src/view/%.hpp - moc -nw $^ -o $< +%.objs : %.moc + $(CXX) $(CXXFLAGS) -x c++ $< -c -o $@ -kc: $(OBJS) +%.moc : %.hpp + moc -nw $< -o $@ + +mojito : $(MOCS_OBJS) + + +kc: $(MOCS) $(OBJS) $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) generate_locales: diff --git a/src/view/KissPanel.hpp b/src/view/KissPanel.hpp deleted file mode 100644 index 8c83aba..0000000 --- a/src/view/KissPanel.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright 2010-2011 Grégory Soutadé - - This file is part of KissCount. - - 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. - - 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. - - You should have received a copy of the GNU General Public License - along with KissCount. If not, see . -*/ - -#ifndef KISSPANEL_H -#define KISSPANEL_H - - -#endif diff --git a/src/view/view.hpp b/src/view/view.hpp index 205cb64..61aa5e2 100644 --- a/src/view/view.hpp +++ b/src/view/view.hpp @@ -46,6 +46,4 @@ namespace view { #define LANG_ROOT RESSOURCES_ROOT "po/" -#include "KissPanel.hpp" - #endif diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 957bb13..41c4ae9 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -17,6 +17,8 @@ along with KissCount. If not, see . */ +#include + /*#include "AccountPanel.hpp" #include "PreferencesPanel.hpp" #include "UsersDialog.hpp" @@ -35,8 +37,6 @@ #include "UsersDialog.hpp" -enum {BUTTON_CHANGE_USER_ID=-4, BUTTON_ABOUT_ID=-5, BUTTON_QUIT_ID=-6}; - QString wxUI::months[12] ; QColor wxUI::categoryColors[MAX_CATEGORY] = {QColor(0x00, 0x45, 0x86), QColor(0xFF, 0x3E, 0x0E), @@ -240,12 +240,12 @@ void wxUI::ShowPanel(KissPanel* panel) // Layout(); } -void wxUI::OnButtonClicked(QEvent& event) +void wxUI::OnButtonClicked() { // ShowPanel(_panels[event.GetId()]); } -void wxUI::OnButtonChangeUser(QEvent& event) +void wxUI::OnButtonChangeUser() { ChangeUser(); } @@ -256,22 +256,15 @@ void wxUI::ChangeUser() u.exec(); } -void wxUI::OnButtonAbout(QEvent& event) +void wxUI::OnButtonAbout() { - // wxMessageBox( _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010-2011 Grégory Soutadé"), - // wxT("KissCount " APP_VERSION "\n\n"), - // wxOK | wxICON_INFORMATION, this ); + QMessageBox::information(this, "KissCount " APP_VERSION, _("Personal accounting software\n\nhttp://indefero.soutade.fr/p/kisscount/\n\nLicenced under GNU GPL v3\n\nCopyright (C) 2010-2011 Grégory Soutadé")); } -void wxUI::OnButtonQuit(QEvent& event) +void wxUI::OnButtonQuit() { - // wxMessageDialog dialog(this, _("Quit KissCount ?"), wxT("KissCount"), wxYES_NO); - // if (dialog.ShowModal() == wxID_NO) - // { - // return; - // } - - // Close(true); + if (QMessageBox::question(this, "KissCount", _("Quit KissCount ?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) + close(); } void wxUI::GenerateMonth(int month, int year) diff --git a/src/view/wxUI.hpp b/src/view/wxUI.hpp index 13b8559..5dadfe6 100644 --- a/src/view/wxUI.hpp +++ b/src/view/wxUI.hpp @@ -42,6 +42,8 @@ class PreferencesPanel; class wxUI: public QFrame { + Q_OBJECT; + public: static const int MAX_CATEGORY = 12; static QString months[MAX_CATEGORY]; @@ -67,10 +69,11 @@ public: int _language; - void OnButtonClicked(QEvent& event); - void OnButtonChangeUser(QEvent& event); - void OnButtonAbout(QEvent& event); - void OnButtonQuit(QEvent& event); +private slots: + void OnButtonClicked(); + void OnButtonChangeUser(); + void OnButtonAbout(); + void OnButtonQuit(); private: KissCount *_kiss;