searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp
changeset 16 e918432ddd92
parent 9 4a2987baf8f7
child 21 708468d5143e
equal deleted inserted replaced
15:df6898e696c6 16:e918432ddd92
    22 #include <qstatemachine.h>
    22 #include <qstatemachine.h>
    23 #include <qstate.h>
    23 #include <qstate.h>
    24 #include <qfinalstate.h>
    24 #include <qfinalstate.h>
    25 #include <qdebug.h>
    25 #include <qdebug.h>
    26 #include <hbapplication.h>
    26 #include <hbapplication.h>
    27 #include <hbmainwindow.h>
       
    28 
    27 
    29 #define hbApp qobject_cast<HbApplication*>(qApp)
    28 #define hbApp qobject_cast<HbApplication*>(qApp)
    30 
    29 
    31 // states
    30 // states
    32 const char wizardProgressiveStateUri[] =
    31 const char wizardProgressiveStateUri[] =
    38 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    39 // searchRuntime::SearchRuntime
    38 // searchRuntime::SearchRuntime
    40 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    41 //
    40 //
    42 SearchRuntime::SearchRuntime(QObject* aParent) :
    41 SearchRuntime::SearchRuntime(QObject* aParent) :
    43     QStateMachine(aParent), mWindow(0)
    42     QStateMachine(aParent)
    44     {
    43     {
    45     createGuiServiceParts();
       
    46     createStates();
    44     createStates();
    47     }
    45     }
    48 
    46 
    49 // ---------------------------------------------------------------------------
    47 // ---------------------------------------------------------------------------
    50 // SearchRuntime::~SearchRuntime()
    48 // SearchRuntime::~SearchRuntime()
    51 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    52 //
    50 //
    53 SearchRuntime::~SearchRuntime()
    51 SearchRuntime::~SearchRuntime()
    54     {
    52     {
    55     delete mWindow;
       
    56     //  delete mStateMachine;
       
    57     }
    53     }
    58 
    54 
    59 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    60 // SearchRuntime::handleStateMachineStarted()
    56 // SearchRuntime::handleStateMachineStarted()
    61 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    71 //
    67 //
    72 void SearchRuntime::handleStateMachineStopped()
    68 void SearchRuntime::handleStateMachineStopped()
    73     {
    69     {
    74     emit stopped();
    70     emit stopped();
    75     }
    71     }
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // SearchRuntime::createGuiServiceParts()
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void SearchRuntime::createGuiServiceParts()
       
    82     {
       
    83     mWindow = new HbMainWindow();
       
    84     mWindow->show();
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
    72 // ---------------------------------------------------------------------------
    88 // SearchRuntime::createStates()
    73 // SearchRuntime::createStates()
    89 // ---------------------------------------------------------------------------
    74 // ---------------------------------------------------------------------------
    90 //
    75 //
    91 void SearchRuntime::createStates()
    76 void SearchRuntime::createStates()
    92     {
    77     {
    93 
       
    94     SearchStateProvider stateProvider;
    78     SearchStateProvider stateProvider;
    95 
    79 
    96     QFinalState* finalState = new QFinalState();
    80     QFinalState* finalState = new QFinalState();
    97     this->addState(finalState);
    81     this->addState(finalState);
    98 
    82 
   141     connect(wizardSettingState, SIGNAL(clickstatus(bool)),
   125     connect(wizardSettingState, SIGNAL(clickstatus(bool)),
   142             wizardProgressiveState, SLOT(settingsaction(bool)));
   126             wizardProgressiveState, SLOT(settingsaction(bool)));
   143 
   127 
   144     connect(wizardSettingState, SIGNAL(publishSelectedCategory(int,bool)),
   128     connect(wizardSettingState, SIGNAL(publishSelectedCategory(int,bool)),
   145             wizardProgressiveState, SLOT(getSettingCategory(int,bool)));
   129             wizardProgressiveState, SLOT(getSettingCategory(int,bool)));
   146     
   130 
   147     connect(wizardSettingState, SIGNAL(publishISProviderIcon(int,HbIcon)),
   131     connect(wizardSettingState, SIGNAL(publishISProviderIcon(int,HbIcon)),
   148             wizardProgressiveState, SLOT(slotISProvidersIcon(int,HbIcon)));
   132             wizardProgressiveState, SLOT(slotISProvidersIcon(int,HbIcon)));
   149 
   133 
   150     connect(wizardProgressiveState, SIGNAL(inDeviceSearchQuery(QString)),
   134     connect(wizardProgressiveState, SIGNAL(inDeviceSearchQuery(QString)),
   151             wizardOnlineState, SLOT(slotIndeviceQuery(QString)));
   135             wizardOnlineState, SLOT(slotIndeviceQuery(QString)));
   152     
   136 
   153     connect(wizardProgressiveState, SIGNAL(launchLink(int,QString)),
   137     connect(wizardProgressiveState, SIGNAL(launchLink(int,QString)),
   154             wizardOnlineState, SLOT(slotlaunchLink(int,QString)));
   138             wizardOnlineState, SLOT(slotlaunchLink(int,QString)));
   155 
   139 
   156     connect(wizardOnlineState, SIGNAL(onlineSearchQuery(QString)),
   140     connect(wizardOnlineState, SIGNAL(onlineSearchQuery(QString)),
   157             wizardProgressiveState, SLOT(slotOnlineQuery(QString)));
   141             wizardProgressiveState, SLOT(slotOnlineQuery(QString)));
   187     this->setInitialState(parallel);
   171     this->setInitialState(parallel);
   188 
   172 
   189     connect(this, SIGNAL(started()), SLOT(handleStateMachineStarted()));
   173     connect(this, SIGNAL(started()), SLOT(handleStateMachineStarted()));
   190     connect(this, SIGNAL(stopped()), SLOT(handleStateMachineStopped()));
   174     connect(this, SIGNAL(stopped()), SLOT(handleStateMachineStopped()));
   191     connect(this, SIGNAL(finished()), SLOT(handleStateMachineStopped()));
   175     connect(this, SIGNAL(finished()), SLOT(handleStateMachineStopped()));
   192 
       
   193     }
   176     }