SettingsDialog.cc 2.23 KB
Newer Older
1
/*=====================================================================
2

3
 QGroundControl Open Source Ground Control Station
4

5
 (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
6

7
 This file is part of the QGROUNDCONTROL project
8

9 10 11 12
 QGROUNDCONTROL is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
13

14 15 16 17
 QGROUNDCONTROL 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 General Public License for more details.
18

19 20
 You should have received a copy of the GNU General Public License
 along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
21

22 23
 ======================================================================*/

24
#include <QSettings>
25
#include <QDesktopWidget>
26

Don Gagne's avatar
Don Gagne committed
27
#include "SettingsDialog.h"
28
#include "MainWindow.h"
Don Gagne's avatar
Don Gagne committed
29
#include "ui_SettingsDialog.h"
lm's avatar
lm committed
30

31 32 33
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkSettingsWidget.h"
34
#include "GAudioOutput.h"
Don Gagne's avatar
Don Gagne committed
35
#include "QGCApplication.h"
Don Gagne's avatar
Don Gagne committed
36
#include "QGCFileDialog.h"
Don Gagne's avatar
Don Gagne committed
37
#include "QGCMessageBox.h"
38
#include "MainToolBarController.h"
39
#include "FlightMapSettings.h"
40

41
SettingsDialog::SettingsDialog(QWidget *parent, Qt::WindowFlags flags)
42 43
    : QDialog(parent, flags)
    , _ui(new Ui::SettingsDialog)
lm's avatar
lm committed
44
{
45
    _ui->setupUi(this);
46

47
    // Center the window on the screen.
48 49 50
    QDesktopWidget *desktop = QApplication::desktop();
    int screen = desktop->screenNumber(parent);

51
    QRect position = frameGeometry();
52
    position.moveCenter(QApplication::desktop()->availableGeometry(screen).center());
53
    move(position.topLeft());
54

55
    MAVLinkSettingsWidget* pMavsettings  = new MAVLinkSettingsWidget(qgcApp()->toolbox()->mavlinkProtocol(), this);
56 57 58 59

    // Add the MAVLink settings pane
    _ui->tabWidget->addTab(pMavsettings,  "MAVLink");

60
    this->window()->setWindowTitle(tr("QGroundControl Settings"));
61

62
    _ui->tabWidget->setCurrentWidget(pMavsettings);
Don Gagne's avatar
Don Gagne committed
63 64

    connect(_ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
lm's avatar
lm committed
65 66
}

67
SettingsDialog::~SettingsDialog()
lm's avatar
lm committed
68
{
69
    delete _ui;
lm's avatar
lm committed
70
}