Commit 84b94568 authored by Agrigor's avatar Agrigor

Added about dialog and reconnect dialog

parent eb058b7f
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<height>300</height>
</size>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="textBrowser">
<property name="cursor" stdset="0">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600;&quot;&gt;&amp;quot;Hacker Jeopardy&amp;quot;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;by Technik Kultur Saar e.V.&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;aka Hacksaar&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Author: Agrigor&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Links:&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(&lt;span style=&quot; text-decoration: underline;&quot;&gt;https://www.hacksaar.de&lt;/span&gt;)&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(&lt;span style=&quot; text-decoration: underline;&quot;&gt;https://twitter.com/Agrig0r&lt;/span&gt;)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>textBrowser</sender>
<signal>selectionChanged()</signal>
<receiver>Dialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>249</x>
<y>149</y>
</hint>
<hint type="destinationlabel">
<x>362</x>
<y>3</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -1099,7 +1099,6 @@
<property name="title">
<string>Help</string>
</property>
<addaction name="actionDocumentation"/>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
......@@ -1157,7 +1156,7 @@
<string>About</string>
</property>
<property name="shortcut">
<string>Alt+F1</string>
<string>F1</string>
</property>
</action>
<action name="actionDocumentation">
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>100</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="IP_Address">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>IP Adress</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="I_ip_address">
<property name="toolTip">
<string>IPv4-Adresse</string>
</property>
<property name="text">
<string/>
</property>
<property name="maxLength">
<number>32767</number>
</property>
<property name="cursorPosition">
<number>0</number>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="placeholderText">
<string>127.0.0.1</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="Buttons">
<item>
<widget class="QPushButton" name="I_connect">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="I_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="O_Msg">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>I_ip_address</tabstop>
<tabstop>I_connect</tabstop>
<tabstop>I_cancel</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
......@@ -33,7 +33,7 @@
<item>
<widget class="QLabel" name="O_Name_IPAddress_Edit">
<property name="text">
<string>IP-Adresse</string>
<string>IP Adress:</string>
</property>
</widget>
</item>
......@@ -75,7 +75,7 @@
<item>
<widget class="QLabel" name="O_Name_NumberOfPlayers_Edit">
<property name="text">
<string>Anzahl Spieler:</string>
<string>Number of players:</string>
</property>
</widget>
</item>
......@@ -123,7 +123,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Spieler 1</string>
<string>Player 1</string>
</property>
</widget>
</item>
......@@ -136,7 +136,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Spieler 2</string>
<string>Player 2</string>
</property>
</widget>
</item>
......@@ -149,7 +149,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Spieler 3</string>
<string>Player 3</string>
</property>
</widget>
</item>
......@@ -162,7 +162,7 @@
<string/>
</property>
<property name="placeholderText">
<string>Spieler 4</string>
<string>Player 4</string>
</property>
</widget>
</item>
......
......@@ -67,6 +67,47 @@ class GUI:
sys.exit(self.app.exec())
class AboutGUI(QDialog):
def __init__(self):
QDialog.__init__(self)
self.UI_About = loadUi("GUIs/about.ui", self)
self.UI_About.show()
class ReconnectGUI(QDialog):
def __init__(self, socket, UI_Main):
QDialog.__init__(self)
self.socket = socket
self.UI_Main = UI_Main
self.UI_Reconnect = loadUi("GUIs/reconnect.ui", self)
self.UI_Reconnect.I_ip_address.setText(self.socket.ip)
self.UI_Reconnect.connect(self.UI_Reconnect.I_connect, SIGNAL("clicked()"), self.connectServer)
self.UI_Reconnect.connect(self.UI_Reconnect.I_cancel, SIGNAL("clicked()"), self.cancel)
self.UI_Reconnect.show()
def connectServer(self):
try:
self.socket.cleanup()
except:
pass
self.socket.ip = str(self.UI_Reconnect.I_ip_address.text())
if self.socket.check_ip():
self.socket.create_client_socket()
self.showMsg("Connected")
self.UI_Main.showMsg("Server connection changed, Server IP is now " + self.socket.ip)
self.UI_Reconnect.close()
else:
self.showMsg("No valid IP-address")
def showMsg(self, msg):
self.UI_Reconnect.O_Msg.setText(msg)
def cancel(self):
self.showMsg("Cancelling...")
self.UI_Main.showMsg("Server reconnect cancelled...")
self.UI_Reconnect.close()
class StartGUI(QDialog):
def __init__(self, socket, players, UI_Main):
QDialog.__init__(self)
......@@ -291,11 +332,19 @@ class MainGUI(QMainWindow):
self.players = [Player() for i in range(PLAYERS_MAX)]
self.UI_Main.actionChange_Name.triggered.connect(self.changePlayerName)
self.UI_Main.actionChange_Points.triggered.connect(self.changePlayerPoints)
self.UI_Main.actionNew_Game.triggered.connect(self.NewGame)
self.UI_Main.actionNew_Game.triggered.connect(self.newGame)
self.UI_Main.actionAbout.triggered.connect(self.about)
self.UI_Main.actionReconnect.triggered.connect(self.reconnect)
self.UI_Main.show()
self.UI_Main.actionNew_Game.trigger()
def NewGame(self):
def reconnect(self):
self.UI_Reconnect = ReconnectGUI(self.socket, self.UI_Main)
def about(self):
self.UI_About = AboutGUI()
def newGame(self):
try:
self.socket.cleanup()
except:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment