move remaining helper classes to iface and dialogs
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Mon, 28 Dec 2009 14:19:31 +0000 (14:19 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Mon, 28 Dec 2009 14:19:31 +0000 (14:19 +0000)
git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@363 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

14 files changed:
src/README
src/dialogs/customerdlg.cpp [moved from src/customer.cpp with 89% similarity]
src/dialogs/customerdlg.h [moved from src/customer.h with 68% similarity]
src/dialogs/dialogs.pri
src/dialogs/shipping.cpp [moved from src/shipping.cpp with 100% similarity]
src/dialogs/shipping.h [moved from src/shipping.h with 100% similarity]
src/iface/customer.cpp [new file with mode: 0644]
src/iface/customer.h [new file with mode: 0644]
src/iface/event.cpp [moved from src/event.cpp with 100% similarity]
src/iface/event.h [moved from src/event.h with 100% similarity]
src/iface/iface.pri
src/iface/order.cpp [moved from src/order.cpp with 100% similarity]
src/iface/order.h [moved from src/order.h with 100% similarity]
src/smoke.pro

index 473d435..3a6b138 100644 (file)
@@ -4,7 +4,7 @@ README for src Directory
 The following (sub-)directories exist:
 
 .
-  main build directory, contains main widget and some global classes
+  main build directory, contains main application stub
 
 wbase
   Web object base classes.
similarity index 89%
rename from src/customer.cpp
rename to src/dialogs/customerdlg.cpp
index aed971b..c15affa 100644 (file)
@@ -10,7 +10,7 @@
 //
 //
 
-#include "customer.h"
+#include "customerdlg.h"
 #include "msinterface.h"
 
 #include <QBoxLayout>
 
 #define req (MSInterface::instance())
 
-MCustomer::MCustomer(qint64 i)
-{
-       MTGetCustomer gc=req->queryGetCustomer(i);
-       if(gc.stage()==gc.Success)
-               operator=(gc.getcustomer().value());
-}
-
-bool MCustomer::isValid()
-{
-       //TODO: reconsider isValid
-       return id()>-1;
-}
-
-QString MCustomer::address(int i)
-{
-       if(i<0)return "";
-       QList<MOAddress>adrs=addresses();
-       if(i>=adrs.size())return "";
-       QString ret;
-       MOAddress adr=adrs[i];
-       if(adr.name().isNull())ret=name();
-       else ret=adr.name().value();
-       ret+="\n";
-       if(!adr.company().isNull())ret+=adr.company().value()+"\n";
-       if(!adr.addr1().isNull())ret+=adr.addr1().value()+"\n";
-       if(!adr.addr2().isNull())ret+=adr.addr2().value()+"\n";
-       if(!adr.city().isNull())ret+=adr.city().value()+"\n";
-       if(!adr.state().isNull())ret+=adr.state().value()+"\n";
-       if(!adr.zipcode().isNull())ret+=adr.zipcode().value()+"\n";
-       if(!adr.country().isNull())ret+=adr.country().value().name();
-       return ret;
-}
-
-
-/*********************************************************/
-
 MCustomerListDialog::MCustomerListDialog(QWidget*par,bool isselect,qint64 presel)
        :QDialog(par)
 {
similarity index 68%
rename from src/customer.h
rename to src/dialogs/customerdlg.h
index 3653381..cc242f2 100644 (file)
 //
 //
 
-#ifndef MAGICSMOKE_CUSTOMER_H
-#define MAGICSMOKE_CUSTOMER_H
+#ifndef MAGICSMOKE_CUSTOMERDLG_H
+#define MAGICSMOKE_CUSTOMERDLG_H
 
 #include <QString>
 #include <QDialog>
 #include <QList>
 
-#include "MOCustomerShort.h"
-#include "MOCustomer.h"
-
-/**this class expands on MOCustomer to add some convenience methods*/
-class MCustomer:public MOCustomer
-{
-       public:
-               /**creates an empty/invalid customer*/
-               MCustomer(){}
-               /**fetches customer from the Database*/
-               MCustomer(qint64);
-               /**copies a customer*/
-               MCustomer(const MCustomer&c):MOCustomer(c){}
-               MCustomer(const MOCustomer&c):MOCustomer(c){}
-               
-               /**copies a customer*/
-               MCustomer& operator=(const MCustomer&c){MOCustomer::operator=(c);return *this;}
-               MCustomer& operator=(const MOCustomer&c){MOCustomer::operator=(c);return *this;}
-               
-               /**returns whether the customer is valid*/
-               bool isValid();
-               
-               /**returns the address of the customer*/
-               QString address(int i=0);
-};
+#include "customer.h"
 
 class QListView;
 class QStandardItemModel;
index b18df66..c5377a2 100644 (file)
@@ -5,6 +5,8 @@ HEADERS += \
        dialogs/orderwin.h \
        dialogs/moneylog.h \
        dialogs/login.h \
+       dialogs/shipping.h \
+       dialogs/customerdlg.h \
        dialogs/passwdchg.h
 
 SOURCES += \
@@ -14,6 +16,8 @@ SOURCES += \
        dialogs/orderwin.cpp \
        dialogs/moneylog.cpp \
        dialogs/login.cpp \
+       dialogs/shipping.cpp \
+       dialogs/customerdlg.cpp \
        dialogs/passwdchg.cpp
 
 INCLUDEPATH += ./dialogs
\ No newline at end of file
similarity index 100%
rename from src/shipping.cpp
rename to src/dialogs/shipping.cpp
similarity index 100%
rename from src/shipping.h
rename to src/dialogs/shipping.h
diff --git a/src/iface/customer.cpp b/src/iface/customer.cpp
new file mode 100644 (file)
index 0000000..281518e
--- /dev/null
@@ -0,0 +1,49 @@
+//
+// C++ Implementation: customer
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#include "customer.h"
+#include "msinterface.h"
+
+#define req (MSInterface::instance())
+
+MCustomer::MCustomer(qint64 i)
+{
+       MTGetCustomer gc=req->queryGetCustomer(i);
+       if(gc.stage()==gc.Success)
+               operator=(gc.getcustomer().value());
+}
+
+bool MCustomer::isValid()
+{
+       //TODO: reconsider isValid
+       return id()>-1;
+}
+
+QString MCustomer::address(int i)
+{
+       if(i<0)return "";
+       QList<MOAddress>adrs=addresses();
+       if(i>=adrs.size())return "";
+       QString ret;
+       MOAddress adr=adrs[i];
+       if(adr.name().isNull())ret=name();
+       else ret=adr.name().value();
+       ret+="\n";
+       if(!adr.company().isNull())ret+=adr.company().value()+"\n";
+       if(!adr.addr1().isNull())ret+=adr.addr1().value()+"\n";
+       if(!adr.addr2().isNull())ret+=adr.addr2().value()+"\n";
+       if(!adr.city().isNull())ret+=adr.city().value()+"\n";
+       if(!adr.state().isNull())ret+=adr.state().value()+"\n";
+       if(!adr.zipcode().isNull())ret+=adr.zipcode().value()+"\n";
+       if(!adr.country().isNull())ret+=adr.country().value().name();
+       return ret;
+}
diff --git a/src/iface/customer.h b/src/iface/customer.h
new file mode 100644 (file)
index 0000000..55c7589
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// C++ Interface: customer
+//
+// Description: 
+//
+//
+// Author: Konrad Rosenbaum <konrad@silmor.de>, (C) 2008
+//
+// Copyright: See README/COPYING files that come with this distribution
+//
+//
+
+#ifndef MAGICSMOKE_CUSTOMER_H
+#define MAGICSMOKE_CUSTOMER_H
+
+#include <QString>
+
+#include "MOCustomerShort.h"
+#include "MOCustomer.h"
+
+/**this class expands on MOCustomer to add some convenience methods*/
+class MCustomer:public MOCustomer
+{
+       public:
+               /**creates an empty/invalid customer*/
+               MCustomer(){}
+               /**fetches customer from the Database*/
+               MCustomer(qint64);
+               /**copies a customer*/
+               MCustomer(const MCustomer&c):MOCustomer(c){}
+               MCustomer(const MOCustomer&c):MOCustomer(c){}
+               
+               /**copies a customer*/
+               MCustomer& operator=(const MCustomer&c){MOCustomer::operator=(c);return *this;}
+               MCustomer& operator=(const MOCustomer&c){MOCustomer::operator=(c);return *this;}
+               
+               /**returns whether the customer is valid*/
+               bool isValid();
+               
+               /**returns the address of the customer*/
+               QString address(int i=0);
+};
+
+#endif
similarity index 100%
rename from src/event.cpp
rename to src/iface/event.cpp
similarity index 100%
rename from src/event.h
rename to src/iface/event.h
index ac98ba4..f38a1b1 100644 (file)
@@ -1,10 +1,16 @@
 HEADERS += \
        iface/msinterface.h \
-       iface/sslexception.h
+       iface/event.h \
+       iface/order.h \
+       iface/sslexception.h \
+       iface/customer.h
        
 
 SOURCES += \
        iface/msinterface.cpp \
-       iface/sslexception.cpp
+       iface/event.cpp \
+       iface/order.cpp \
+       iface/sslexception.cpp \
+       iface/customer.cpp
 
 INCLUDEPATH += ./iface
\ No newline at end of file
similarity index 100%
rename from src/order.cpp
rename to src/iface/order.cpp
similarity index 100%
rename from src/order.h
rename to src/iface/order.h
index f487a77..1200bd8 100644 (file)
@@ -20,19 +20,8 @@ MOC_DIR = .ctmp
 RCC_DIR = .ctmp
 
 
-SOURCES = \
-       main.cpp \
-       event.cpp \
-       order.cpp \
-       shipping.cpp \
-       customer.cpp
-
-HEADERS = \
-       main.h \
-       event.h \
-       order.h \
-       shipping.h \
-       customer.h
+SOURCES = main.cpp
+HEADERS = main.h
 
 RESOURCES += images/files.qrc