1 | #include "MainWindow.h"
|
---|
2 |
|
---|
3 | #include "dic.hxx"
|
---|
4 |
|
---|
5 | #include "DockWindow.h"
|
---|
6 | #include "HtmlDelegate.h"
|
---|
7 | #include "CheckBoxDelegate.h"
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | MainWindow::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 |
|
---|
33 | void 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 |
|
---|
52 | void MainWindow::on_fChatSend_clicked(bool)
|
---|
53 | {
|
---|
54 | DimClient::sendCommand("CHAT/MSG", fChatMessage->displayText().toStdString().c_str());
|
---|
55 | fChatMessage->clear();
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 | void MainWindow::on_fShutdown_clicked(bool)
|
---|
60 | {
|
---|
61 | DimClient::sendCommand("DIS_DNS/KILL_SERVERS", NULL, 0);
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | void 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 |
|
---|
72 | void MainWindow::on_fStatusFTMEnable_stateChanged(int/* state*/)
|
---|
73 | {
|
---|
74 |
|
---|
75 | }
|
---|