82 lines
2.0 KiB
C++
82 lines
2.0 KiB
C++
#include "MasterCtrl.h"
|
|
#include <QApplication>
|
|
|
|
CMasterCtrl::CMasterCtrl()
|
|
{
|
|
qDebug("Creation...");
|
|
mDeadBoltDevice = new CDeadboltDevice(1);
|
|
mAVReceiverDevice = new CAVReceiverDevice;
|
|
mVoipMsSMSClient = new CVoipMsSMSClient;
|
|
mSystemTrayManager = new CSystemTrayManager;
|
|
mSystemTrayManager->mProgramHandle = this;
|
|
mSettingsWindow = new CSettingsWindow();
|
|
mSettingsWindow->mProgramHandle = this;
|
|
// mMasterCtrlSettings = new CSettings;
|
|
}
|
|
|
|
CMasterCtrl::~CMasterCtrl()
|
|
{
|
|
mAVReceiverDevice->DisconnectReceiver();
|
|
|
|
delete mDeadBoltDevice;
|
|
delete mAVReceiverDevice;
|
|
delete mVoipMsSMSClient;
|
|
delete mSystemTrayManager;
|
|
delete mSettingsWindow;
|
|
// delete mMasterCtrlSettings;
|
|
}
|
|
|
|
void CMasterCtrl::Start()
|
|
{
|
|
qDebug("Started!");
|
|
|
|
|
|
connect(mVoipMsSMSClient,SIGNAL(DIDSFetched(QStringList)),mSettingsWindow,SLOT(DIDsListFetched(QStringList)));
|
|
|
|
mAVReceiverDevice->ConnectToReceiver();
|
|
|
|
mSettingsManager.LoadSettings(&mMasterCtrlSettings);
|
|
mSettingsWindow->SetSettingsData(&mMasterCtrlSettings);
|
|
mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings);
|
|
mVoipMsSMSClient->DownloadSMSFromServer();
|
|
|
|
// mAppWidget.show();
|
|
|
|
|
|
}
|
|
|
|
unsigned int CMasterCtrl::QuitApplicationRequest()
|
|
{
|
|
QApplication::exit(69);
|
|
return RET_OK;
|
|
}
|
|
|
|
unsigned int CMasterCtrl::ShowSettingsWindowRequest()
|
|
{
|
|
mSettingsWindow->show();
|
|
return RET_OK;
|
|
}
|
|
|
|
unsigned int CMasterCtrl::FetchDIDsRequest(QString Username, QString Password)
|
|
{
|
|
mVoipMsSMSClient->GetDidFromUserAccount(Username,Password);
|
|
return RET_OK;
|
|
}
|
|
|
|
unsigned int CMasterCtrl::SaveSettings(CSettings *Settings)
|
|
{
|
|
CSettings toto;
|
|
toto = *Settings;
|
|
mMasterCtrlSettings = toto;
|
|
mSettingsManager.SaveSettings(&mMasterCtrlSettings);
|
|
|
|
return RET_OK;
|
|
}
|
|
|
|
unsigned int CMasterCtrl::SettingsWindowClosed()
|
|
{
|
|
mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings);
|
|
mVoipMsSMSClient->DownloadSMSFromServer();
|
|
return RET_OK;
|
|
}
|