Changeset 93ea008 for src


Ignore:
Timestamp:
Sep 22, 2015, 10:01:17 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Children:
17ef75d
Parents:
fb602c6
Message:

Command line client is now (nearly) able to register a station

Location:
src
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/clientcommandline/CMakeLists.txt

    rfb602c6 r93ea008  
    3636SET(src_CPP
    3737        main.cpp
     38        inputoutputhandler.cpp
     39        stationsregister.cpp
    3840)
    3941
  • src/clientcommandline/main.cpp

    rfb602c6 r93ea008  
    1818*/
    1919
    20 // #include "testexecuter.h"
    21 // #include <settings.h>
     20#include "siweatherclientconfig.h"
    2221
    23 #include "siweatherclientconfig.h"
     22#include "stationsregister.h"
    2423
    2524#include <ecmdlineargs.h>
    … …  
    2928#include <QCoreApplication>
    3029#include <QTimer>
     30#include <QTextStream>
     31
     32#include <iostream>
    3133
    3234int main ( int argc, char** argv )
    … …  
    4446                return 1;
    4547
    46 
    4748        QCoreApplication app(argc, argv);
    4849        QString error;
    … …  
    5051
    5152        if(args->isSet("register")){
    52 //              StationsRegister *stationsRegister = new StationsRegister();
     53                StationsRegister *stationsRegister = new StationsRegister();
     54                QTimer::singleShot(1, stationsRegister, SLOT(registerStation()));
    5355        }
    5456//      else if(){
    5557//             
    5658//      }
     59        else{
     60                QTextStream stream(stdout);
     61                stream << "Please specify an option" << endl;
     62                return -2;
     63        }
    5764
    58 //      TestExecuter test;
    5965        // allow to start the event loop before executing our code
    60 //      QTimer::singleShot(1, &test, SLOT(load()));
    6166        return app.exec();
    6267}
  • src/lib/siweatherstation.cpp

    rfb602c6 r93ea008  
    114114}
    115115
     116
     117bool SiWeatherStation::isValidForRegister() const
     118{
     119        if(_name.isEmpty())
     120                return false;
     121        if(_city.isEmpty())
     122                return false;
     123        if(_eMail.isEmpty())
     124                return false;
     125        if(_type.isEmpty())
     126                return false;
     127        return true;
     128}
     129
    116130void SiWeatherStation::init()
    117131{
  • src/lib/siweatherstation.h

    rfb602c6 r93ea008  
    5151                                void setEMail(const QString &address);
    5252                                QString eMail() const;
     53                               
     54                                bool isValidForRegister() const;
    5355
    5456                        private:
  • src/tests/siwebserviceclienttest.cpp

    rfb602c6 r93ea008  
    8585        station.setType("Test Type");
    8686
     87        QCOMPARE(station.isValidForRegister(), true);
    8788        QCOMPARE(client->stationsRegister(station, errorMessage), SiWebserviceClient::StationsRegister);
    8889        QTest::qWarn(errorMessage.toUtf8());
Note: See TracChangeset for help on using the changeset viewer.