Skip to content

Commit c5ef423

Browse files
committed
Issue csete#10: Move FCD diagram from main window into dedicated dialog.
1 parent 3e03101 commit c5ef423

7 files changed

+174
-25
lines changed

fcddiagram.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/***************************************************************************
2+
* This file is part of Qthid.
3+
*
4+
* CopyRight (C) 2011 Alexandru Csete, OZ9AEC
5+
*
6+
* Qthid is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Qthid is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Qthid. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
***************************************************************************/
20+
#include <QDebug>
21+
#include "fcddiagram.h"
22+
#include "ui_fcddiagram.h"
23+
24+
FcdDiagram::FcdDiagram(QWidget *parent) :
25+
QDialog(parent),
26+
ui(new Ui::FcdDiagram)
27+
{
28+
ui->setupUi(this);
29+
}
30+
31+
FcdDiagram::~FcdDiagram()
32+
{
33+
qDebug() << "Diagram destroyed";
34+
delete ui;
35+
}

fcddiagram.h

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/***************************************************************************
2+
* This file is part of Qthid.
3+
*
4+
* CopyRight (C) 2011 Alexandru Csete, OZ9AEC
5+
*
6+
* Qthid is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Qthid is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with Qthid. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
***************************************************************************/
20+
#ifndef FCDDIAGRAM_H
21+
#define FCDDIAGRAM_H
22+
23+
#include <QDialog>
24+
25+
namespace Ui {
26+
class FcdDiagram;
27+
}
28+
29+
class FcdDiagram : public QDialog
30+
{
31+
Q_OBJECT
32+
33+
public:
34+
explicit FcdDiagram(QWidget *parent = 0);
35+
~FcdDiagram();
36+
37+
private:
38+
Ui::FcdDiagram *ui;
39+
};
40+
41+
#endif // FCDDIAGRAM_H

fcddiagram.ui

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>FcdDiagram</class>
4+
<widget class="QDialog" name="FcdDiagram">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>1096</width>
10+
<height>109</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Funcube Dongle diagram</string>
15+
</property>
16+
<property name="windowIcon">
17+
<iconset resource="qthid.qrc">
18+
<normaloff>:/qthid/images/help.png</normaloff>:/qthid/images/help.png</iconset>
19+
</property>
20+
<layout class="QVBoxLayout" name="verticalLayout">
21+
<property name="leftMargin">
22+
<number>0</number>
23+
</property>
24+
<property name="topMargin">
25+
<number>10</number>
26+
</property>
27+
<property name="rightMargin">
28+
<number>0</number>
29+
</property>
30+
<property name="bottomMargin">
31+
<number>10</number>
32+
</property>
33+
<item>
34+
<widget class="QLabel" name="label">
35+
<property name="toolTip">
36+
<string>Funcube Dongle diagram</string>
37+
</property>
38+
<property name="text">
39+
<string/>
40+
</property>
41+
<property name="pixmap">
42+
<pixmap resource="qthid.qrc">:/qthid/images/rfchain.png</pixmap>
43+
</property>
44+
</widget>
45+
</item>
46+
</layout>
47+
</widget>
48+
<resources>
49+
<include location="qthid.qrc"/>
50+
</resources>
51+
<connections/>
52+
</ui>

mainwindow.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ static COMBO_STRUCT _acs[] =
319319
MainWindow::MainWindow(QWidget *parent) :
320320
QMainWindow(parent),
321321
ui(new Ui::MainWindow),
322-
prevMode(FCD_MODE_NONE)
322+
prevMode(FCD_MODE_NONE),
323+
diagramDialog(0)
323324
{
324325
QSettings settings;
325326

@@ -1107,3 +1108,18 @@ void MainWindow::on_actionAboutQt_triggered()
11071108
{
11081109
QMessageBox::aboutQt(this, tr("About Qt"));
11091110
}
1111+
1112+
1113+
/*! \brief Action: Show FCD diagram. */
1114+
void MainWindow::on_actionDiagram_triggered()
1115+
{
1116+
if (!diagramDialog) {
1117+
diagramDialog = new FcdDiagram(this);
1118+
}
1119+
1120+
// FIXME: should we connect close signal and destroy dialog every time it's closed?
1121+
1122+
diagramDialog->show();
1123+
diagramDialog->raise();
1124+
diagramDialog->activateWindow();
1125+
}

mainwindow.h

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <QMainWindow>
2727
#include <QComboBox>
2828
#include "fcd.h"
29+
#include "fcddiagram.h"
2930

3031
namespace Ui {
3132
class MainWindow;
@@ -71,6 +72,8 @@ class MainWindow : public QMainWindow
7172
QTimer *timer;
7273
FCD_MODE_ENUM prevMode;
7374

75+
FcdDiagram *diagramDialog;
76+
7477
double StrToDouble(QString s);
7578

7679
void populateCombo(QComboBox *box, int nIdxDefault, const COMBO_ITEM_STRUCT *pcis);
@@ -118,6 +121,7 @@ private slots:
118121
void on_actionFirmware_triggered();
119122
void on_actionAbout_triggered();
120123
void on_actionAboutQt_triggered();
124+
void on_actionDiagram_triggered();
121125
};
122126

123127
#endif // MAINWINDOW_H

mainwindow.ui

+17-20
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>1106</width>
10-
<height>478</height>
9+
<width>1400</width>
10+
<height>397</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -328,26 +328,16 @@ Requires FCD with S/N TBD or above.</string>
328328
</property>
329329
</widget>
330330
</item>
331-
<item>
332-
<widget class="QLabel" name="labelRfChain">
333-
<property name="sizePolicy">
334-
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
335-
<horstretch>0</horstretch>
336-
<verstretch>0</verstretch>
337-
</sizepolicy>
338-
</property>
339-
<property name="text">
340-
<string/>
341-
</property>
342-
<property name="pixmap">
343-
<pixmap resource="qthid.qrc">:/qthid/images/rfchain.png</pixmap>
344-
</property>
345-
</widget>
346-
</item>
347331
<item>
348332
<layout class="QGridLayout" name="gridLayout_4">
349333
<item row="0" column="0">
350334
<widget class="QLabel" name="labelLNAGain">
335+
<property name="sizePolicy">
336+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
337+
<horstretch>0</horstretch>
338+
<verstretch>0</verstretch>
339+
</sizepolicy>
340+
</property>
351341
<property name="text">
352342
<string>LNA gain</string>
353343
</property>
@@ -600,8 +590,8 @@ a specific band.</string>
600590
<rect>
601591
<x>0</x>
602592
<y>0</y>
603-
<width>1106</width>
604-
<height>25</height>
593+
<width>1400</width>
594+
<height>22</height>
605595
</rect>
606596
</property>
607597
<widget class="QMenu" name="menuFile">
@@ -617,6 +607,8 @@ a specific band.</string>
617607
<property name="title">
618608
<string>&amp;Help</string>
619609
</property>
610+
<addaction name="actionDiagram"/>
611+
<addaction name="separator"/>
620612
<addaction name="actionAbout"/>
621613
<addaction name="actionAboutQt"/>
622614
</widget>
@@ -768,6 +760,11 @@ a specific band.</string>
768760
<string>Enter What's This?</string>
769761
</property>
770762
</action>
763+
<action name="actionDiagram">
764+
<property name="text">
765+
<string>Funcube Dongle diagram</string>
766+
</property>
767+
</action>
771768
</widget>
772769
<layoutdefault spacing="6" margin="11"/>
773770
<customwidgets>

qthid.pro

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ SOURCES +=\
3535
main.cpp \
3636
fcd.c \
3737
freqctrl.cpp \
38-
iqbalance.cc
38+
iqbalance.cc \
39+
fcddiagram.cpp
3940

4041
mac: SOURCES += hidmac.c
4142
win32: SOURCES += hidwin.cpp
@@ -45,10 +46,13 @@ HEADERS += mainwindow.h \
4546
hidapi.h \
4647
fcd.h fcdhidcmd.h \
4748
freqctrl.h \
48-
iqbalance.h
49+
iqbalance.h \
50+
fcddiagram.h
4951

50-
FORMS += mainwindow.ui \
51-
iqbalance.ui
52+
FORMS += \
53+
iqbalance.ui \
54+
mainwindow.ui \
55+
fcddiagram.ui
5256

5357
mac:LIBS += /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation \
5458
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit

0 commit comments

Comments
 (0)