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,15 +19,73 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="m_pDialogButtonBox">
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>320</y>
<width>341</width>
<height>20</height>
<x>10</x>
<y>10</y>
<width>381</width>
<height>301</height>
</rect>
</property>
<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>
@ -44,16 +102,8 @@
<bool>false</bool>
</property>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>381</width>
<height>301</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout"/>
</item>
</layout>
</widget>
</widget>
<resources/>

View File

@ -24,13 +24,13 @@
AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(),
m_AddResult(kAddClientIgnore)
m_AddResult(kAddClientIgnore),
m_IgnoreAutoConnectClient(false)
{
setupUi(this);
m_pLabelHead = new QLabel(this);
m_pLabelHead->setText("Client " + clientName + " wants to connect...");
gridLayout->addWidget(m_pLabelHead, 0, 1, 1, 1, Qt::AlignCenter);
m_pLabelHead->setText("A client wants to connect. "
"Please choose a location for " + clientName + ".");
QIcon icon(":res/icons/64x64/video-display.png");
QSize IconSize(32,32);
@ -74,7 +74,6 @@ AddClientDialog::~AddClientDialog()
delete m_pButtonDown;
delete m_pButtonLeft;
delete m_pButtonRight;
delete m_pLabelHead;
delete m_pLabelCenter;
}
@ -119,3 +118,8 @@ void AddClientDialog::handleButtonAdvanced()
m_AddResult = kAddClientOther;
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();
int getAddResult() { return m_AddResult; }
int addResult() { return m_AddResult; }
bool ignoreAutoConnectClient() { return m_IgnoreAutoConnectClient; }
protected:
void changeEvent(QEvent *e);
private slots:
void on_m_pCheckBoxIgnoreClient_toggled(bool checked);
void handleButtonLeft();
void handleButtonUp();
void handleButtonRight();
@ -59,8 +61,8 @@ private:
QPushButton* m_pButtonRight;
QPushButton* m_pButtonDown;
QLabel* m_pLabelCenter;
QLabel* m_pLabelHead;
int m_AddResult;
bool m_IgnoreAutoConnectClient;
};
#endif // ADDCLIENTDIALOG_H

View File

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