-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathAppUI.cpp
More file actions
130 lines (106 loc) · 3.71 KB
/
Copy pathAppUI.cpp
File metadata and controls
130 lines (106 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// AppUI.cpp: Initialize UI controls
// Copyright (C) 2019 Gonzalo José Carracedo Carballal
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>
//
#include "AboutDialog.h"
#include "MainSpectrum.h"
#include "ConfigDialog.h"
#include "Palette.h"
#include "AutoGain.h"
#include "Averager.h"
#include "DeviceGain.h"
#include "ui_MainWindow.h"
#include "ConfigDialog.h"
#include "DeviceDialog.h"
#include "PanoramicDialog.h"
#include "LogDialog.h"
#include "BackgroundTasksDialog.h"
#include "AddBookmarkDialog.h"
#include "BookmarkManagerDialog.h"
#include <QToolBar>
#include "QTimeSlider.h"
#include "AppUI.h"
#include "QuickConnectDialog.h"
#include "SigDiggerHelpers.h"
#include <QToolBar>
#include <QTimeSlider.h>
#include <ToolBarWidgetFactory.h>
using namespace SigDigger;
AppUI::AppUI(QMainWindow *owner)
{
this->main = new Ui_MainWindow();
this->main->setupUi(owner);
this->owner = owner;
this->timeToolbar = new QToolBar("Time controls");
this->timeToolbar->setObjectName("TimeSliderToolBar");
this->timeSlider = new QTimeSlider(nullptr);
this->timeToolbar->setAllowedAreas(Qt::ToolBarArea::AllToolBarAreas);
this->timeToolbar->setMovable(false);
owner->addToolBarBreak(Qt::TopToolBarArea);
owner->addToolBar(Qt::TopToolBarArea, timeToolbar);
this->timeToolbar->addWidget(this->timeSlider);
// In MacOS X there is already a system feature to show windows in full
// screen, and therefore this option is not needed.
#ifdef __APPLE__
delete this->main->action_Full_screen;
this->main->action_Full_screen = nullptr;
#endif // __APPLE__
this->spectrum = new MainSpectrum(owner);
this->quickConnectDialog = new QuickConnectDialog(owner);
this->aboutDialog = new AboutDialog(owner);
this->deviceDialog = new DeviceDialog(owner);
this->panoramicDialog = new PanoramicDialog(owner);
this->logDialog = new LogDialog(owner);
this->backgroundTasksDialog = new BackgroundTasksDialog(owner);
this->addBookmarkDialog = new AddBookmarkDialog(owner);
this->bookmarkManagerDialog = new BookmarkManagerDialog(owner);
}
void
AppUI::addToolBarWidget(ToolBarWidget *widget)
{
ToolBarWidgetFactory *factory = widget->factory();
QString name = factory->name();
if (toolBarWidgets.contains(name)) {
SU_ERROR("Attempting to add `%s' to toolbar twice!\n", factory->name());
return;
}
QToolBar *toolBar = new QToolBar(factory->desc());
toolBar->setObjectName(name);
toolBar->setAllowedAreas(Qt::ToolBarArea::AllToolBarAreas);
toolBar->setMovable(true);
this->owner->insertToolBar(this->timeToolbar, toolBar);
toolBar->addWidget(widget);
QObject::connect(
widget,
SIGNAL(destroyed(QObject*)),
toolBar,
SLOT(deleteLater()));
}
void
AppUI::postLoadInit(UIMediator *mediator, QMainWindow *owner)
{
this->uiMediator = mediator;
// Singleton config has been deserialized. Refresh UI with these changes.
SigDiggerHelpers::instance()->deserializePalettes();
this->configDialog = new ConfigDialog(owner);
this->spectrum->deserializeFATs();
this->spectrum->adjustSizes();
}
AppUI::~AppUI(void)
{
delete this->main;
}