Dev..
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
#include "SettingsWindow.h"
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include "MasterCtrl.h"
|
||||
|
||||
|
||||
CSettingsWindow::CSettingsWindow()
|
||||
{
|
||||
resize(600,600);
|
||||
|
||||
QVBoxLayout *MainLayout = new QVBoxLayout;
|
||||
QWidget *mPagesContainer = new QWidget(this);
|
||||
|
||||
mOptionsTabBar = new QTabBar();
|
||||
mOptionsTabBar->addTab("SMS");
|
||||
mOptionsTabBar->addTab("Network");
|
||||
mOptionsTabBar->resize(this->geometry().width(),mOptionsTabBar->height());
|
||||
MainLayout->addWidget(mOptionsTabBar);
|
||||
|
||||
mSMSPage = new QWidget(mPagesContainer);
|
||||
// mVoipPage->resize(this->size());
|
||||
|
||||
QGridLayout *mSMSPageLayout = new QGridLayout;
|
||||
|
||||
|
||||
QLabel *Label;
|
||||
mVoipMSUsername = new QLineEdit;
|
||||
Label = new QLabel("Voip.ms Username: ");
|
||||
mSMSPageLayout->addWidget(Label,0,1,1,1);
|
||||
mSMSPageLayout->addWidget(mVoipMSUsername,0,2,1,2/*,Qt::AlignLeft*/);
|
||||
|
||||
Label = new QLabel("Voip.ms Password: ");
|
||||
mVoipMSPassword = new QLineEdit;
|
||||
mVoipMSPassword->setEchoMode(QLineEdit::Password);
|
||||
mSMSPageLayout->addWidget(Label,1,1,1,1);
|
||||
mSMSPageLayout->addWidget(mVoipMSPassword,1,2,1,1/*,Qt::AlignLeft*/);
|
||||
|
||||
mRetreiveDIDSButton = new QPushButton("Get DIDs");
|
||||
connect(mRetreiveDIDSButton,SIGNAL(clicked(bool)),this,SLOT(RetreiveDIDButtonClicked(bool)));
|
||||
mSMSPageLayout->addWidget(mRetreiveDIDSButton,1,3,1,1);
|
||||
|
||||
|
||||
Label = new QLabel("DID:");
|
||||
mDIDSelectionDropList = new QComboBox();
|
||||
mSMSPageLayout->addWidget(Label,2,1,1,1);
|
||||
mSMSPageLayout->addWidget(mDIDSelectionDropList,2,2,1,1);
|
||||
|
||||
|
||||
mVoipMSCalendar = new QCalendarWidget;
|
||||
Label = new QLabel("SMS retreival stard date:");
|
||||
mSMSPageLayout->addWidget(Label,3,1,1,1);
|
||||
mSMSPageLayout->addWidget(mVoipMSCalendar,4,1,1,4);
|
||||
|
||||
mDoneButton = new QPushButton("Done");
|
||||
MainLayout->addWidget(mDoneButton);
|
||||
connect(mDoneButton,SIGNAL(clicked(bool)),this,SLOT(DoneButtonClicked(bool)));
|
||||
|
||||
|
||||
|
||||
|
||||
mSMSPage->setLayout(mSMSPageLayout);
|
||||
mSMSPage->show();
|
||||
|
||||
MainLayout->addWidget(mPagesContainer);
|
||||
setLayout(MainLayout);
|
||||
|
||||
connect(mOptionsTabBar,SIGNAL(currentChanged(int)),this,SLOT(TabBarClicked(int)));
|
||||
|
||||
}
|
||||
|
||||
CSettingsWindow::~CSettingsWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CSettingsWindow::TabBarClicked(int TabIndex)
|
||||
{
|
||||
if(TabIndex == 0)//SMS
|
||||
{
|
||||
mSMSPage->show();
|
||||
|
||||
|
||||
}
|
||||
else if(TabIndex == 1)//Network
|
||||
{
|
||||
mSMSPage->hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsWindow::RetreiveDIDButtonClicked(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if(mVoipMSUsername->text().isEmpty() || mVoipMSPassword->text().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mProgramHandle->FetchDIDsRequest(mVoipMSUsername->text(),mVoipMSPassword->text());
|
||||
qDebug("CLick!");
|
||||
}
|
||||
|
||||
void CSettingsWindow::DIDsListFetched(QStringList DIDs)
|
||||
{
|
||||
if(DIDs.size() == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
mDIDSelectionDropList->clear();
|
||||
for(int i = 0; i < DIDs.size(); i++)
|
||||
{
|
||||
mDIDSelectionDropList->addItem(DIDs.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CSettingsWindow::SetSettingsData(CSettings *SettingsData)
|
||||
{
|
||||
mVoipMSPassword->setText(SettingsData->mVoipMSSettings.mPassword);
|
||||
mVoipMSUsername->setText(SettingsData->mVoipMSSettings.mUsername);
|
||||
mDIDSelectionDropList->clear();
|
||||
mDIDSelectionDropList->addItem(SettingsData->mVoipMSSettings.mDefaultDID);
|
||||
mVoipMSCalendar->setSelectedDate(SettingsData->mVoipMSSettings.mStartDate);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CSettingsWindow::DoneButtonClicked(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked)
|
||||
|
||||
CSettings *Settings = new CSettings;
|
||||
Settings->mVoipMSSettings.mDefaultDID = mDIDSelectionDropList->currentText();
|
||||
Settings->mVoipMSSettings.mPassword = mVoipMSPassword->text();
|
||||
Settings->mVoipMSSettings.mStartDate = mVoipMSCalendar->selectedDate();
|
||||
Settings->mVoipMSSettings.mUsername = mVoipMSUsername->text();
|
||||
|
||||
mProgramHandle->SaveSettings(Settings);
|
||||
mProgramHandle->SettingsWindowClosed();
|
||||
delete Settings;
|
||||
|
||||
this->hide();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef CSETTINGSWINDOW_H
|
||||
#define CSETTINGSWINDOW_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include <QDialog>
|
||||
#include <QTabBar>
|
||||
#include <QLineEdit>
|
||||
#include <QCalendarWidget>
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include "ProgramSettings.h"
|
||||
|
||||
class CMasterCtrl;
|
||||
|
||||
|
||||
class CSettingsWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSettingsWindow();
|
||||
virtual ~CSettingsWindow();
|
||||
|
||||
CMasterCtrl *mProgramHandle;
|
||||
|
||||
QWidget *mSMSPage;
|
||||
QTabBar *mOptionsTabBar;
|
||||
QLineEdit *mVoipMSUsername;
|
||||
QLineEdit *mVoipMSPassword;
|
||||
QCalendarWidget *mVoipMSCalendar;
|
||||
QComboBox *mDIDSelectionDropList;
|
||||
QPushButton *mRetreiveDIDSButton;
|
||||
|
||||
QPushButton *mDoneButton;
|
||||
|
||||
unsigned int SetSettingsData(CSettings *SettingsData);
|
||||
|
||||
public slots:
|
||||
void TabBarClicked(int);
|
||||
void RetreiveDIDButtonClicked(bool);
|
||||
void DIDsListFetched(QStringList);
|
||||
void DoneButtonClicked(bool);
|
||||
};
|
||||
|
||||
#endif // CSETTINGSWINDOW_H
|
||||
@@ -13,8 +13,8 @@ CSystemTrayManager::CSystemTrayManager()
|
||||
connect(&mSystemTrayIcon,SIGNAL(messageClicked()),this,SLOT(TrayBaloonMessageClicked()));
|
||||
connect(mTrayMenu,SIGNAL(triggered(QAction*)),this,SLOT(TrayMenuClicked(QAction*)));
|
||||
|
||||
mQuitAction = mTrayMenu->addAction("Quit MasterController");
|
||||
mShowSettingsGUIAction = mTrayMenu->addAction("Settings");
|
||||
mQuitAction = mTrayMenu->addAction("Quit MasterController");
|
||||
mSystemTrayIcon.setIcon(QIcon("./Ico/icon.png"));
|
||||
mSystemTrayIcon.setToolTip("MasterController :)");
|
||||
mSystemTrayIcon.show();
|
||||
@@ -72,6 +72,7 @@ void CSystemTrayManager::TrayMenuClicked(QAction *Menu)
|
||||
else if(Menu == mShowSettingsGUIAction)
|
||||
{
|
||||
qDebug("Settings");
|
||||
mProgramHandle->ShowSettingsWindowRequest();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user