diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml index 401c67777..7e6179226 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS.xml @@ -2,12 +2,13 @@ true true - false Default configuration
Default configuration built to work on all screen sizes
false + + true - 700 + 600 800 default false diff --git a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml index 074ee1ea5..ab7449588 100644 --- a/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml +++ b/ground/openpilotgcs/share/openpilotgcs/default_configurations/OpenPilotGCS_wide.xml @@ -2,16 +2,16 @@ true true - false - Notify Plugin - settings - true - 700 - 800 - false Wide configuration -
Default configuration built for wide screens (17"up)
- wide +
Default configuration built for wide screens (17" and up)
+ false + + + true + 600 + 800 + default + false
0 diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss new file mode 100644 index 000000000..0f100f1cc --- /dev/null +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default.qss @@ -0,0 +1,84 @@ +/* Default styles */ + +MyListWidget { + font-size: 11px; +} + +Utils--StyledBar { + background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255)); +} + +QSlider::groove:horizontal { + border: 1px solid rgb(196, 196, 196); + background: white; + height: 6px; + border-radius: 2px; + margin 10px 10px; +} + +QSlider::add-page:horizontal { + background: #fff; + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::sub-page:horizontal { + background: rgb(249, 117, 76); + border: 1px solid #777; + height: 1px; + border-radius: 4px; +} + +QSlider::handle:horizontal { + background: rgb(196, 196, 196); + width: 18px; + height: 28px; + margin: -2px 0; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::groove:vertical { + border: 1px solid rgb(196, 196, 196); + background: white; + width: 6px; + border-radius: 2px; + margin 0px -10px; + margin-top: 5px; + margin-bottom: 5px; +} + +QSlider::sub-page:vertical { + background: #fff; + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::add-page:vertical { + background: rgb(249, 117, 76); + border: 1px solid #777; + width: 1px; + border-radius: 4px; +} + +QSlider::handle:vertical { + background: rgb(196, 196, 196); + width: 18px; + margin: -6 -6; + border-radius: 3px; + border: 1px solid #777; +} + +QSlider::handle:vertical:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} + +QSlider::handle:horizontal:hover { + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); + border: 1px solid #444; + border-radius: 4px; +} diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss index 97844c95a..64ac641ab 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss @@ -1,105 +1,19 @@ -MyListWidget {font-size: 11px;} -MixerCurveWidget {font-size: 12px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - +/* Linux styles */ +QGroupBox { + border: 1px solid gray; + border-radius: 5px; + margin-top: 1ex; + font-size: 11px; + font-weight: bold; +} +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; +} - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } +MixerCurveWidget { + font-size: 12px; +} diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_macos.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_macos.qss index 430d04d67..55fa1b6c1 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_macos.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_macos.qss @@ -1,104 +1,22 @@ -MyListWidget {font-size: 11px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - +/* MacOS styles */ +QGroupBox { + border: 1px solid gray; + border-radius: 5px; + margin-top: 1ex; + font-size: 11px; + font-weight: bold; +} +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; +} - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } +QTabWidget::pane { + margin: 1px, 1px, 1px, 1px; + border: 2px solid rgb(196, 196, 196); + border-radius: 5px; + padding: 0px; +} diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_windows.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_windows.qss index 430d04d67..e378375c0 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_windows.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_windows.qss @@ -1,104 +1,18 @@ -MyListWidget {font-size: 11px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - +/* Windows styles */ +QGroupBox { + border: 1px solid gray; + border-radius: 3px; + margin-top: 1ex; + padding: 1ex 0px 0px 0px; + font-size: 11px; + font-weight: bold; +} - - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + left: 7px; + top: -1ex; + padding: 0px 3px; +} diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss deleted file mode 100644 index 97844c95a..000000000 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss +++ /dev/null @@ -1,105 +0,0 @@ -MyListWidget {font-size: 11px;} -MixerCurveWidget {font-size: 12px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - - - - - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_macos.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_macos.qss deleted file mode 100644 index 430d04d67..000000000 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_macos.qss +++ /dev/null @@ -1,104 +0,0 @@ -MyListWidget {font-size: 11px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - - - - - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_windows.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_windows.qss deleted file mode 100644 index 430d04d67..000000000 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_windows.qss +++ /dev/null @@ -1,104 +0,0 @@ -MyListWidget {font-size: 11px;} -Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} - - - - - - - QGroupBox { - border: 1px solid gray; - border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ - font-size: 11px; - font-weight: bold; - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top left; /* position at the top center */ - padding: 0 3px; - - } - - QTabWidget::pane { /* The tab widget frame */ - margin: 1px,1px,1px,1px; - border: 2px solid rgb(196,196,196); - border-radius: 5px; - padding: 0px; - } - - QSlider::groove:horizontal { - border: 1px solid rgb(196,196,196); - background: white; - height: 6px; - border-radius: 2px; - margin 10px 10px; - } - QSlider::add-page:horizontal { - background: #fff; - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - QSlider::sub-page:horizontal { - background: rgb(249,117,76); - border: 1px solid #777; - height: 1px; - border-radius: 4px; - } - - - QSlider::handle:horizontal { - background: rgb(196,196,196); - width: 18px; - height: 28px; - margin: -2px 0; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::groove:vertical { - border: 1px solid rgb(196,196,196); - background: white; - width: 6px; - border-radius: 2px; - margin 0px -10px; - margin-top: 5px; - margin-bottom: 5px; - } - QSlider::sub-page:vertical { - background: #fff; - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - QSlider::add-page:vertical { - background: rgb(249,117,76); - border: 1px solid #777; - width: 1px; - border-radius: 4px; - } - - - QSlider::handle:vertical { - background: rgb(196,196,196); - width: 18px; - margin: -6 -6; - border-radius: 3px; - border: 1px solid #777; - } - - QSlider::handle:vertical:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } - - QSlider::handle:horizontal:hover { - background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #fff, stop:1 #ddd); - border: 1px solid #444; - border-radius: 4px; - } diff --git a/ground/openpilotgcs/src/app/main.cpp b/ground/openpilotgcs/src/app/main.cpp index b641b4aac..98b93ff9a 100644 --- a/ground/openpilotgcs/src/app/main.cpp +++ b/ground/openpilotgcs/src/app/main.cpp @@ -50,6 +50,8 @@ #include #include +#include + enum { OptionIndent = 4, DescriptionIndent = 24 }; static const char *appNameC = "OpenPilot GCS"; @@ -234,6 +236,9 @@ static void overrideSettings(QSettings &settings, int argc, char **argv){ int main(int argc, char **argv) { + QElapsedTimer timer; + timer.start(); + #ifdef Q_OS_MAC // increase the number of file that can be opened in OpenPilot GCS struct rlimit rl; @@ -391,5 +396,11 @@ int main(int argc, char **argv) splash.showProgressMessage(QObject::tr("Application started.")); QTimer::singleShot(1500, &splash, SLOT(close())); - return app.exec(); + qDebug() << "main() took" << timer.elapsed() << "ms"; + + int ret = app.exec(); + + qDebug() << "GCS ran for" << timer.elapsed() << "ms"; + + return ret; } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp index 8d1e7ff1c..2580c2dab 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp @@ -41,7 +41,6 @@ namespace Core { - ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidget *modeStack) : QWidget(mainWindow), m_availableDevList(0), @@ -50,36 +49,41 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidge polling(true), m_mainWindow(mainWindow) { - QHBoxLayout *layout = new QHBoxLayout; - layout->setSpacing(5); - layout->setContentsMargins(5,2,5,2); - + // monitor widget m_monitorWidget = new TelemetryMonitorWidget(this); - layout->addWidget(m_monitorWidget, Qt::AlignHCenter); - - layout->addWidget(new QLabel(tr("Connections:"))); + // device list m_availableDevList = new QComboBox; - m_availableDevList->setMinimumWidth(100); - m_availableDevList->setMaximumWidth(150); + m_availableDevList->setMinimumWidth(120); + m_availableDevList->setMaximumWidth(180); m_availableDevList->setContextMenuPolicy(Qt::CustomContextMenu); - layout->addWidget(m_availableDevList); + // connect button m_connectBtn = new QPushButton(tr("Connect")); m_connectBtn->setEnabled(false); - layout->addWidget(m_connectBtn); + + // put everything together + QHBoxLayout *layout = new QHBoxLayout; + layout->setSpacing(5); + layout->setContentsMargins(5, 2, 5, 2); + + layout->addWidget(m_monitorWidget, 0, Qt::AlignVCenter); + layout->addWidget(new QLabel(tr("Connections:")), 0, Qt::AlignVCenter); + layout->addWidget(m_availableDevList, 0, Qt::AlignVCenter); + layout->addWidget(m_connectBtn, 0, Qt::AlignVCenter); setLayout(layout); modeStack->setCornerWidget(this, Qt::TopRightCorner); QObject::connect(m_connectBtn, SIGNAL(clicked()), this, SLOT(onConnectClicked())); + QObject::connect(m_availableDevList, SIGNAL(currentIndexChanged(int)), this, SLOT(onDeviceSelectionChanged(int))); // setup our reconnect timers reconnect = new QTimer(this); reconnectCheck = new QTimer(this); - connect(reconnect,SIGNAL(timeout()),this,SLOT(reconnectSlot())); - connect(reconnectCheck,SIGNAL(timeout()),this,SLOT(reconnectCheckSlot())); + connect(reconnect, SIGNAL(timeout()), this, SLOT(reconnectSlot())); + connect(reconnectCheck, SIGNAL(timeout()), this, SLOT(reconnectCheckSlot())); } ConnectionManager::~ConnectionManager() @@ -103,7 +107,8 @@ void ConnectionManager::init() */ bool ConnectionManager::connectDevice(DevListItem device) { - DevListItem connection_device = findDevice(m_availableDevList->itemData(m_availableDevList->currentIndex(),Qt::ToolTipRole).toString()); + QString deviceName = m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString(); + DevListItem connection_device = findDevice(deviceName); if (!connection_device.connection) return false; @@ -224,21 +229,33 @@ void ConnectionManager::onConnectionDestroyed(QObject *obj) disconnectDevice(); } +/** +* Slot called when the user selects a device from the combo box +*/ +void ConnectionManager::onDeviceSelectionChanged(int index) +{ + if (index >= 0) { + QString deviceName = m_availableDevList->itemData(index, Qt::ToolTipRole).toString(); + m_availableDevList->setToolTip(deviceName); + } +} + /** * Slot called when the user clicks the connect/disconnect button */ void ConnectionManager::onConnectClicked() { // Check if we have a ioDev already created: - if (!m_ioDev) - { + if (!m_ioDev) { // connecting to currently selected device - DevListItem device = findDevice(m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString()); - if (device.connection) + QString deviceName = m_availableDevList->itemData(m_availableDevList->currentIndex(), Qt::ToolTipRole).toString(); + DevListItem device = findDevice(deviceName); + if (device.connection) { connectDevice(device); + } } - else - { // disconnecting + else { + // disconnecting disconnectDevice(); } } @@ -444,32 +461,32 @@ void ConnectionManager::devChanged(IConnection *connection) void ConnectionManager::updateConnectionDropdown() { - //add all the list again to the combobox - foreach (DevListItem d, m_devList) - { + // add all the list again to the combobox + foreach (DevListItem d, m_devList) { m_availableDevList->addItem(d.getConName()); - m_availableDevList->setItemData(m_availableDevList->count()-1, d.getConName(), Qt::ToolTipRole); - if(!m_ioDev && d.getConName().startsWith("USB")) - { - if(m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect()) + m_availableDevList->setItemData(m_availableDevList->count() - 1, d.getConName(), Qt::ToolTipRole); + if (!m_ioDev && d.getConName().startsWith("USB")) { + if (m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect()) { m_availableDevList->setCurrentIndex(m_availableDevList->count() - 1); - - if(m_mainWindow->generalSettings()->autoConnect() && polling) - { + } + if (m_mainWindow->generalSettings()->autoConnect() && polling) { qDebug() << "Automatically opening device"; connectDevice(d); - qDebug()<<"ConnectionManager::devChanged autoconnected USB device"; + qDebug() << "ConnectionManager::updateConnectionDropdown autoconnected USB device"; } } } - if(m_ioDev)//if a device is connected make it the one selected on the dropbox - { - for(int x=0;xcount();++x) - { - if(m_connectionDevice.getConName()==m_availableDevList->itemData(x,Qt::ToolTipRole).toString()) - m_availableDevList->setCurrentIndex(x); + if (m_ioDev) { + // if a device is connected make it the one selected on the dropbox + for (int i = 0; i < m_availableDevList->count(); i++) { + QString deviceName = m_availableDevList->itemData(i, Qt::ToolTipRole).toString(); + if (m_connectionDevice.getConName() == deviceName) { + m_availableDevList->setCurrentIndex(i); + } } } + // update combo box tooltip + onDeviceSelectionChanged(m_availableDevList->currentIndex()); } void Core::ConnectionManager::connectionsCallBack() diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h index 2f131d4a3..8a8f49eff 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h @@ -125,6 +125,7 @@ private slots: void aboutToRemoveObject(QObject *obj); void onConnectClicked(); + void onDeviceSelectionChanged(int index); void devChanged(IConnection *connection); void onConnectionDestroyed(QObject *obj); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.cpp index d14f35e02..bdcbac380 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -77,12 +77,8 @@ static inline QList sortedOptionsPages() return rc; } -SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, - const QString &pageId) - : QDialog(parent), - m_applied(false), - m_windowWidth(0), - m_windowHeight(0) +SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, const QString &pageId) + : QDialog(parent), m_applied(false) { setupUi(this); #ifdef Q_OS_MAC @@ -90,19 +86,28 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId, #else setWindowTitle(tr("Options")); #endif + + QSettings *settings = ICore::instance()->settings(); + settings->beginGroup("General"); + + // restore last displayed category and page + // this is done only if no category or page was provided through the constructor QString initialCategory = categoryId; QString initialPage = pageId; - qDebug() << "SettingsDialog constructor initial category: " << initialCategory << ", initial page: " << initialPage; + qDebug() << "SettingsDialog constructor initial category:" << initialCategory << ", initial page:" << initialPage; if (initialCategory.isEmpty() && initialPage.isEmpty()) { - QSettings *settings = ICore::instance()->settings(); - initialCategory = settings->value("General/LastPreferenceCategory", QVariant(QString())).toString(); - initialPage = settings->value("General/LastPreferencePage", QVariant(QString())).toString(); - qDebug() << "SettingsDialog settings initial category: " << initialCategory << ", initial page: " << initialPage; - m_windowWidth = settings->value("General/SettingsWindowWidth", 0).toInt(); - m_windowHeight = settings->value("General/SettingsWindowHeight", 0).toInt(); + initialCategory = settings->value("LastPreferenceCategory", QVariant(QString())).toString(); + initialPage = settings->value("LastPreferencePage", QVariant(QString())).toString(); + qDebug() << "SettingsDialog settings initial category:" << initialCategory << ", initial page: " << initialPage; } - if (m_windowWidth > 0 && m_windowHeight > 0) - resize(m_windowWidth, m_windowHeight); + // restore window size + int windowWidth = settings->value("SettingsWindowWidth", 0).toInt(); + int windowHeight = settings->value("SettingsWindowHeight", 0).toInt(); + qDebug() << "SettingsDialog window width :" << windowWidth << ", height:" << windowHeight; + if (windowWidth > 0 && windowHeight > 0) { + resize(windowWidth, windowHeight); + } + settings->endGroup(); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.h b/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.h index 3000084a2..ebf108c2f 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/dialogs/settingsdialog.h @@ -46,15 +46,12 @@ class SettingsDialog : public QDialog, public ::Ui::SettingsDialog Q_OBJECT public: - SettingsDialog(QWidget *parent, - const QString &initialCategory = QString(), - const QString &initialPage = QString()); + SettingsDialog(QWidget *parent, const QString &initialCategory = QString(), const QString &initialPage = QString()); ~SettingsDialog(); - // Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked - // at least once + // Run the dialog and return true if 'Ok' was choosen or 'Apply' was invoked at least once bool execDialog(); - void insertPage(IOptionsPage* page); + void insertPage(IOptionsPage *page); void deletePage(); void updateText(QString text); void disableApplyOk(bool disable); @@ -74,17 +71,13 @@ private slots: void apply(); void categoryItemSelectedShowChildInstead(); - private: - QList m_pages; QMap *> m_categoryItemsMap; UAVGadgetInstanceManager *m_instanceManager; bool m_applied; QString m_currentCategory; QString m_currentPage; - int m_windowWidth; - int m_windowHeight; }; } // namespace Internal diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp index f53769b90..c955fd7e3 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp @@ -84,6 +84,7 @@ #include #include #include +#include #include "dialogs/importsettings.h" #include @@ -268,39 +269,41 @@ void MainWindow::modeChanged(Core::IMode */*mode*/) void MainWindow::extensionsInitialized() { QSettings *qs = m_settings; - QString commandLine; - if ( ! qs->allKeys().count() ) { - foreach(QString str, qApp->arguments()) { - if(str.contains("configfile")) { - qDebug() << "ass"; - commandLine = str.split("=").at(1); - qDebug() << commandLine; - } - } + if (!qs->allKeys().count()) { + // no user settings, so try to load some default ones QDir directory(QCoreApplication::applicationDirPath()); #ifdef Q_OS_MAC - directory.cdUp(); - directory.cd("Resources"); + directory.cdUp(); + directory.cd("Resources"); #else - directory.cdUp(); - directory.cd("share"); - directory.cd("openpilotgcs"); + directory.cdUp(); + directory.cd("share"); + directory.cd("openpilotgcs"); #endif directory.cd("default_configurations"); qDebug() << "Looking for configuration files in:" << directory.absolutePath(); QString filename; - if(!commandLine.isEmpty() && QFile::exists(directory.absolutePath() + QDir::separator() + commandLine)) { + // check if command line contains a config file name + QString commandLine; + foreach(QString str, qApp->arguments()) { + if (str.contains("configfile")) { + commandLine = str.split("=").at(1); + } + } + if (!commandLine.isEmpty() && QFile::exists(directory.absolutePath() + QDir::separator() + commandLine)) { + // use file name specified on command line filename = directory.absolutePath() + QDir::separator() + commandLine; qDebug() << "Configuration file" << filename << "specified on command line will be loaded."; - } - else if(QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) { + } else if (QFile::exists(directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME)) { + // use default file name filename = directory.absolutePath() + QDir::separator() + DEFAULT_CONFIG_FILENAME; qDebug() << "Default configuration file" << filename << "will be loaded."; - } - else { - qDebug() << "Default configuration file " << directory.absolutePath() << QDir::separator() << DEFAULT_CONFIG_FILENAME << "was not found."; + } else { + // prompt user for default file name + qDebug() << "Default configuration file" << directory.absolutePath() << QDir::separator() + << DEFAULT_CONFIG_FILENAME << "was not found."; importSettings *dialog = new importSettings(this); dialog->loadFiles(directory.absolutePath()); dialog->exec(); @@ -309,16 +312,54 @@ void MainWindow::extensionsInitialized() qDebug() << "Configuration file" << filename << "was selected and will be loaded."; } + // create settings from file qs = new QSettings(filename, XmlConfig::XmlSettingsFormat); + + // transfer loaded settings to application settings + QStringList keys = qs->allKeys(); + foreach(QString key, keys) { + m_settings->setValue(key, qs->value(key)); + } + + // and delete loaded settings + delete qs; + qs = m_settings; + qDebug() << "Configuration file" << filename << "was loaded."; } qs->beginGroup("General"); - m_config_description=qs->value("Description", "none").toString(); - m_config_details=qs->value("Details", "none").toString(); - m_config_stylesheet=qs->value("StyleSheet", "none").toString(); - loadStyleSheet(m_config_stylesheet); + m_config_description = qs->value("Description", "none").toString(); + m_config_details = qs->value("Details", "none").toString(); + m_config_stylesheet = qs->value("StyleSheet", "none").toString(); + + qDebug() << "Configured style sheet:" << m_config_stylesheet; + if (m_config_stylesheet == "wide") { + // OP-869 just in case some user configuration still references the now obsolete "wide" style sheet + m_config_stylesheet = "default"; + } + + // Load common style sheet + QString style = loadStyleSheet(m_config_stylesheet + ".qss"); + + // Load and concatenate platform specific style sheet + QString fileName = m_config_stylesheet; +#ifdef Q_OS_MAC + fileName += "_macos.qss"; +#elif defined(Q_OS_LINUX) + fileName += "_linux.qss"; +#else + fileName += "_windows.qss"; +#endif + style += loadStyleSheet(fileName); + + // We'll use qApp macro to get the QApplication pointer + // and set the style sheet application wide. + qDebug() << "Setting application style sheet to:" << style; + qApp->setStyleSheet(style); + qs->endGroup(); + m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this); m_uavGadgetInstanceManager->readSettings(qs); @@ -332,53 +373,45 @@ void MainWindow::extensionsInitialized() emit m_coreImpl->coreOpened(); } -void MainWindow::loadStyleSheet(QString name) { - /* Let's use QFile and point to a resource... */ - QDir directory(QCoreApplication::applicationDirPath()); +QString MainWindow::loadStyleSheet(QString fileName) { + // Let's use QFile and point to a resource... + QDir dir(QCoreApplication::applicationDirPath()); #ifdef Q_OS_MAC - directory.cdUp(); - directory.cd("Resources"); + dir.cdUp(); + dir.cd("Resources"); #else - directory.cdUp(); - directory.cd("share"); - directory.cd("openpilotgcs"); -#endif - directory.cd("stylesheets"); -#ifdef Q_OS_MAC - QFile data(directory.absolutePath()+QDir::separator()+name+"_macos.qss"); -#elif defined(Q_OS_LINUX) - QFile data(directory.absolutePath()+QDir::separator()+name+"_linux.qss"); -#else - QFile data(directory.absolutePath()+QDir::separator()+name+"_windows.qss"); + dir.cdUp(); + dir.cd("share"); + dir.cd("openpilotgcs"); #endif + dir.cd("stylesheets"); QString style; - /* ...to open the file */ - if(data.open(QFile::ReadOnly)) { - /* QTextStream... */ - QTextStream styleIn(&data); - /* ...read file to a string. */ - style = styleIn.readAll(); - data.close(); - /* We'll use qApp macro to get the QApplication pointer - * and set the style sheet application wide. */ - qApp->setStyleSheet(style); - qDebug()<<"Loaded stylesheet:"<saveSettingsOnExit() ){ + if (!m_generalSettings->saveSettingsOnExit()) { m_dontSaveSettings = true; } - if ( !m_dontSaveSettings ){ + if (!m_dontSaveSettings) { emit m_coreImpl->saveSettingsRequested(); } - const QList listeners = - ExtensionSystem::PluginManager::instance()->getObjects(); + const QList listeners = ExtensionSystem::PluginManager::instance()->getObjects(); foreach (ICoreListener *listener, listeners) { if (!listener->coreAboutToClose()) { event->ignore(); @@ -388,7 +421,7 @@ void MainWindow::closeEvent(QCloseEvent *event) emit m_coreImpl->coreAboutToClose(); - if ( !m_dontSaveSettings ){ + if (!m_dontSaveSettings) { saveSettings(m_settings); m_uavGadgetInstanceManager->saveSettings(m_settings); } @@ -396,7 +429,6 @@ void MainWindow::closeEvent(QCloseEvent *event) } // Check for desktop file manager file drop events - static bool isDesktopFileManagerDrop(const QMimeData *d, QStringList *files = 0) { if (files) @@ -518,9 +550,7 @@ void MainWindow::registerDefaultContainers() ac->appendGroup(Constants::G_HELP_ABOUT); } -static Command *createSeparator(ActionManager *am, QObject *parent, - const QString &name, - const QList &context) +static Command *createSeparator(ActionManager *am, QObject *parent, const QString &name, const QList &context) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); @@ -880,13 +910,12 @@ void MainWindow::setFocusToEditor() } -bool MainWindow::showOptionsDialog(const QString &category, - const QString &page, - QWidget *parent) +bool MainWindow::showOptionsDialog(const QString &category, const QString &page, QWidget *parent) { emit m_coreImpl->optionsDialogRequested(); - if (!parent) + if (!parent) { parent = this; + } SettingsDialog dlg(parent, category, page); return dlg.execDialog(); } @@ -1155,13 +1184,18 @@ void MainWindow::createWorkspaces(QSettings* qs, bool diffOnly) { } else { m_uavGadgetManagers.clear(); } - for (int i = start; i < newWorkspacesNo; ++i) { - const QString name = m_workspaceSettings->name(i); + QElapsedTimer totalTimer; + totalTimer.start(); + for (int i = start; i < newWorkspacesNo; ++i) { + QElapsedTimer timer; + timer.start(); + + const QString name = m_workspaceSettings->name(i); const QString iconName = m_workspaceSettings->iconName(i); const QString modeName = m_workspaceSettings->modeName(i); - uavGadgetManager = new Core::UAVGadgetManager(CoreImpl::instance(), name, - QIcon(iconName), 90-i+1, modeName, this); + uavGadgetManager = new Core::UAVGadgetManager(CoreImpl::instance(), name, QIcon(iconName), 90 - i + 1, modeName, + this); connect(uavGadgetManager, SIGNAL(showUavGadgetMenus(bool, bool)), this, SLOT(showUavGadgetMenus(bool, bool))); @@ -1175,7 +1209,9 @@ void MainWindow::createWorkspaces(QSettings* qs, bool diffOnly) { pm->addObject(uavGadgetManager); m_uavGadgetManagers.append(uavGadgetManager); uavGadgetManager->readSettings(qs); + qDebug() << "MainWindow::createWorkspaces - creating workspace" << name << "took" << timer.elapsed() << "ms"; } + qDebug() << "MainWindow::createWorkspaces - creating workspaces took" << totalTimer.elapsed() << "ms"; } static const char *settingsGroup = "MainWindow"; @@ -1187,7 +1223,7 @@ static const char *modePriorities = "ModePriorities"; void MainWindow::readSettings(QSettings* qs, bool workspaceDiffOnly) { - if ( !qs ){ + if (!qs) { qs = m_settings; } @@ -1209,8 +1245,9 @@ void MainWindow::readSettings(QSettings* qs, bool workspaceDiffOnly) } else { resize(750, 400); } - if (qs->value(QLatin1String(maxKey), false).toBool()) + if (qs->value(QLatin1String(maxKey), false).toBool()) { setWindowState(Qt::WindowMaximized); + } setFullScreen(qs->value(QLatin1String(fullScreenKey), false).toBool()); qs->endGroup(); @@ -1235,9 +1272,11 @@ void MainWindow::readSettings(QSettings* qs, bool workspaceDiffOnly) void MainWindow::saveSettings(QSettings* qs) { - if ( m_dontSaveSettings ) return; + if (m_dontSaveSettings) { + return; + } - if ( !qs ){ + if (!qs) { qs = m_settings; } @@ -1281,7 +1320,7 @@ void MainWindow::saveSettings(QSettings* qs) void MainWindow::readSettings(IConfigurablePlugin* plugin, QSettings* qs) { - if ( !qs ){ + if (!qs) { qs = m_settings; } @@ -1304,8 +1343,11 @@ void MainWindow::readSettings(IConfigurablePlugin* plugin, QSettings* qs) void MainWindow::saveSettings(IConfigurablePlugin* plugin, QSettings* qs) { - if ( m_dontSaveSettings ) return; - if ( !qs ){ + if (m_dontSaveSettings) { + return; + } + + if (!qs) { qs = m_settings; } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h index da7d40386..641c8bf6c 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h @@ -170,7 +170,7 @@ private: void registerDefaultContainers(); void registerDefaultActions(); void createWorkspaces(QSettings* qs, bool diffOnly = false); - void loadStyleSheet(QString name); + QString loadStyleSheet(QString name); CoreImpl *m_coreImpl; UniqueIDManager *m_uniqueIDManager; diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp index 65fc167ac..e1775ace0 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp @@ -432,9 +432,9 @@ void ScopeGadgetWidget::addCurvePlot(QString uavObject, QString uavFieldSubField QString curveNameScaled; if(scaleOrderFactor == 0) - curveNameScaled = curveName + "(" + units + ")"; + curveNameScaled = curveName + " (" + units + ")"; else - curveNameScaled = curveName + "(x10^" + QString::number(scaleOrderFactor) + " " + units + ")"; + curveNameScaled = curveName + " (x10^" + QString::number(scaleOrderFactor) + " " + units + ")"; QwtPlotCurve* plotCurve = new QwtPlotCurve(curveNameScaled); plotCurve->setPen(pen); diff --git a/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.cpp b/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.cpp index 75510f52c..8d8c9bbe6 100644 --- a/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.cpp +++ b/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.cpp @@ -30,11 +30,13 @@ #include "utils/pathutils.h" #include +#include + /** * Loads a saved configuration or defaults if non exist. * */ -SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings* qSettings, QObject *parent) : +SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings *qSettings, QObject *parent) : IUAVGadgetConfiguration(classId, parent), m_speed("57600") { @@ -43,6 +45,10 @@ SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings* settings = Core::ICore::instance()->settings(); } +SerialPluginConfiguration::~SerialPluginConfiguration() +{ +} + /** * Clones a configuration. * @@ -50,7 +56,7 @@ SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings* IUAVGadgetConfiguration *SerialPluginConfiguration::clone() { SerialPluginConfiguration *m = new SerialPluginConfiguration(this->classId()); - m->m_speed=m_speed; + m->m_speed = m_speed; return m; } @@ -61,23 +67,24 @@ IUAVGadgetConfiguration *SerialPluginConfiguration::clone() void SerialPluginConfiguration::saveConfig(QSettings* settings) const { settings->setValue("speed", m_speed); } + void SerialPluginConfiguration::restoresettings() { settings->beginGroup(QLatin1String("SerialConnection")); - QString str=(settings->value(QLatin1String("speed"), tr("")).toString()); - if(str.isEmpty()) - m_speed="57600"; - else - m_speed=str; + QString str = (settings->value(QLatin1String("speed"), tr("")).toString()); + qDebug() << "SerialPluginConfiguration::restoresettings - speed" << str; + if (str.isEmpty()) { + m_speed = "57600"; + } + else { + m_speed = str; + } settings->endGroup(); - } + void SerialPluginConfiguration::savesettings() const { settings->beginGroup(QLatin1String("SerialConnection")); settings->setValue(QLatin1String("speed"), m_speed); settings->endGroup(); } -SerialPluginConfiguration::~SerialPluginConfiguration() -{ -} diff --git a/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.h b/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.h index 793ad102b..41a1e2c5a 100644 --- a/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.h +++ b/ground/openpilotgcs/src/plugins/serialconnection/serialpluginconfiguration.h @@ -40,16 +40,19 @@ class SerialPluginConfiguration : public IUAVGadgetConfiguration { Q_OBJECT public: - explicit SerialPluginConfiguration(QString classId, QSettings* qSettings = 0, QObject *parent = 0); - QString speed() {return m_speed;} - void saveConfig(QSettings* settings) const; + explicit SerialPluginConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0); + virtual ~SerialPluginConfiguration(); + + QString speed() { return m_speed; } + void saveConfig(QSettings *settings) const; IUAVGadgetConfiguration *clone(); void savesettings() const; void restoresettings(); - virtual ~SerialPluginConfiguration(); + private: QString m_speed; - QSettings* settings; + QSettings *settings; + public slots: void setSpeed(QString speed) { m_speed = speed; } diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml index 4d08f2d80..6d794b210 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/NewsPanel.qml @@ -53,7 +53,7 @@ Item { spacing: 4 Text { text: title - width: view.width + width: view.width - 4 textFormat: text.indexOf("&") > 0 ? Text.StyledText : Text.PlainText elide: Text.ElideRight font.bold: true @@ -62,8 +62,10 @@ Item { Text { text: description - width: view.width + width: view.width - 4 textFormat: text.indexOf("&") > 0 ? Text.StyledText : Text.PlainText + maximumLineCount: 3 + wrapMode: Text.WordWrap elide: Text.ElideRight color: mouseArea.containsMouse ? "#224d81" : "black" } diff --git a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml index be6ddd9a4..e4c11bd86 100644 --- a/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml +++ b/ground/openpilotgcs/src/plugins/welcome/qml/SitesPanel.qml @@ -32,10 +32,9 @@ Item { ListView { id: view width: parent.width - anchors { top: header.bottom; topMargin: 14; bottom: parent.bottom } + anchors { top: header.bottom; topMargin: 14; leftMargin: 32; bottom: parent.bottom } model: sitesModel spacing: 8 - clip: true delegate: Text { text: title