Added ignore auto connect clients check box in dialog

This commit is contained in:
Xinyu Hou 2014-11-20 11:37:16 +00:00
parent 471e198efc
commit ec4ef549bb
4 changed files with 91 additions and 34 deletions

View File

@ -19,31 +19,6 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<widget class="QDialogButtonBox" name="m_pDialogButtonBox">
<property name="geometry">
<rect>
<x>50</x>
<y>320</y>
<width>341</width>
<height>20</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ignore</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
<widget class="QWidget" name="gridLayoutWidget"> <widget class="QWidget" name="gridLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -53,7 +28,82 @@
<height>301</height> <height>301</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"/> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelHead">
<property name="text">
<string>TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>320</y>
<width>381</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="m_pCheckBoxIgnoreClient">
<property name="text">
<string>Ignore auto connect clients</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="m_pDialogButtonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ignore</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
<resources/> <resources/>

View File

@ -24,13 +24,13 @@
AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) : AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(), Ui::AddClientDialog(),
m_AddResult(kAddClientIgnore) m_AddResult(kAddClientIgnore),
m_IgnoreAutoConnectClient(false)
{ {
setupUi(this); setupUi(this);
m_pLabelHead = new QLabel(this); m_pLabelHead->setText("A client wants to connect. "
m_pLabelHead->setText("Client " + clientName + " wants to connect..."); "Please choose a location for " + clientName + ".");
gridLayout->addWidget(m_pLabelHead, 0, 1, 1, 1, Qt::AlignCenter);
QIcon icon(":res/icons/64x64/video-display.png"); QIcon icon(":res/icons/64x64/video-display.png");
QSize IconSize(32,32); QSize IconSize(32,32);
@ -74,7 +74,6 @@ AddClientDialog::~AddClientDialog()
delete m_pButtonDown; delete m_pButtonDown;
delete m_pButtonLeft; delete m_pButtonLeft;
delete m_pButtonRight; delete m_pButtonRight;
delete m_pLabelHead;
delete m_pLabelCenter; delete m_pLabelCenter;
} }
@ -119,3 +118,8 @@ void AddClientDialog::handleButtonAdvanced()
m_AddResult = kAddClientOther; m_AddResult = kAddClientOther;
close(); close();
} }
void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked)
{
m_IgnoreAutoConnectClient = checked;
}

View File

@ -41,12 +41,14 @@ public:
AddClientDialog(const QString& clientName, QWidget* parent = 0); AddClientDialog(const QString& clientName, QWidget* parent = 0);
~AddClientDialog(); ~AddClientDialog();
int getAddResult() { return m_AddResult; } int addResult() { return m_AddResult; }
bool ignoreAutoConnectClient() { return m_IgnoreAutoConnectClient; }
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private slots: private slots:
void on_m_pCheckBoxIgnoreClient_toggled(bool checked);
void handleButtonLeft(); void handleButtonLeft();
void handleButtonUp(); void handleButtonUp();
void handleButtonRight(); void handleButtonRight();
@ -59,8 +61,8 @@ private:
QPushButton* m_pButtonRight; QPushButton* m_pButtonRight;
QPushButton* m_pButtonDown; QPushButton* m_pButtonDown;
QLabel* m_pLabelCenter; QLabel* m_pLabelCenter;
QLabel* m_pLabelHead;
int m_AddResult; int m_AddResult;
bool m_IgnoreAutoConnectClient;
}; };
#endif // ADDCLIENTDIALOG_H #endif // ADDCLIENTDIALOG_H

View File

@ -374,7 +374,8 @@ int ServerConfig::showAddClientDialog(const QString& clientName)
{ {
AddClientDialog addClientDialog(clientName, m_pMainWindow); AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec(); addClientDialog.exec();
int result = addClientDialog.getAddResult(); int result = addClientDialog.addResult();
m_IgnoreAutoConnectClient = addClientDialog.ignoreAutoConnectClient();
return result; return result;
} }