aboutsummaryrefslogtreecommitdiff
path: root/src/gatscon
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-05-16 20:51:20 +0000
committerMike Buland <eichlan@xagasoft.com>2011-05-16 20:51:20 +0000
commit02c60c6720f41bcfc367d02ae4c655b651642991 (patch)
treebbda9db56f71c846e5712bcbf44a52f475795f0a /src/gatscon
parent09e3102ffba4b9ee11d988f95c04d344790127db (diff)
downloadlibgats-02c60c6720f41bcfc367d02ae4c655b651642991.tar.gz
libgats-02c60c6720f41bcfc367d02ae4c655b651642991.tar.bz2
libgats-02c60c6720f41bcfc367d02ae4c655b651642991.tar.xz
libgats-02c60c6720f41bcfc367d02ae4c655b651642991.zip
Almost there! I'm adding a qtbenc-like program for gats, only cooler. It'll
really help us debug gats based protocols and look at gats files, and the like.
Diffstat (limited to 'src/gatscon')
-rw-r--r--src/gatscon/clientwidget.cpp24
-rw-r--r--src/gatscon/clientwidget.h21
-rw-r--r--src/gatscon/clientwidget.ui62
-rw-r--r--src/gatscon/connectdlg.cpp22
-rw-r--r--src/gatscon/connectdlg.h17
-rw-r--r--src/gatscon/connectdlg.ui99
-rw-r--r--src/gatscon/gatstotree.cpp8
-rw-r--r--src/gatscon/gatstotree.h8
-rw-r--r--src/gatscon/main.cpp13
-rw-r--r--src/gatscon/mainwnd.cpp25
-rw-r--r--src/gatscon/mainwnd.h20
-rw-r--r--src/gatscon/mainwnd.ui115
12 files changed, 434 insertions, 0 deletions
diff --git a/src/gatscon/clientwidget.cpp b/src/gatscon/clientwidget.cpp
new file mode 100644
index 0000000..4872d9d
--- /dev/null
+++ b/src/gatscon/clientwidget.cpp
@@ -0,0 +1,24 @@
1#include "clientwidget.h"
2#include "connectdlg.h"
3
4ClientWidget::ClientWidget( QWidget *pParent ) :
5 QWidget( pParent ),
6 gsCli( ssCli )
7{
8 setupUi( this );
9
10 ConnectDlg dlg( this );
11 dlg.exec();
12
13 ssCli.setStream(
14 new Bu::TcpSocket( dlg.getHost().constData(), dlg.getPort() )
15 );
16
17 Gats::Object *pObj = gsCli.readObject();
18 gatsToTree( twHistory, pObj );
19}
20
21ClientWidget::~ClientWidget()
22{
23}
24
diff --git a/src/gatscon/clientwidget.h b/src/gatscon/clientwidget.h
new file mode 100644
index 0000000..3a96f07
--- /dev/null
+++ b/src/gatscon/clientwidget.h
@@ -0,0 +1,21 @@
1#ifndef CLIENT_WIDGET_H
2#define CLIENT_WIDGET_H
3
4#include "ui_clientwidget.h"
5
6#include <bu/streamstack.h>
7#include <gats/gatsstream.h>
8
9class ClientWidget : public QWidget, protected Ui::ClientWidget
10{
11 Q_OBJECT;
12public:
13 ClientWidget( QWidget *pParent=NULL );
14 virtual ~ClientWidget();
15
16private:
17 Bu::StreamStack ssCli;
18 Gats::GatsStream gsCli;
19};
20
21#endif
diff --git a/src/gatscon/clientwidget.ui b/src/gatscon/clientwidget.ui
new file mode 100644
index 0000000..9761401
--- /dev/null
+++ b/src/gatscon/clientwidget.ui
@@ -0,0 +1,62 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>ClientWidget</class>
4 <widget class="QWidget" name="ClientWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>364</width>
10 <height>289</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Form</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <widget class="QTreeWidget" name="twHistory">
19 <column>
20 <property name="text">
21 <string>Name</string>
22 </property>
23 </column>
24 <column>
25 <property name="text">
26 <string>Value</string>
27 </property>
28 </column>
29 </widget>
30 </item>
31 <item>
32 <layout class="QHBoxLayout" name="horizontalLayout">
33 <item>
34 <widget class="QLabel" name="label">
35 <property name="text">
36 <string>Gats:</string>
37 </property>
38 </widget>
39 </item>
40 <item>
41 <widget class="QLineEdit" name="lineEdit"/>
42 </item>
43 <item>
44 <widget class="QPushButton" name="pushButton">
45 <property name="text">
46 <string>Send</string>
47 </property>
48 <property name="autoDefault">
49 <bool>true</bool>
50 </property>
51 <property name="default">
52 <bool>true</bool>
53 </property>
54 </widget>
55 </item>
56 </layout>
57 </item>
58 </layout>
59 </widget>
60 <resources/>
61 <connections/>
62</ui>
diff --git a/src/gatscon/connectdlg.cpp b/src/gatscon/connectdlg.cpp
new file mode 100644
index 0000000..589ae97
--- /dev/null
+++ b/src/gatscon/connectdlg.cpp
@@ -0,0 +1,22 @@
1#include "connectdlg.h"
2
3ConnectDlg::ConnectDlg( QWidget *pParent ) :
4 QDialog( pParent )
5{
6 setupUi( this );
7}
8
9ConnectDlg::~ConnectDlg()
10{
11}
12
13QByteArray ConnectDlg::getHostname() const
14{
15 return leHost->text().toAscii();
16}
17
18int ConnectDlg::getPort() const
19{
20 return sbPort->value();
21}
22
diff --git a/src/gatscon/connectdlg.h b/src/gatscon/connectdlg.h
new file mode 100644
index 0000000..57ea6cd
--- /dev/null
+++ b/src/gatscon/connectdlg.h
@@ -0,0 +1,17 @@
1#ifndef CONNECT_DLG_H
2#define CONNECT_DLG_H
3
4#include "ui_connectdlg.h"
5
6class ConnectDlg : public QDialog, protected Ui::ConnectDlg
7{
8 Q_OBJECT;
9public:
10 ConnectDlg( QWidget *pParent );
11 virtual ~ConnectDlg();
12
13 QByteArray getHostname() const;
14 int getPort() const;
15};
16
17#endif
diff --git a/src/gatscon/connectdlg.ui b/src/gatscon/connectdlg.ui
new file mode 100644
index 0000000..fd2d909
--- /dev/null
+++ b/src/gatscon/connectdlg.ui
@@ -0,0 +1,99 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>ConnectDlg</class>
4 <widget class="QDialog" name="ConnectDlg">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>300</width>
10 <height>93</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>GatsCon - Connect</string>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout">
17 <item>
18 <layout class="QFormLayout" name="formLayout">
19 <item row="0" column="0">
20 <widget class="QLabel" name="label">
21 <property name="text">
22 <string>Hostname:</string>
23 </property>
24 </widget>
25 </item>
26 <item row="1" column="0">
27 <widget class="QLabel" name="label_2">
28 <property name="text">
29 <string>Port:</string>
30 </property>
31 </widget>
32 </item>
33 <item row="0" column="1">
34 <widget class="QLineEdit" name="leHost">
35 <property name="text">
36 <string>localhost</string>
37 </property>
38 </widget>
39 </item>
40 <item row="1" column="1">
41 <widget class="QSpinBox" name="sbPort">
42 <property name="minimum">
43 <number>1</number>
44 </property>
45 <property name="maximum">
46 <number>32767</number>
47 </property>
48 </widget>
49 </item>
50 </layout>
51 </item>
52 <item>
53 <widget class="QDialogButtonBox" name="buttonBox">
54 <property name="orientation">
55 <enum>Qt::Horizontal</enum>
56 </property>
57 <property name="standardButtons">
58 <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
59 </property>
60 </widget>
61 </item>
62 </layout>
63 </widget>
64 <resources/>
65 <connections>
66 <connection>
67 <sender>buttonBox</sender>
68 <signal>accepted()</signal>
69 <receiver>ConnectDlg</receiver>
70 <slot>accept()</slot>
71 <hints>
72 <hint type="sourcelabel">
73 <x>248</x>
74 <y>254</y>
75 </hint>
76 <hint type="destinationlabel">
77 <x>157</x>
78 <y>274</y>
79 </hint>
80 </hints>
81 </connection>
82 <connection>
83 <sender>buttonBox</sender>
84 <signal>rejected()</signal>
85 <receiver>ConnectDlg</receiver>
86 <slot>reject()</slot>
87 <hints>
88 <hint type="sourcelabel">
89 <x>316</x>
90 <y>260</y>
91 </hint>
92 <hint type="destinationlabel">
93 <x>286</x>
94 <y>274</y>
95 </hint>
96 </hints>
97 </connection>
98 </connections>
99</ui>
diff --git a/src/gatscon/gatstotree.cpp b/src/gatscon/gatstotree.cpp
new file mode 100644
index 0000000..af94fa5
--- /dev/null
+++ b/src/gatscon/gatstotree.cpp
@@ -0,0 +1,8 @@
1#include <gats/types.h>
2
3#include <QTreeWidgetItem>
4
5void gatsToTree( QTreeWidgetItem *p, Gats::Object *pObj )
6{
7}
8
diff --git a/src/gatscon/gatstotree.h b/src/gatscon/gatstotree.h
new file mode 100644
index 0000000..cab9eee
--- /dev/null
+++ b/src/gatscon/gatstotree.h
@@ -0,0 +1,8 @@
1#ifndef GATS_TO_TREE_H
2#define GATS_TO_TREE_H
3
4class QTreeWidgetItem;
5
6void gatsToTree( QTreeWidgetItem *p, Gats::Object *pObj );
7
8#endif
diff --git a/src/gatscon/main.cpp b/src/gatscon/main.cpp
new file mode 100644
index 0000000..b9b2327
--- /dev/null
+++ b/src/gatscon/main.cpp
@@ -0,0 +1,13 @@
1#include "mainwnd.h"
2#include <QApplication>
3
4int main( int argc, char *argv[] )
5{
6 QApplication app( argc, argv );
7
8 MainWnd wnd;
9 wnd.show();
10
11 return app.exec();
12}
13
diff --git a/src/gatscon/mainwnd.cpp b/src/gatscon/mainwnd.cpp
new file mode 100644
index 0000000..c86e1c2
--- /dev/null
+++ b/src/gatscon/mainwnd.cpp
@@ -0,0 +1,25 @@
1#include "mainwnd.h"
2#include "clientwidget.h"
3
4MainWnd::MainWnd()
5{
6 setupUi( this );
7}
8
9MainWnd::~MainWnd()
10{
11}
12
13void MainWnd::connect()
14{
15 setCentralWidget( new ClientWidget( this ) );
16}
17
18void MainWnd::proxy()
19{
20}
21
22void MainWnd::open()
23{
24}
25
diff --git a/src/gatscon/mainwnd.h b/src/gatscon/mainwnd.h
new file mode 100644
index 0000000..8f638d8
--- /dev/null
+++ b/src/gatscon/mainwnd.h
@@ -0,0 +1,20 @@
1#ifndef MAIN_WND_H
2#define MAIN_WND_H
3
4#include "ui_mainwnd.h"
5
6class MainWnd : public QMainWindow, protected Ui::MainWnd
7{
8 Q_OBJECT;
9public:
10 MainWnd();
11 virtual ~MainWnd();
12
13public slots:
14 void connect();
15 void proxy();
16 void open();
17
18};
19
20#endif
diff --git a/src/gatscon/mainwnd.ui b/src/gatscon/mainwnd.ui
new file mode 100644
index 0000000..e080dd3
--- /dev/null
+++ b/src/gatscon/mainwnd.ui
@@ -0,0 +1,115 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>MainWnd</class>
4 <widget class="QMainWindow" name="MainWnd">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>431</width>
10 <height>319</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>GatsCon</string>
15 </property>
16 <widget class="QWidget" name="centralwidget"/>
17 <widget class="QMenuBar" name="menubar">
18 <property name="geometry">
19 <rect>
20 <x>0</x>
21 <y>0</y>
22 <width>431</width>
23 <height>21</height>
24 </rect>
25 </property>
26 <widget class="QMenu" name="menu_File">
27 <property name="title">
28 <string>&amp;File</string>
29 </property>
30 <addaction name="action_Open_gats_file"/>
31 </widget>
32 <widget class="QMenu" name="menu_Network">
33 <property name="title">
34 <string>&amp;Network</string>
35 </property>
36 <addaction name="action_Open_connection"/>
37 <addaction name="action_Open_proxy_connection"/>
38 </widget>
39 <addaction name="menu_File"/>
40 <addaction name="menu_Network"/>
41 </widget>
42 <widget class="QStatusBar" name="statusbar"/>
43 <action name="action_Open_connection">
44 <property name="text">
45 <string>&amp;Open connection...</string>
46 </property>
47 </action>
48 <action name="action_Open_proxy_connection">
49 <property name="text">
50 <string>&amp;Start proxy...</string>
51 </property>
52 </action>
53 <action name="action_Open_gats_file">
54 <property name="text">
55 <string>&amp;Open gats file...</string>
56 </property>
57 </action>
58 </widget>
59 <resources/>
60 <connections>
61 <connection>
62 <sender>action_Open_connection</sender>
63 <signal>triggered()</signal>
64 <receiver>MainWnd</receiver>
65 <slot>connect()</slot>
66 <hints>
67 <hint type="sourcelabel">
68 <x>215</x>
69 <y>159</y>
70 </hint>
71 <hint type="destinationlabel">
72 <x>215</x>
73 <y>159</y>
74 </hint>
75 </hints>
76 </connection>
77 <connection>
78 <sender>action_Open_proxy_connection</sender>
79 <signal>triggered()</signal>
80 <receiver>MainWnd</receiver>
81 <slot>proxy()</slot>
82 <hints>
83 <hint type="sourcelabel">
84 <x>-1</x>
85 <y>-1</y>
86 </hint>
87 <hint type="destinationlabel">
88 <x>215</x>
89 <y>159</y>
90 </hint>
91 </hints>
92 </connection>
93 <connection>
94 <sender>action_Open_gats_file</sender>
95 <signal>triggered()</signal>
96 <receiver>MainWnd</receiver>
97 <slot>open()</slot>
98 <hints>
99 <hint type="sourcelabel">
100 <x>-1</x>
101 <y>-1</y>
102 </hint>
103 <hint type="destinationlabel">
104 <x>215</x>
105 <y>159</y>
106 </hint>
107 </hints>
108 </connection>
109 </connections>
110 <slots>
111 <slot>connect()</slot>
112 <slot>proxy()</slot>
113 <slot>open()</slot>
114 </slots>
115</ui>