source: trunk/FACT++/gui/MainWindow.cc@ 10395

Last change on this file since 10395 was 10394, checked in by tbretz, 14 years ago
First version of the GUI.
File size: 1.9 KB
Line 
1#include "MainWindow.h"
2
3#include "dic.hxx"
4
5#include "DockWindow.h"
6#include "HtmlDelegate.h"
7#include "CheckBoxDelegate.h"
8
9using namespace std;
10
11MainWindow::MainWindow(QWidget *p) : QMainWindow(p)
12{
13 // setupUi MUST be called before the DimNetwork is initilized
14 // In this way it can be ensured that nothing from the
15 // DimNetwork arrives before all graphical elements are
16 // initialized. This is a simple but very powerfull trick.
17 setupUi(this);
18
19 // Now here we can do further setup which should be done
20 // before the gui is finally displayed.
21 fDimCmdServers->setItemDelegate(new CheckBoxDelegate);
22 fDimCmdCommands->setItemDelegate(new CheckBoxDelegate);
23 fDimCmdDescription->setItemDelegate(new HtmlDelegate);
24
25 fDimSvcServers->setItemDelegate(new CheckBoxDelegate);
26 fDimSvcServices->setItemDelegate(new CheckBoxDelegate);
27 fDimSvcDescription->setItemDelegate(new HtmlDelegate);
28
29 fStatusBar->showMessage("FACT++");
30}
31
32
33void MainWindow::on_fTabWidget_tabCloseRequested(int which)
34{
35 QWidget *w = fTabWidget->widget(which);
36 if (!w)
37 return;
38
39 QDockWidget *d = w->findChild<QDockWidget*>();
40 if (!d)
41 return;
42
43 DockWindow *mw = new DockWindow(d, fTabWidget->tabText(which));
44 fTabWidget->removeTab(which);
45 mw->show();
46
47 if (fTabWidget->count()==1)
48 fTabWidget->setTabsClosable(false);
49}
50
51
52void MainWindow::on_fChatSend_clicked(bool)
53{
54 DimClient::sendCommand("CHAT/MSG", fChatMessage->displayText().toStdString().c_str());
55 fChatMessage->clear();
56}
57
58
59void MainWindow::on_fShutdown_clicked(bool)
60{
61 DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
62}
63
64
65void MainWindow::on_fShutdownAll_clicked(bool)
66{
67 DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
68 DimClient::sendCommand("DIS_DNS/EXIT", 1);
69}
70
71
72void MainWindow::on_fStatusFTMEnable_stateChanged(int/* state*/)
73{
74
75}
Note: See TracBrowser for help on using the repository browser.