MainWindow.cc 18.1 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10 11 12 13 14 15 16 17 18 19 20 21


/**
 * @file
 *   @brief Implementation of class MainWindow
 *   @author Lorenz Meier <mail@qgroundcontrol.org>
 */

#include <QSettings>
#include <QNetworkInterface>
#include <QDebug>
#include <QTimer>
#include <QHostInfo>
22
#include <QQuickView>
23
#include <QDesktopWidget>
24 25
#include <QScreen>
#include <QDesktopServices>
26
#include <QDockWidget>
27
#include <QMenuBar>
Don Gagne's avatar
Don Gagne committed
28
#include <QDialog>
29

30 31 32 33
#include "QGC.h"
#include "MAVLinkProtocol.h"
#include "MainWindow.h"
#include "GAudioOutput.h"
dogmaphobic's avatar
dogmaphobic committed
34
#ifndef __mobile__
35
#include "QGCMAVLinkLogPlayer.h"
dogmaphobic's avatar
dogmaphobic committed
36
#endif
37
#include "MAVLinkDecoder.h"
Don Gagne's avatar
Don Gagne committed
38
#include "QGCApplication.h"
39
#include "MultiVehicleManager.h"
40
#include "HomePositionManager.h"
41
#include "LogCompressor.h"
42
#include "UAS.h"
dogmaphobic's avatar
dogmaphobic committed
43
#include "QGCImageProvider.h"
44 45

#ifndef __mobile__
46 47
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
48 49 50 51 52
#include "QGCUASFileViewMulti.h"
#include "UASQuickView.h"
#include "QGCTabbedInfoView.h"
#include "CustomCommandWidget.h"
#include "QGCDockWidget.h"
53
#include "HILDockWidget.h"
dogmaphobic's avatar
dogmaphobic committed
54
#include "LogDownload.h"
55
#include "AppMessages.h"
56 57 58 59 60
#endif

#ifndef __ios__
#include "SerialLink.h"
#endif
61

62 63 64 65
#ifdef UNITTEST_BUILD
#include "QmlControls/QmlTestWidget.h"
#endif

66 67 68
/// The key under which the Main Window settings are saved
const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW";

69
#ifndef __mobile__
70 71 72
enum DockWidgetTypes {
    MAVLINK_INSPECTOR,
    CUSTOM_COMMAND,
73 74 75
    ONBOARD_FILES,
    INFO_VIEW,
    HIL_CONFIG,
dogmaphobic's avatar
dogmaphobic committed
76
    ANALYZE,
77
    LOG_DOWNLOAD
78 79 80 81 82 83 84 85
};

static const char *rgDockWidgetNames[] = {
    "MAVLink Inspector",
    "Custom Command",
    "Onboard Files",
    "Info View",
    "HIL Config",
dogmaphobic's avatar
dogmaphobic committed
86
    "Analyze",
87
    "Log Download"
88 89 90
};

#define ARRAY_SIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
91 92

static const char* _visibleWidgetsKey = "VisibleWidgets";
93
#endif
94

Don Gagne's avatar
Don Gagne committed
95 96
static MainWindow* _instance = NULL;   ///< @brief MainWindow singleton

Lorenz Meier's avatar
Lorenz Meier committed
97
MainWindow* MainWindow::_create()
98
{
Don Gagne's avatar
Don Gagne committed
99
    Q_ASSERT(_instance == NULL);
Lorenz Meier's avatar
Lorenz Meier committed
100
    new MainWindow();
Don Gagne's avatar
Don Gagne committed
101 102
    // _instance is set in constructor
    Q_ASSERT(_instance);
103 104 105
    return _instance;
}

Don Gagne's avatar
Don Gagne committed
106
MainWindow* MainWindow::instance(void)
107
{
Don Gagne's avatar
Don Gagne committed
108
    return _instance;
109 110
}

111 112
void MainWindow::deleteInstance(void)
{
Don Gagne's avatar
Don Gagne committed
113
    delete this;
114 115
}

Don Gagne's avatar
Don Gagne committed
116 117 118
/// @brief Private constructor for MainWindow. MainWindow singleton is only ever created
///         by MainWindow::_create method. Hence no other code should have access to
///         constructor.
Lorenz Meier's avatar
Lorenz Meier committed
119
MainWindow::MainWindow()
120
    : _lowPowerMode(false)
121
    , _showStatusBar(false)
122
    , _mainQmlWidgetHolder(NULL)
123
    , _forceClose(false)
124
{
Don Gagne's avatar
Don Gagne committed
125 126
    Q_ASSERT(_instance == NULL);
    _instance = this;
127

128 129 130 131 132 133 134 135
    //-- Load fonts
    if(QFontDatabase::addApplicationFont(":/fonts/opensans") < 0) {
        qWarning() << "Could not load /fonts/opensans font";
    }
    if(QFontDatabase::addApplicationFont(":/fonts/opensans-demibold") < 0) {
        qWarning() << "Could not load /fonts/opensans-demibold font";
    }

136 137 138 139
    // Qt 4/5 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar.
#ifdef Q_OS_LINUX
    menuBar()->setNativeMenuBar(false);
#endif
dogmaphobic's avatar
dogmaphobic committed
140
    // Setup user interface
141
    loadSettings();
142
    emit initStatusChanged(tr("Setting up user interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
143

dogmaphobic's avatar
dogmaphobic committed
144 145
    _ui.setupUi(this);
    // Make sure tool bar elements all fit before changing minimum width
dogmaphobic's avatar
dogmaphobic committed
146
    setMinimumWidth(1008);
dogmaphobic's avatar
dogmaphobic committed
147
    configureWindowName();
148

149 150
    // Setup central widget with a layout to hold the views
    _centralLayout = new QVBoxLayout();
151
    _centralLayout->setContentsMargins(0, 0, 0, 0);
152
    centralWidget()->setLayout(_centralLayout);
153 154 155 156 157

    _mainQmlWidgetHolder = new QGCQmlWidgetHolder(QString(), NULL, this);
    _centralLayout->addWidget(_mainQmlWidgetHolder);
    _mainQmlWidgetHolder->setVisible(true);

158
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
159
    _mainQmlWidgetHolder->setContextPropertyObject("controller", this);
160
    _mainQmlWidgetHolder->setContextPropertyObject("debugMessageModel", AppMessages::getModel());
Don Gagne's avatar
Don Gagne committed
161
    _mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindowHybrid.qml"));
162

dogmaphobic's avatar
dogmaphobic committed
163 164 165 166
    // Image provider
    QQuickImageProvider* pImgProvider = dynamic_cast<QQuickImageProvider*>(qgcApp()->toolbox()->imageProvider());
    _mainQmlWidgetHolder->getEngine()->addImageProvider(QLatin1String("QGCImages"), pImgProvider);

167
    // Set dock options
168
    setDockOptions(0);
169
    // Setup corners
170
    setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
171

dogmaphobic's avatar
dogmaphobic committed
172 173 174
    // On Mobile devices, we don't want any main menus at all.
#ifdef __mobile__
    menuBar()->setNativeMenuBar(false);
dogmaphobic's avatar
dogmaphobic committed
175
#endif
dogmaphobic's avatar
dogmaphobic committed
176

177 178 179
#ifdef UNITTEST_BUILD
    QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL);
    connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget);
180
    _ui.menuWidgets->addAction(qmlTestAction);
181
#endif
182

dogmaphobic's avatar
dogmaphobic committed
183
    // Status Bar
184
    setStatusBar(new QStatusBar(this));
185
    statusBar()->setSizeGripEnabled(true);
186

187
#ifndef __mobile__
188
    emit initStatusChanged(tr("Building common widgets."), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
189
    _buildCommonWidgets();
190
    emit initStatusChanged(tr("Building common actions"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
191
#endif
192

193 194 195
    // Create actions
    connectCommonActions();
    // Connect user interface devices
196
#ifdef QGC_MOUSE_ENABLED_WIN
197
    emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
198 199
    mouseInput = new Mouse3DInput(this);
    mouse = new Mouse6dofInput(mouseInput);
200
#endif //QGC_MOUSE_ENABLED_WIN
201

202
#if QGC_MOUSE_ENABLED_LINUX
203
    emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
204 205

    mouse = new Mouse6dofInput(this);
206
    connect(this, &MainWindow::x11EventOccured, mouse, &Mouse6dofInput::handleX11Event);
207
#endif //QGC_MOUSE_ENABLED_LINUX
208

209
    // Set low power mode
dogmaphobic's avatar
dogmaphobic committed
210
    enableLowPowerMode(_lowPowerMode);
211
    emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
212

dogmaphobic's avatar
dogmaphobic committed
213
#ifndef __mobile__
214

215
    // Restore the window position and size
dogmaphobic's avatar
dogmaphobic committed
216 217
    emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
    if (settings.contains(_getWindowGeometryKey()))
218
    {
dogmaphobic's avatar
dogmaphobic committed
219
        restoreGeometry(settings.value(_getWindowGeometryKey()).toByteArray());
220 221 222 223
    }
    else
    {
        // Adjust the size
224 225 226
        QScreen* scr = QApplication::primaryScreen();
        QSize scrSize = scr->availableSize();
        if (scrSize.width() <= 1280)
227
        {
228
            resize(scrSize.width(), scrSize.height());
229 230 231
        }
        else
        {
232 233 234
            int w = scrSize.width()  > 1600 ? 1600 : scrSize.width();
            int h = scrSize.height() >  800 ?  800 : scrSize.height();
            resize(w, h);
235
            move((scrSize.width() - w) / 2, (scrSize.height() - h) / 2);
236 237
        }
    }
238 239
#endif

240
    connect(_ui.actionStatusBar,  &QAction::triggered, this, &MainWindow::showStatusBarCallback);
241

242
    connect(&windowNameUpdateTimer, &QTimer::timeout, this, &MainWindow::configureWindowName);
243
    windowNameUpdateTimer.start(15000);
244
    emit initStatusChanged(tr("Done"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
245 246

    if (!qgcApp()->runningUnitTests()) {
247 248
        _ui.actionStatusBar->setChecked(_showStatusBar);
        showStatusBarCallback(_showStatusBar);
dogmaphobic's avatar
dogmaphobic committed
249
#ifdef __mobile__
250 251
        menuBar()->hide();
#endif
252
        show();
dogmaphobic's avatar
dogmaphobic committed
253
#ifdef __macos__
dogmaphobic's avatar
dogmaphobic committed
254 255 256 257 258 259 260 261 262 263 264 265 266 267
        // TODO HACK
        // This is a really ugly hack. For whatever reason, by having a QQuickWidget inside a
        // QDockWidget (MainToolBar above), the main menu is not shown when the app first
        // starts. I looked everywhere and I could not find a solution. What I did notice was
        // that if any other window gets focus, the menu comes up when you come back to QGC.
        // That is, if you were to click on another window and then back to QGC, the menus
        // would appear. This hack below creates a 0x0 dialog and immediately closes it.
        // That works around the issue and it will do until I find the root of the problem.
        QDialog qd(this);
        qd.show();
        qd.raise();
        qd.activateWindow();
        qd.close();
#endif
268
    }
269

270 271 272
#ifndef __mobile__
    _loadVisibleWidgetsSettings();
#endif
273 274 275 276 277
    //-- Enable message handler display of messages in main window
    UASMessageHandler* msgHandler = qgcApp()->toolbox()->uasMessageHandler();
    if(msgHandler) {
        msgHandler->showErrorsInToolbar();
    }
278 279 280 281
}

MainWindow::~MainWindow()
{
282 283 284 285
    // This needs to happen before we get into the QWidget dtor
    // otherwise  the QML engine reads freed data and tries to
    // destroy MainWindow a second time.
    delete _mainQmlWidgetHolder;
Don Gagne's avatar
Don Gagne committed
286
    _instance = NULL;
287 288
}

dogmaphobic's avatar
dogmaphobic committed
289
QString MainWindow::_getWindowGeometryKey()
290 291 292 293
{
    return "_geometry";
}

294
#ifndef __mobile__
295
void MainWindow::_buildCommonWidgets(void)
296 297
{
    // Add generic MAVLink decoder
dogmaphobic's avatar
dogmaphobic committed
298
    // TODO: This is never deleted
299
    mavlinkDecoder = new MAVLinkDecoder(qgcApp()->toolbox()->mavlinkProtocol(), this);
300
    connect(mavlinkDecoder.data(), &MAVLinkDecoder::valueChanged, this, &MainWindow::valueChanged);
301

302
    // Log player
dogmaphobic's avatar
dogmaphobic committed
303
    // TODO: Make this optional with a preferences setting or under a "View" menu
Don Gagne's avatar
Don Gagne committed
304
    logPlayer = new QGCMAVLinkLogPlayer(statusBar());
305
    statusBar()->addPermanentWidget(logPlayer);
306

307 308
    for (int i = 0, end = ARRAY_SIZE(rgDockWidgetNames); i < end; i++) {

309
        const char* pDockWidgetName = rgDockWidgetNames[i];
310

311
        // Add to menu
312
        QAction* action = new QAction(tr(pDockWidgetName), this);
313
        action->setCheckable(true);
314
        action->setData(i);
315 316 317
        connect(action, &QAction::triggered, this, &MainWindow::_showDockWidgetAction);
        _ui.menuWidgets->addAction(action);
        _mapName2Action[pDockWidgetName] = action;
318
    }
319
}
320

321 322
/// Shows or hides the specified dock widget, creating if necessary
void MainWindow::_showDockWidget(const QString& name, bool show)
323
{
324
    // Create the inner widget if we need to
325
    if (!_mapName2DockWidget.contains(name)) {
dogmaphobic's avatar
dogmaphobic committed
326 327 328 329
        if(!_createInnerDockWidget(name)) {
            qWarning() << "Trying to load non existing widget:" << name;
            return;
        }
330
    }
331
    Q_ASSERT(_mapName2DockWidget.contains(name));
332
    QGCDockWidget* dockWidget = _mapName2DockWidget[name];
333 334
    Q_ASSERT(dockWidget);
    dockWidget->setVisible(show);
335 336
    Q_ASSERT(_mapName2Action.contains(name));
    _mapName2Action[name]->setChecked(show);
337 338 339
}

/// Creates the specified inner dock widget and adds to the QDockWidget
dogmaphobic's avatar
dogmaphobic committed
340
bool MainWindow::_createInnerDockWidget(const QString& widgetName)
341
{
342
    QGCDockWidget* widget = NULL;
343
    QAction *action = _mapName2Action[widgetName];
dogmaphobic's avatar
dogmaphobic committed
344 345 346 347 348 349 350 351 352 353 354
    if(action) {
        switch(action->data().toInt()) {
            case MAVLINK_INSPECTOR:
                widget = new QGCMAVLinkInspector(widgetName, action, qgcApp()->toolbox()->mavlinkProtocol(),this);
                break;
            case CUSTOM_COMMAND:
                widget = new CustomCommandWidget(widgetName, action, this);
                break;
            case ONBOARD_FILES:
                widget = new QGCUASFileViewMulti(widgetName, action, this);
                break;
355 356 357
            case LOG_DOWNLOAD:
                widget = new LogDownload(widgetName, action, this);
                break;
dogmaphobic's avatar
dogmaphobic committed
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
            case HIL_CONFIG:
                widget = new HILDockWidget(widgetName, action, this);
                break;
            case ANALYZE:
                widget = new Linecharts(widgetName, action, mavlinkDecoder, this);
                break;
            case INFO_VIEW:
                widget= new QGCTabbedInfoView(widgetName, action, this);
                break;
        }
        if(action->data().toInt() == INFO_VIEW) {
            qobject_cast<QGCTabbedInfoView*>(widget)->addSource(mavlinkDecoder);
        }
        if(widget) {
            _mapName2DockWidget[widgetName] = widget;
        }
374
    }
dogmaphobic's avatar
dogmaphobic committed
375
    return widget != NULL;
376
}
377

378 379
void MainWindow::_hideAllDockWidgets(void)
{
380
    foreach(QGCDockWidget* dockWidget, _mapName2DockWidget) {
381 382 383 384 385 386
        dockWidget->setVisible(false);
    }
}

void MainWindow::_showDockWidgetAction(bool show)
{
387
    QAction* action = qobject_cast<QAction*>(QObject::sender());
388
    Q_ASSERT(action);
389
    _showDockWidget(rgDockWidgetNames[action->data().toInt()], show);
390 391 392
}
#endif

393 394 395 396 397 398
void MainWindow::showStatusBarCallback(bool checked)
{
    _showStatusBar = checked;
    checked ? statusBar()->show() : statusBar()->hide();
}

399
void MainWindow::reallyClose(void)
400
{
401 402
    _forceClose = true;
    close();
403 404
}

405 406
void MainWindow::closeEvent(QCloseEvent *event)
{
407
    if (!_forceClose) {
Ricardo de Almeida Gonzaga's avatar
Ricardo de Almeida Gonzaga committed
408
        // Attempt close from within the root Qml item
409
        qgcApp()->qmlAttemptWindowClose();
410 411
        event->ignore();
        return;
412 413 414
    }

    // Should not be any active connections
415
    if (qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()) {
Don Gagne's avatar
Don Gagne committed
416 417
        qWarning() << "All links should be disconnected by now";
    }
418

419
    _storeCurrentViewState();
420
    storeSettings();
421 422

    emit mainWindowClosed();
423 424 425 426
}

void MainWindow::loadSettings()
{
427
    // Why the screaming?
428
    QSettings settings;
429
    settings.beginGroup(MAIN_SETTINGS_GROUP);
430 431
    _lowPowerMode   = settings.value("LOW_POWER_MODE",      _lowPowerMode).toBool();
    _showStatusBar  = settings.value("SHOW_STATUSBAR",      _showStatusBar).toBool();
432 433 434 435 436 437
    settings.endGroup();
}

void MainWindow::storeSettings()
{
    QSettings settings;
438
    settings.beginGroup(MAIN_SETTINGS_GROUP);
439 440
    settings.setValue("LOW_POWER_MODE",     _lowPowerMode);
    settings.setValue("SHOW_STATUSBAR",     _showStatusBar);
441
    settings.endGroup();
dogmaphobic's avatar
dogmaphobic committed
442
    settings.setValue(_getWindowGeometryKey(), saveGeometry());
443

444 445 446
#ifndef __mobile__
    _storeVisibleWidgetsSettings();
#endif
447 448 449 450 451 452
}

void MainWindow::configureWindowName()
{
    QList<QHostAddress> hostAddresses = QNetworkInterface::allAddresses();
    QString windowname = qApp->applicationName() + " " + qApp->applicationVersion();
453 454 455 456 457

    // XXX we do have UDP MAVLink heartbeat broadcast now in SITL and will have it on the
    // WIFI radio, so people should not be in need any more of knowing their IP.
    // this can go once we are certain its not needed any more.
    #if 0
458
    bool prevAddr = false;
459 460 461 462 463 464 465 466 467 468 469 470
    windowname.append(" (" + QHostInfo::localHostName() + ": ");
    for (int i = 0; i < hostAddresses.size(); i++)
    {
        // Exclude loopback IPv4 and all IPv6 addresses
        if (hostAddresses.at(i) != QHostAddress("127.0.0.1") && !hostAddresses.at(i).toString().contains(":"))
        {
            if(prevAddr) windowname.append("/");
            windowname.append(hostAddresses.at(i).toString());
            prevAddr = true;
        }
    }
    windowname.append(")");
471
    #endif
472 473 474 475 476 477 478 479 480 481
    setWindowTitle(windowname);
}

/**
* @brief Create all actions associated to the main window
*
**/
void MainWindow::connectCommonActions()
{
    // Audio output
482
    _ui.actionMuteAudioOutput->setChecked(qgcApp()->toolbox()->audioOutput()->isMuted());
483 484
    connect(qgcApp()->toolbox()->audioOutput(), &GAudioOutput::mutedChanged, _ui.actionMuteAudioOutput, &QAction::setChecked);
    connect(_ui.actionMuteAudioOutput, &QAction::triggered, qgcApp()->toolbox()->audioOutput(), &GAudioOutput::mute);
485

486
    // Connect internal actions
487
    connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::vehicleAdded, this, &MainWindow::_vehicleAdded);
488 489
}

Don Gagne's avatar
Don Gagne committed
490
void MainWindow::_openUrl(const QString& url, const QString& errorMessage)
491
{
Don Gagne's avatar
Don Gagne committed
492
    if(!QDesktopServices::openUrl(QUrl(url))) {
493
        qgcApp()->showMessage(QString("Could not open information in browser: %1").arg(errorMessage));
494 495 496
    }
}

497
void MainWindow::_vehicleAdded(Vehicle* vehicle)
498
{
499
    connect(vehicle->uas(), &UAS::valueChanged, this, &MainWindow::valueChanged);
500 501
}

502 503
/// Stores the state of the toolbar, status bar and widgets associated with the current view
void MainWindow::_storeCurrentViewState(void)
504
{
Don Gagne's avatar
Don Gagne committed
505
#ifndef __mobile__
506 507
    foreach(QGCDockWidget* dockWidget, _mapName2DockWidget) {
        dockWidget->saveSettings();
508
    }
Don Gagne's avatar
Don Gagne committed
509
#endif
510

dogmaphobic's avatar
dogmaphobic committed
511
    settings.setValue(_getWindowGeometryKey(), saveGeometry());
512 513
}

514 515 516 517 518 519 520 521 522
/// @brief Saves the last used connection
void MainWindow::saveLastUsedConnection(const QString connection)
{
    QSettings settings;
    QString key(MAIN_SETTINGS_GROUP);
    key += "/LAST_CONNECTION";
    settings.setValue(key, connection);
}

523
#ifdef QGC_MOUSE_ENABLED_LINUX
524 525 526
bool MainWindow::x11Event(XEvent *event)
{
    emit x11EventOccured(event);
527
    return false;
528
}
529
#endif // QGC_MOUSE_ENABLED_LINUX
530 531 532 533 534 535 536

#ifdef UNITTEST_BUILD
void MainWindow::_showQmlTestWidget(void)
{
    new QmlTestWidget();
}
#endif
537 538 539 540 541

#ifndef __mobile__
void MainWindow::_loadVisibleWidgetsSettings(void)
{
    QSettings settings;
542

543
    QString widgets = settings.value(_visibleWidgetsKey).toString();
544

545 546
    if (!widgets.isEmpty()) {
        QStringList nameList = widgets.split(",");
547

548
        foreach (const QString &name, nameList) {
549 550 551 552 553 554 555 556 557
            _showDockWidget(name, true);
        }
    }
}

void MainWindow::_storeVisibleWidgetsSettings(void)
{
    QString widgetNames;
    bool firstWidget = true;
558

559
    foreach (const QString &name, _mapName2DockWidget.keys()) {
560 561 562 563 564 565
        if (_mapName2DockWidget[name]->isVisible()) {
            if (!firstWidget) {
                widgetNames += ",";
            } else {
                firstWidget = false;
            }
566

567 568 569
            widgetNames += name;
        }
    }
570

571
    QSettings settings;
572

573 574 575
    settings.setValue(_visibleWidgetsKey, widgetNames);
}
#endif
576

Don Gagne's avatar
Don Gagne committed
577
QObject* MainWindow::rootQmlObject(void)
578
{
Don Gagne's avatar
Don Gagne committed
579
    return _mainQmlWidgetHolder->getRootObject();
580
}