From: <f-r...@us...> - 2011-02-07 20:34:29
|
Revision: 229 http://netemul.svn.sourceforge.net/netemul/?rev=229&view=rev Author: f-r-o-s-t Date: 2011-02-07 20:34:22 +0000 (Mon, 07 Feb 2011) Log Message: ----------- WARNING!!! Don't download this version. We change VCS to Mercurial soon, and change development process. Thank you for your understanding. Modified Paths: -------------- trunk/src/mainwindow.cpp trunk/src/mycanvas.cpp trunk/src/mycanvas.h trunk/src/states/abstractstate.cpp trunk/src/states/abstractstate.h trunk/src/states/cablestate.cpp trunk/src/states/cablestate.h trunk/src/states/emptystate.h trunk/src/states/insertstate.cpp trunk/src/states/insertstate.h trunk/src/states/movestate.cpp trunk/src/states/movestate.h trunk/src/states/sendstate.cpp trunk/src/states/sendstate.h trunk/src/states/textstate.h Added Paths: ----------- trunk/test/mycanvas/ trunk/test/mycanvas/abstractstate.cpp trunk/test/mycanvas/abstractstate.h trunk/test/mycanvas/addcablecommand.cpp trunk/test/mycanvas/addcablecommand.h trunk/test/mycanvas/appsetting.cpp trunk/test/mycanvas/appsetting.h trunk/test/mycanvas/cabledev.cpp trunk/test/mycanvas/cabledev.h trunk/test/mycanvas/deletecommand.cpp trunk/test/mycanvas/deletecommand.h trunk/test/mycanvas/device.cpp trunk/test/mycanvas/device.h trunk/test/mycanvas/mycanvas.pro trunk/test/mycanvas/textitem.cpp trunk/test/mycanvas/textitem.h trunk/test/mycanvas/tst_mycanvastest.cpp Modified: trunk/src/mainwindow.cpp =================================================================== --- trunk/src/mainwindow.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/mainwindow.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -536,18 +536,25 @@ //Слот сохранить bool MainWindow::saveFile() { + int code = MyCanvas::OPEN_OK; if ( myFile.isEmpty() ) { - saveAsFile(); - return true; + saveAsFile(); + return true; } setWindowTitle( myFile ); if ( myFile.endsWith("net") ) { - canva->saveScene(myFile); + code = canva->saveScene(myFile); } else { - canva->saveSceneXml(myFile); + code = canva->saveSceneXml(myFile); } - return true; + if ( code == MyCanvas::OPEN_OK ) { + return true; + } else { + QMessageBox::critical(this,tr("Save error"),MyCanvas::IOErrorString(code), + QMessageBox::Ok , QMessageBox::Ok ); + return false; + } } void MainWindow::openFile(QString name) @@ -555,12 +562,17 @@ setWindowTitle(name); setEnabledFileItems(true); showGridAct->setChecked(true); + int code = MyCanvas::OPEN_OK; if ( name.endsWith("net") ) { - canva->openScene(name); + code = canva->openScene(name); } else { - canva->openSceneXml(name); + code = canva->openSceneXml(name); } + if ( code != MyCanvas::OPEN_OK ) { + QMessageBox::critical(this,tr("Open error"),MyCanvas::IOErrorString(code), + QMessageBox::Ok , QMessageBox::Ok ); + } } void MainWindow::openFile() Modified: trunk/src/mycanvas.cpp =================================================================== --- trunk/src/mycanvas.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/mycanvas.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -26,7 +26,6 @@ #include <QtDebug> #include <QtCore/QFile> #include <QtCore/QDataStream> -#include <QtGui/QMessageBox> #include <QtGui/QTextCursor> #include <QtGui/QApplication> #include <QtXml/QXmlSimpleReader> @@ -52,7 +51,7 @@ myTimer = 0; myOpen = false; myModified = false; - myState = abstractState::initialize(this); + myState = AbstractState::initialize(this); commandStack.setUndoLimit(UNDO_LIMIT); // WHAT THE FUCK??? @@ -207,13 +206,13 @@ Загружает сцену из файла. @param fileName - имя файла из которого осуществляется загрузка. */ -void MyCanvas::openScene(QString fileName) +int MyCanvas::openScene(const QString &fileName) { + int code = OPEN_OK; newFile(); QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { - qDebug() << tr("Opening file for reading is impossible"); - return; + return READING_FAIL; } QDataStream s(&file); s.setVersion(QDataStream::Qt_4_3); @@ -221,56 +220,62 @@ QString str; s >> str; if ( str != QCoreApplication::applicationVersion() ) { - QMessageBox::critical(0,tr("Error"),tr("Outdated version of the file, file can't be opened"), - QMessageBox::Ok , QMessageBox::Ok ); emit fileClosed(); - return; + code = OUTDATED_VERSION; + } else { + QApplication::changeOverrideCursor(Qt::WaitCursor); + Device *item; + int n,i; + s >> n; + for ( i = 0 ; i < n ; i++ ) { + item = new Device(s); + item->setMenu(myItemMenu); + addItem(item); + myDevices << item; + } + s >> n; + for ( i = 0 ; i < n ; i++ ) { + s >> p; + Device *start = deviceInPoint(p); + s >> p; + Device *end = deviceInPoint(p); + s >> str; + QString startP = str; + s >> str; + QString endP = str; + createConnection( start , end , startP , endP ); + } + s >> n; + for ( i = 0 ; i < n ; i++ ) { + s >> p; s >> str; + createTextItem(p,str); + } + if ( s.status() != QDataStream::Ok ) { + qDebug() << "PPC"; + code = STREAM_ERROR; + emit fileClosed(); + } else { + qDebug() << tr("Scene opened from %1").arg(fileName) ; + emit fileOpened(); + } + file.close(); + QApplication::restoreOverrideCursor(); + myModified = false; } - QApplication::changeOverrideCursor(Qt::WaitCursor); - Device *item; - int n,i; - s >> n; - for ( i = 0 ; i < n ; i++ ) { - item = new Device(s); - item->setMenu(myItemMenu); - addItem(item); - myDevices << item; - } - s >> n; - for ( i = 0 ; i < n ; i++ ) { - s >> p; - Device *start = deviceInPoint(p); - s >> p; - Device *end = deviceInPoint(p); - s >> str; - QString startP = str; - s >> str; - QString endP = str; - createConnection( start , end , startP , endP ); - } - s >> n; - for ( i = 0 ; i < n ; i++ ) { - s >> p; s >> str; - createTextItem(p,str); - } - if ( s.status() != QDataStream::Ok ) qDebug() << "PPC"; - file.close(); - QApplication::restoreOverrideCursor(); - emit fileOpened(); - qDebug() << tr("Scene opened from %1").arg(fileName) ; - myModified = false; + return code; } //----------------------------------------------------------------------- -void MyCanvas::openSceneXml(QString fileName) +int MyCanvas::openSceneXml(const QString &fileName) { newFile(); stop(); QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { - qDebug() << tr("Opening file for reading is impossible"); - return; + //qDebug() << tr("Opening file for reading is impossible"); + return READING_FAIL; } + int code = OPEN_OK; QApplication::changeOverrideCursor(Qt::WaitCursor); SceneXmlReader handler(this); @@ -280,27 +285,27 @@ if ( reader.parse(&source) ) { emit fileOpened(); + play(); qDebug() << tr("Scene opened from %1").arg(fileName) ; } else { - qDebug("CДелай Ну ХОТЬ ЧТО_НИБУДЬ!!!!!!!!!"); + code = STREAM_ERROR; + emit fileClosed(); } - - file.close(); - play(); + file.close(); QApplication::restoreOverrideCursor(); myModified = false; + return code; } /*! Сохраняет сцену в файл. @param fileName - имя файла в который осуществляется сохранение. */ -void MyCanvas::saveScene(QString fileName) +int MyCanvas::saveScene(const QString &fileName) { QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - qDebug() << tr("Opening file for writing is impossible %1").arg(fileName); - return; + if (!file.open(QIODevice::WriteOnly)) { + return WRITING_FAIL; } QApplication::changeOverrideCursor(Qt::WaitCursor); QDataStream s(&file); @@ -322,20 +327,25 @@ foreach ( TextItem *i, myTextItems ) { s << i->pos(); s << i->toPlainText(); - } - if ( s.status() != QDataStream::Ok ) qDebug() << "PPC"; + } file.close(); - QApplication::restoreOverrideCursor(); - qDebug() << tr("Scene saved in %1").arg(fileName) ; + QApplication::restoreOverrideCursor(); myModified = false; + if ( s.status() != QDataStream::Ok ) { + qDebug() << "PPC"; + return STREAM_ERROR; + } else { + qDebug() << tr("Scene saved in %1").arg(fileName) ; + return OPEN_OK; + } } -void MyCanvas::saveSceneXml(QString fileName) +int MyCanvas::saveSceneXml(const QString &fileName) { QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - qDebug() << tr("Opening file for writing is impossible %1").arg(fileName); - return; + if (!file.open(QIODevice::WriteOnly)) { + //qDebug() << tr("Opening file for writing is impossible %1").arg(fileName); + return WRITING_FAIL; } QApplication::changeOverrideCursor(Qt::WaitCursor); sceneXmlWriter s(this); @@ -344,6 +354,7 @@ QApplication::restoreOverrideCursor(); qDebug() << tr("Scene saved in %1").arg(fileName) ; myModified = false; + return OPEN_OK; } //------------------------------------------------------------------------- /*! Modified: trunk/src/mycanvas.h =================================================================== --- trunk/src/mycanvas.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/mycanvas.h 2011-02-07 20:34:22 UTC (rev 229) @@ -32,7 +32,7 @@ class DevicePort; class Device; class DeviceImpl; -class abstractState; +class AbstractState; typedef QList<Device*> DeviceList; typedef QList<TextItem*> TextItemList; @@ -56,6 +56,9 @@ enum { width = 2000 , height = 2000 }; // типы устройств : Нет устройства , компьютер , концентратор , коммутатор enum { noDev = 0 , busDev = 2 ,compDev = 3 , hubDev = 4 , switchDev = 5 , routerDev = 7 }; + + enum { OPEN_OK = 0 , READING_FAIL , WRITING_FAIL , OUTDATED_VERSION , STREAM_ERROR }; + MyCanvas(QMenu *context,QObject *parent = 0); // Конструктор ~MyCanvas(); @@ -92,6 +95,16 @@ void putItems(QMap<QGraphicsItem*,QPointF> map); void calibrateAll(QList<QGraphicsItem*> list); bool isDevice(QGraphicsItem *t) const; + + static QString IOErrorString(int n) { + static const QString strs[] = { tr("Open complite") , + tr("Opening file for reading is impossible"), + tr("Opening file for writing is impossible"), + tr("Outdated version of the file, file can't be opened"), + tr("Stream I/O error") }; + return strs[n]; + } + signals: void uncheck(); //!< Сообщает панели о сбросе текущего устройства void fileOpened(); //!< Сообщает главному окно что открыт новый файл @@ -108,10 +121,10 @@ void play(); void stop() { killTimer(myTimer); myTimer = 0; } // Выключаем таймер bool isPlayed() const { return myTimer; } - void saveScene(QString fileName); - void openScene(QString fileName); - void saveSceneXml(QString fileName); - void openSceneXml(QString fileName); + int saveScene(const QString &fileName); + int openScene(const QString &fileName); + int saveSceneXml(const QString &fileName); + int openSceneXml(const QString &fileName); DeviceImpl* addComputer(int x,int y); DeviceImpl* addSwitch(int x,int y); DeviceImpl* addHub(int x,int y); @@ -132,7 +145,7 @@ Device* deviceWithImpl(DeviceImpl *d); bool myOpen; bool myModified; - abstractState *myState; + AbstractState *myState; public: DeviceList devices() const { return myDevices; } @@ -160,7 +173,7 @@ int myTimer; // My dear Friends =) friend class statisticsScene; - friend class abstractState; + friend class AbstractState; friend class moveState; friend class insertState; friend class cableState; @@ -168,4 +181,5 @@ friend class sendState; }; //------------------------------------------------------------------ + #endif // MYCANVAS_H Modified: trunk/src/states/abstractstate.cpp =================================================================== --- trunk/src/states/abstractstate.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/abstractstate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -26,60 +26,60 @@ #include "textstate.h" #include "sendstate.h" -abstractState::abstractState(MyCanvas *s) +AbstractState::AbstractState(MyCanvas *s) { scene = s; } -abstractState* abstractState::initialize(MyCanvas *s) +AbstractState* AbstractState::initialize(MyCanvas *s) { return new emptyState(s); } -void abstractState::goMove() +void AbstractState::goMove() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new moveState(scene); delete oldState; } -void abstractState::goInsert() +void AbstractState::goInsert() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new insertState(scene); delete oldState; } -void abstractState::goCable() +void AbstractState::goCable() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new cableState(scene); delete oldState; } -void abstractState::goText() +void AbstractState::goText() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new textState(scene); delete oldState; } -void abstractState::goSend() +void AbstractState::goSend() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new sendState(scene); delete oldState; } -void abstractState::goEmpty() +void AbstractState::goEmpty() { - abstractState *oldState = scene->myState; + AbstractState *oldState = scene->myState; scene->myState = new emptyState(scene); delete oldState; } -void abstractState::goTo(int mode) +void AbstractState::goTo(int mode) { switch ( mode ) { case move : goMove(); break; Modified: trunk/src/states/abstractstate.h =================================================================== --- trunk/src/states/abstractstate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/abstractstate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -23,12 +23,12 @@ class MyCanvas; class QGraphicsSceneMouseEvent; -class abstractState +class AbstractState { public: - abstractState(MyCanvas *s); + AbstractState(MyCanvas *s); enum { move = 0 , cable = 1 , insert = 2 , send = 6 , text = 8}; - virtual ~abstractState() { } + virtual ~AbstractState() { } virtual void mouseMove(QGraphicsSceneMouseEvent*) = 0; virtual void mousePress(QGraphicsSceneMouseEvent*) = 0; virtual void mouseRelease(QGraphicsSceneMouseEvent*) = 0; @@ -39,7 +39,7 @@ virtual void goSend(); virtual void goEmpty(); virtual void hideState() { } - static abstractState* initialize(MyCanvas *s); + static AbstractState* initialize(MyCanvas *s); void goTo(int mode); protected: MyCanvas *scene; Modified: trunk/src/states/cablestate.cpp =================================================================== --- trunk/src/states/cablestate.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/cablestate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -24,7 +24,7 @@ #include "mycanvas.h" #include "device.h" -cableState::cableState(MyCanvas *s) : abstractState(s) +cableState::cableState(MyCanvas *s) : AbstractState(s) { line = 0; // Провода нет } Modified: trunk/src/states/cablestate.h =================================================================== --- trunk/src/states/cablestate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/cablestate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -24,7 +24,7 @@ class QGraphicsLineItem; -class cableState : public abstractState +class cableState : public AbstractState { public: cableState(MyCanvas *s); Modified: trunk/src/states/emptystate.h =================================================================== --- trunk/src/states/emptystate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/emptystate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -22,10 +22,10 @@ #include "abstractstate.h" -class emptyState : public abstractState +class emptyState : public AbstractState { public: - emptyState(MyCanvas *s) : abstractState(s) { } + emptyState(MyCanvas *s) : AbstractState(s) { } void mouseMove(QGraphicsSceneMouseEvent*) { } void mousePress(QGraphicsSceneMouseEvent*) { } void mouseRelease(QGraphicsSceneMouseEvent*) { } Modified: trunk/src/states/insertstate.cpp =================================================================== --- trunk/src/states/insertstate.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/insertstate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -23,7 +23,7 @@ #include "insertrect.h" #include "addcommand.h" -insertState::insertState(MyCanvas *s) : abstractState(s) +insertState::insertState(MyCanvas *s) : AbstractState(s) { insertRect = new InsertRect; s->addItem(insertRect); Modified: trunk/src/states/insertstate.h =================================================================== --- trunk/src/states/insertstate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/insertstate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -24,7 +24,7 @@ class InsertRect; -class insertState : public abstractState +class insertState : public AbstractState { public: insertState(MyCanvas *s); Modified: trunk/src/states/movestate.cpp =================================================================== --- trunk/src/states/movestate.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/movestate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -26,7 +26,7 @@ #include "cabledev.h" #include "movecommand.h" -moveState::moveState(MyCanvas *s) : abstractState(s) +moveState::moveState(MyCanvas *s) : AbstractState(s) { selectRect = 0; // Выделения нет p2Rect = QPoint(); Modified: trunk/src/states/movestate.h =================================================================== --- trunk/src/states/movestate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/movestate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -28,7 +28,7 @@ typedef QList<QGraphicsItem*> itemList; -class moveState : public abstractState +class moveState : public AbstractState { public: moveState(MyCanvas *s); Modified: trunk/src/states/sendstate.cpp =================================================================== --- trunk/src/states/sendstate.cpp 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/sendstate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -25,7 +25,7 @@ #include "sendellipse.h" #include "device.h" -sendState::sendState(MyCanvas *s) : abstractState(s) +sendState::sendState(MyCanvas *s) : AbstractState(s) { mySendState = noSendItem; sendEllipse = new SendEllipse; Modified: trunk/src/states/sendstate.h =================================================================== --- trunk/src/states/sendstate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/sendstate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -25,7 +25,7 @@ class Device; class SendEllipse; -class sendState : public abstractState +class sendState : public AbstractState { public: sendState(MyCanvas *s); Modified: trunk/src/states/textstate.h =================================================================== --- trunk/src/states/textstate.h 2010-11-24 20:35:39 UTC (rev 228) +++ trunk/src/states/textstate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -22,10 +22,10 @@ #include "abstractstate.h" -class textState : public abstractState +class textState : public AbstractState { public: - textState(MyCanvas *s) : abstractState(s) { } + textState(MyCanvas *s) : AbstractState(s) { } void mouseMove(QGraphicsSceneMouseEvent*) { } void mousePress(QGraphicsSceneMouseEvent *event); void mouseRelease(QGraphicsSceneMouseEvent*) { } Added: trunk/test/mycanvas/abstractstate.cpp =================================================================== --- trunk/test/mycanvas/abstractstate.cpp (rev 0) +++ trunk/test/mycanvas/abstractstate.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,10 @@ +#include "abstractstate.h" + +AbstractState::AbstractState() +{ +} + +void AbstractState::initialize(MyCanvas *) +{ + +} Added: trunk/test/mycanvas/abstractstate.h =================================================================== --- trunk/test/mycanvas/abstractstate.h (rev 0) +++ trunk/test/mycanvas/abstractstate.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,18 @@ +#ifndef ABSTRACTSTATE_H +#define ABSTRACTSTATE_H + +#include <QGraphicsSceneMouseEvent> + +class MyCanvas; + +class AbstractState +{ +public: + AbstractState(); + static void initialize(MyCanvas*); + virtual void mouseMove(QGraphicsSceneMouseEvent*) = 0; + virtual void mousePress(QGraphicsSceneMouseEvent*) = 0; + virtual void mouseRelease(QGraphicsSceneMouseEvent*) = 0; +}; + +#endif // ABSTRACTSTATE_H Added: trunk/test/mycanvas/addcablecommand.cpp =================================================================== --- trunk/test/mycanvas/addcablecommand.cpp (rev 0) +++ trunk/test/mycanvas/addcablecommand.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "addcablecommand.h" + +AddCableCommand::AddCableCommand() +{ +} Added: trunk/test/mycanvas/addcablecommand.h =================================================================== --- trunk/test/mycanvas/addcablecommand.h (rev 0) +++ trunk/test/mycanvas/addcablecommand.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,10 @@ +#ifndef ADDCABLECOMMAND_H +#define ADDCABLECOMMAND_H + +class AddCableCommand +{ +public: + AddCableCommand(); +}; + +#endif // ADDCABLECOMMAND_H Added: trunk/test/mycanvas/appsetting.cpp =================================================================== --- trunk/test/mycanvas/appsetting.cpp (rev 0) +++ trunk/test/mycanvas/appsetting.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "appsetting.h" + +AppSetting::AppSetting() +{ +} Added: trunk/test/mycanvas/appsetting.h =================================================================== --- trunk/test/mycanvas/appsetting.h (rev 0) +++ trunk/test/mycanvas/appsetting.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,10 @@ +#ifndef APPSETTING_H +#define APPSETTING_H + +class AppSetting +{ +public: + AppSetting(); +}; + +#endif // APPSETTING_H Added: trunk/test/mycanvas/cabledev.cpp =================================================================== --- trunk/test/mycanvas/cabledev.cpp (rev 0) +++ trunk/test/mycanvas/cabledev.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "cabledev.h" + +Cable::Cable() +{ +} Added: trunk/test/mycanvas/cabledev.h =================================================================== --- trunk/test/mycanvas/cabledev.h (rev 0) +++ trunk/test/mycanvas/cabledev.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,15 @@ +#ifndef CABLEDEV_H +#define CABLEDEV_H + +#include <QList> + +class Cable; +typedef QList<Cable*> CableList; + +class Cable +{ +public: + Cable(); +}; + +#endif // CABLEDEV_H Added: trunk/test/mycanvas/deletecommand.cpp =================================================================== --- trunk/test/mycanvas/deletecommand.cpp (rev 0) +++ trunk/test/mycanvas/deletecommand.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "deletecommand.h" + +DeleteCommand::DeleteCommand() +{ +} Added: trunk/test/mycanvas/deletecommand.h =================================================================== --- trunk/test/mycanvas/deletecommand.h (rev 0) +++ trunk/test/mycanvas/deletecommand.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,10 @@ +#ifndef DELETECOMMAND_H +#define DELETECOMMAND_H + +class DeleteCommand +{ +public: + DeleteCommand(); +}; + +#endif // DELETECOMMAND_H Added: trunk/test/mycanvas/device.cpp =================================================================== --- trunk/test/mycanvas/device.cpp (rev 0) +++ trunk/test/mycanvas/device.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "device.h" + +Device::Device() +{ +} Added: trunk/test/mycanvas/device.h =================================================================== --- trunk/test/mycanvas/device.h (rev 0) +++ trunk/test/mycanvas/device.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,17 @@ +#ifndef DEVICE_H +#define DEVICE_H + +#include <QString> + +class DevicePort; + +class Device +{ +public: + Device(); + DevicePort* findPortByName(const QString &str) { + return 0; + } +}; + +#endif // DEVICE_H Added: trunk/test/mycanvas/mycanvas.pro =================================================================== --- trunk/test/mycanvas/mycanvas.pro (rev 0) +++ trunk/test/mycanvas/mycanvas.pro 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,41 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-12-05T22:29:47 +# +#------------------------------------------------- + +QT += script testlib xml + +TARGET = tst_mycanvastest +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +INCLUDEPATH += ../../src \ +../../src/tools + +SOURCES += tst_mycanvastest.cpp \ + ../../src/mycanvas.cpp \ + textitem.cpp \ + cabledev.cpp \ + device.cpp \ + appsetting.cpp \ + abstractstate.cpp \ + deletecommand.cpp \ + addcablecommand.cpp \ + ../../src/tools/scenexmlwriter.cpp \ + ../../src/tools/scenexmlreader.cpp +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +HEADERS += \ + ../../src/mycanvas.h \ + textitem.h \ + cabledev.h \ + device.h \ + appsetting.h \ + abstractstate.h \ + deletecommand.h \ + addcablecommand.h \ + ../../src/tools/scenexmlwriter.h \ + ../../src/tools/scenexmlreader.h Added: trunk/test/mycanvas/textitem.cpp =================================================================== --- trunk/test/mycanvas/textitem.cpp (rev 0) +++ trunk/test/mycanvas/textitem.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,5 @@ +#include "textitem.h" + +TextItem::TextItem() +{ +} Added: trunk/test/mycanvas/textitem.h =================================================================== --- trunk/test/mycanvas/textitem.h (rev 0) +++ trunk/test/mycanvas/textitem.h 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,10 @@ +#ifndef TEXTITEM_H +#define TEXTITEM_H + +class TextItem +{ +public: + TextItem(); +}; + +#endif // TEXTITEM_H Added: trunk/test/mycanvas/tst_mycanvastest.cpp =================================================================== --- trunk/test/mycanvas/tst_mycanvastest.cpp (rev 0) +++ trunk/test/mycanvas/tst_mycanvastest.cpp 2011-02-07 20:34:22 UTC (rev 229) @@ -0,0 +1,29 @@ +#include <QtCore/QString> +#include <QtTest/QtTest> +#include <QtCore/QCoreApplication> + +#include "mycanvas.h" + +class MycanvasTest : public QObject +{ + Q_OBJECT + +public: + MycanvasTest(); + +private Q_SLOTS: + void testCase1(); +}; + +MycanvasTest::MycanvasTest() +{ +} + +void MycanvasTest::testCase1() +{ + +} + +QTEST_MAIN(MycanvasTest); + +#include "tst_mycanvastest.moc" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |