mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
Merge branch 'filnet/OP-996_add_option_to_remember_last_selected_workspace' into next
This commit is contained in:
commit
6dfd7c1c88
@ -40,7 +40,7 @@
|
|||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidget *modeStack) :
|
ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow) :
|
||||||
QWidget(mainWindow),
|
QWidget(mainWindow),
|
||||||
m_availableDevList(0),
|
m_availableDevList(0),
|
||||||
m_connectBtn(0),
|
m_connectBtn(0),
|
||||||
@ -73,8 +73,6 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, QTabWidge
|
|||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
modeStack->setCornerWidget(this, Qt::TopRightCorner);
|
|
||||||
|
|
||||||
QObject::connect(m_connectBtn, SIGNAL(clicked()), this, SLOT(onConnectClicked()));
|
QObject::connect(m_connectBtn, SIGNAL(clicked()), this, SLOT(onConnectClicked()));
|
||||||
QObject::connect(m_availableDevList, SIGNAL(currentIndexChanged(int)), this, SLOT(onDeviceSelectionChanged(int)));
|
QObject::connect(m_availableDevList, SIGNAL(currentIndexChanged(int)), this, SLOT(onDeviceSelectionChanged(int)));
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@
|
|||||||
#ifndef CONNECTIONMANAGER_H
|
#ifndef CONNECTIONMANAGER_H
|
||||||
#define CONNECTIONMANAGER_H
|
#define CONNECTIONMANAGER_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "generalsettings.h"
|
#include "generalsettings.h"
|
||||||
#include "telemetrymonitorwidget.h"
|
#include "telemetrymonitorwidget.h"
|
||||||
#include <coreplugin/iconnection.h>
|
#include <coreplugin/iconnection.h>
|
||||||
|
#include <QWidget>
|
||||||
#include <QtCore/QVector>
|
#include <QtCore/QVector>
|
||||||
#include <QtCore/QIODevice>
|
#include <QtCore/QIODevice>
|
||||||
#include <QtCore/QLinkedList>
|
#include <QtCore/QLinkedList>
|
||||||
@ -43,20 +43,14 @@
|
|||||||
#include "core_global.h"
|
#include "core_global.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QTabWidget;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class IConnection;
|
class IConnection;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class FancyTabWidget;
|
|
||||||
class FancyActionBar;
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
|
|
||||||
class DevListItem {
|
class DevListItem {
|
||||||
public:
|
public:
|
||||||
DevListItem(IConnection *c, IConnection::device d) :
|
DevListItem(IConnection *c, IConnection::device d) :
|
||||||
@ -86,7 +80,7 @@ class CORE_EXPORT ConnectionManager : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionManager(Internal::MainWindow *mainWindow, QTabWidget *modeStack);
|
ConnectionManager(Internal::MainWindow *mainWindow);
|
||||||
virtual ~ConnectionManager();
|
virtual ~ConnectionManager();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
@ -177,7 +177,8 @@ MainWindow::MainWindow() :
|
|||||||
#endif
|
#endif
|
||||||
m_modeManager = new ModeManager(this, m_modeStack);
|
m_modeManager = new ModeManager(this, m_modeStack);
|
||||||
|
|
||||||
m_connectionManager = new ConnectionManager(this, m_modeStack);
|
m_connectionManager = new ConnectionManager(this);
|
||||||
|
m_modeStack->setCornerWidget(m_connectionManager, Qt::TopRightCorner);
|
||||||
|
|
||||||
m_messageManager = new MessageManager;
|
m_messageManager = new MessageManager;
|
||||||
setCentralWidget(m_modeStack);
|
setCentralWidget(m_modeStack);
|
||||||
@ -1214,8 +1215,9 @@ void MainWindow::readSettings(QSettings *qs, bool workspaceDiffOnly)
|
|||||||
|
|
||||||
createWorkspaces(qs);
|
createWorkspaces(qs);
|
||||||
|
|
||||||
// Read tab ordering
|
// Restore tab ordering
|
||||||
qs->beginGroup(QLatin1String(modePriorities));
|
qs->beginGroup(QLatin1String(modePriorities));
|
||||||
|
|
||||||
QStringList modeNames = qs->childKeys();
|
QStringList modeNames = qs->childKeys();
|
||||||
QMap<QString, int> map;
|
QMap<QString, int> map;
|
||||||
foreach(QString modeName, modeNames) {
|
foreach(QString modeName, modeNames) {
|
||||||
@ -1224,6 +1226,12 @@ void MainWindow::readSettings(QSettings *qs, bool workspaceDiffOnly)
|
|||||||
m_modeManager->reorderModes(map);
|
m_modeManager->reorderModes(map);
|
||||||
|
|
||||||
qs->endGroup();
|
qs->endGroup();
|
||||||
|
|
||||||
|
// Restore selected tab
|
||||||
|
if (m_workspaceSettings->restoreSelectedOnStartup()) {
|
||||||
|
int index = qs->value(QLatin1String("SelectedWorkspace")).toInt();
|
||||||
|
m_modeStack->setCurrentIndex(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1262,12 +1270,16 @@ void MainWindow::saveSettings(QSettings *qs)
|
|||||||
}
|
}
|
||||||
qs->endGroup();
|
qs->endGroup();
|
||||||
|
|
||||||
|
// Write selected tab
|
||||||
|
qs->setValue(QLatin1String("SelectedWorkspace"), m_modeStack->currentIndex());
|
||||||
|
|
||||||
foreach(UAVGadgetManager * manager, m_uavGadgetManagers) {
|
foreach(UAVGadgetManager * manager, m_uavGadgetManagers) {
|
||||||
manager->saveSettings(qs);
|
manager->saveSettings(qs);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_actionManager->saveSettings(qs);
|
m_actionManager->saveSettings(qs);
|
||||||
m_generalSettings->saveSettings(qs);
|
m_generalSettings->saveSettings(qs);
|
||||||
|
|
||||||
qs->beginGroup("General");
|
qs->beginGroup("General");
|
||||||
qs->setValue("Description", m_config_description);
|
qs->setValue("Description", m_config_description);
|
||||||
qs->setValue("Details", m_config_details);
|
qs->setValue("Details", m_config_details);
|
||||||
|
@ -238,6 +238,10 @@ void UAVGadgetInstanceManager::createOptionsPages()
|
|||||||
while (ite.hasNext()) {
|
while (ite.hasNext()) {
|
||||||
IUAVGadgetConfiguration *config = ite.next();
|
IUAVGadgetConfiguration *config = ite.next();
|
||||||
IUAVGadgetFactory *f = factory(config->classId());
|
IUAVGadgetFactory *f = factory(config->classId());
|
||||||
|
if (!f) {
|
||||||
|
qWarning() << "No gadget factory for configuration " + config->classId();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
IOptionsPage *p = f->createOptionsPage(config);
|
IOptionsPage *p = f->createOptionsPage(config);
|
||||||
if (p) {
|
if (p) {
|
||||||
IOptionsPage *page = new UAVGadgetOptionsPageDecorator(p, config, f->isSingleConfigurationGadget());
|
IOptionsPage *page = new UAVGadgetOptionsPageDecorator(p, config, f->isSingleConfigurationGadget());
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "ui_workspacesettings.h"
|
#include "ui_workspacesettings.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
@ -41,10 +40,12 @@ const int WorkspaceSettings::MAX_WORKSPACES = 10;
|
|||||||
|
|
||||||
WorkspaceSettings::WorkspaceSettings(QObject *parent) :
|
WorkspaceSettings::WorkspaceSettings(QObject *parent) :
|
||||||
IOptionsPage(parent)
|
IOptionsPage(parent)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
WorkspaceSettings::~WorkspaceSettings()
|
WorkspaceSettings::~WorkspaceSettings()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
|
|
||||||
@ -84,7 +85,6 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent)
|
|||||||
m_page->iconPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)"));
|
m_page->iconPathChooser->setPromptDialogFilter(tr("Images (*.png *.jpg *.bmp *.xpm)"));
|
||||||
m_page->iconPathChooser->setPromptDialogTitle(tr("Choose icon"));
|
m_page->iconPathChooser->setPromptDialogTitle(tr("Choose icon"));
|
||||||
|
|
||||||
|
|
||||||
connect(m_page->workspaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectWorkspace(int)));
|
connect(m_page->workspaceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectWorkspace(int)));
|
||||||
connect(m_page->numberOfWorkspacesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(numberOfWorkspacesChanged(int)));
|
connect(m_page->numberOfWorkspacesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(numberOfWorkspacesChanged(int)));
|
||||||
connect(m_page->nameEdit, SIGNAL(textEdited(QString)), this, SLOT(textEdited(QString)));
|
connect(m_page->nameEdit, SIGNAL(textEdited(QString)), this, SLOT(textEdited(QString)));
|
||||||
@ -97,6 +97,7 @@ QWidget *WorkspaceSettings::createPage(QWidget *parent)
|
|||||||
m_page->comboBoxTabBarPlacement->setCurrentIndex(m_tabBarPlacementIndex);
|
m_page->comboBoxTabBarPlacement->setCurrentIndex(m_tabBarPlacementIndex);
|
||||||
}
|
}
|
||||||
m_page->checkBoxAllowTabMovement->setChecked(m_allowTabBarMovement);
|
m_page->checkBoxAllowTabMovement->setChecked(m_allowTabBarMovement);
|
||||||
|
m_page->checkBoxRestoreSelectedOnStartup->setChecked(m_restoreSelectedOnStartup);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@ -122,7 +123,10 @@ void WorkspaceSettings::readSettings(QSettings *qs)
|
|||||||
}
|
}
|
||||||
m_tabBarPlacementIndex = qs->value(QLatin1String("TabBarPlacementIndex"), 1).toInt(); // 1 == "Bottom"
|
m_tabBarPlacementIndex = qs->value(QLatin1String("TabBarPlacementIndex"), 1).toInt(); // 1 == "Bottom"
|
||||||
m_allowTabBarMovement = qs->value(QLatin1String("AllowTabBarMovement"), false).toBool();
|
m_allowTabBarMovement = qs->value(QLatin1String("AllowTabBarMovement"), false).toBool();
|
||||||
|
m_restoreSelectedOnStartup = qs->value(QLatin1String("RestoreSelectedOnStartup"), false).toBool();
|
||||||
|
|
||||||
qs->endGroup();
|
qs->endGroup();
|
||||||
|
|
||||||
QTabWidget::TabPosition pos = m_tabBarPlacementIndex == 0 ? QTabWidget::North : QTabWidget::South;
|
QTabWidget::TabPosition pos = m_tabBarPlacementIndex == 0 ? QTabWidget::North : QTabWidget::South;
|
||||||
emit tabBarSettingsApplied(pos, m_allowTabBarMovement);
|
emit tabBarSettingsApplied(pos, m_allowTabBarMovement);
|
||||||
}
|
}
|
||||||
@ -142,6 +146,7 @@ void WorkspaceSettings::saveSettings(QSettings *qs)
|
|||||||
}
|
}
|
||||||
qs->setValue(QLatin1String("TabBarPlacementIndex"), m_tabBarPlacementIndex);
|
qs->setValue(QLatin1String("TabBarPlacementIndex"), m_tabBarPlacementIndex);
|
||||||
qs->setValue(QLatin1String("AllowTabBarMovement"), m_allowTabBarMovement);
|
qs->setValue(QLatin1String("AllowTabBarMovement"), m_allowTabBarMovement);
|
||||||
|
qs->setValue(QLatin1String("RestoreSelectedOnStartup"), m_restoreSelectedOnStartup);
|
||||||
qs->endGroup();
|
qs->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +171,8 @@ void WorkspaceSettings::apply()
|
|||||||
}
|
}
|
||||||
m_tabBarPlacementIndex = m_page->comboBoxTabBarPlacement->currentIndex();
|
m_tabBarPlacementIndex = m_page->comboBoxTabBarPlacement->currentIndex();
|
||||||
m_allowTabBarMovement = m_page->checkBoxAllowTabMovement->isChecked();
|
m_allowTabBarMovement = m_page->checkBoxAllowTabMovement->isChecked();
|
||||||
|
m_restoreSelectedOnStartup = m_page->checkBoxRestoreSelectedOnStartup->isChecked();
|
||||||
|
|
||||||
QTabWidget::TabPosition pos = m_tabBarPlacementIndex == 0 ? QTabWidget::North : QTabWidget::South;
|
QTabWidget::TabPosition pos = m_tabBarPlacementIndex == 0 ? QTabWidget::North : QTabWidget::South;
|
||||||
emit tabBarSettingsApplied(pos, m_allowTabBarMovement);
|
emit tabBarSettingsApplied(pos, m_allowTabBarMovement);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,10 @@ public:
|
|||||||
{
|
{
|
||||||
return m_modeNames.at(i);
|
return m_modeNames.at(i);
|
||||||
}
|
}
|
||||||
|
bool restoreSelectedOnStartup() const
|
||||||
|
{
|
||||||
|
return m_restoreSelectedOnStartup;
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tabBarSettingsApplied(QTabWidget::TabPosition pos, bool movable);
|
void tabBarSettingsApplied(QTabWidget::TabPosition pos, bool movable);
|
||||||
@ -98,6 +102,7 @@ private:
|
|||||||
int m_numberOfWorkspaces;
|
int m_numberOfWorkspaces;
|
||||||
int m_tabBarPlacementIndex;
|
int m_tabBarPlacementIndex;
|
||||||
bool m_allowTabBarMovement;
|
bool m_allowTabBarMovement;
|
||||||
|
bool m_restoreSelectedOnStartup;
|
||||||
static const int MAX_WORKSPACES;
|
static const int MAX_WORKSPACES;
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@ -47,62 +47,20 @@
|
|||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Details</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Icon:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="iconPathChooser" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="nameEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Name:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Workspace panel</string>
|
<string>General</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Placement:</string>
|
<string>Placement:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Allow reordering:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBoxTabBarPlacement">
|
<widget class="QComboBox" name="comboBoxTabBarPlacement">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -125,14 +83,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="3">
|
||||||
<widget class="QCheckBox" name="checkBoxAllowTabMovement">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -145,6 +96,37 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Allow reordering:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBoxAllowTabMovement">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Restore last selected workspace on startup</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Remember last used workspace on restart</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBoxRestoreSelectedOnStartup">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -216,6 +198,41 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="4">
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Details</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Icon:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="Utils::PathChooser" name="iconPathChooser" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="nameEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user