Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
fgxdebugwidget.cpp
Go to the documentation of this file.
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // fgxdebugwidget.cpp
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 
10 #include <QTabWidget>
11 #include <QVBoxLayout>
12 
14 
15 
17 
19  QWidget(parent)
20 {
21 
22  mainObject = mob;
23 
24  setProperty("settings_namespace", QVariant("debug_window"));
26 
27  setWindowTitle("FGx Debug");
28 
29  QVBoxLayout *mainLayout = new QVBoxLayout();
30  setLayout(mainLayout);
31 
32  QTabWidget *tabWidget = new QTabWidget();
33  mainLayout->addWidget(tabWidget);
34 
35  //== Debug Tree == Coeden in welsh
37  tabWidget->addTab(debugTreeWidget, QIcon(":/icon/debug"), "Model View");
38 
39  //== Command Preview and Output
41  tabWidget->addTab(commandPreviewWidget, QIcon(":/icon/debug"), "Command Line");
42 
43 
44  //========================================================
45  //= Bottom TEST Buttons
46  QHBoxLayout *bottBox = new QHBoxLayout();
47  mainLayout->addLayout(bottBox);
48 
49  QCheckBox *chkOpenOnStartup = new QCheckBox();
50  bottBox->addWidget(chkOpenOnStartup);
51  chkOpenOnStartup->setText("Open this windows at startup");
52 
53 
54 
55  bottBox->addStretch(10);
56 
57  QPushButton *buttLoad = new QPushButton();
58  buttLoad->setText("Load Ini");
59  bottBox->addWidget(buttLoad);
60  // connect(buttLoad, SIGNAL(clicked()), mainObject->X, SLOT(read_ini()));
61 
62  QPushButton *buttSave = new QPushButton();
63  buttSave->setText("Write Ini");
64  bottBox->addWidget(buttSave);
65  // connect(buttSave, SIGNAL(clicked()), mainObject->X, SLOT(write_ini()));
66 
67 
68  //========================================================
69  //= Restore and Connect
70  tabWidget->setCurrentIndex(mainObject->settings->value("fgx_debug_last_tab",0).toInt());
71  connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tab(int)));
72 
73  chkOpenOnStartup->setChecked(mainObject->settings->value("fgx_debug_show_on_startup",0).toBool());
74  connect(chkOpenOnStartup, SIGNAL(clicked(bool)), this, SLOT(on_open_at_startup(bool)));
75 
76 }
77 
78 
79 
80 //= window close
81 /*void FgxDebugWidget::closeEvent(QCloseEvent *event){
82  mainObject->settings->saveWindow(this);
83  event->accept();
84 }*/
85 
86 //= On Tab
88 {
89  mainObject->settings->setValue("fgx_debug_last_tab", idx);
90 }
91 
92 //= On Chk Startup
94 {
95  mainObject->settings->setValue("fgx_debug_show_on_startup", checked);
96 }
97 
XCommandPrevieWidget * commandPreviewWidget
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:66
void on_open_at_startup(bool checked)
void restoreWindow(QWidget *widget)
Restores a size window position.
Definition: xsettings.cpp:101
void on_tab(int idx)
XDebugTreeWidget * debugTreeWidget
XSettings * settings
Definition: mainobject.h:85
MainObject * mainObject
FgxDebugWidget(MainObject *mob, QWidget *parent=0)