Commit ec4f3ffc authored by Don Gagne's avatar Don Gagne

Merge pull request #1052 from Susurrus/views

Refactoring on MainWindow's view and settings code
parents 5ad977ae fbe6d108
......@@ -88,7 +88,6 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
{
// Load settings
QSettings settings;
settings.sync();
muted = settings.value(QGC_GAUDIOOUTPUT_KEY + "muted", muted).toBool();
......@@ -157,7 +156,6 @@ void GAudioOutput::mute(bool mute)
this->muted = mute;
QSettings settings;
settings.setValue(QGC_GAUDIOOUTPUT_KEY + "muted", this->muted);
settings.sync();
emit mutedChanged(muted);
}
}
......
......@@ -132,7 +132,6 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
// User requested settings to be cleared on command line
settings.clear();
settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION);
settings.sync();
}
}
......
......@@ -90,7 +90,6 @@ void MAVLinkProtocol::loadSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
settings.beginGroup("QGC_MAVLINK_PROTOCOL");
enableHeartbeats(settings.value("HEARTBEATS_ENABLED", m_heartbeatsEnabled).toBool());
enableVersionCheck(settings.value("VERSION_CHECK_ENABLED", m_enable_version_check).toBool());
......@@ -133,8 +132,6 @@ void MAVLinkProtocol::storeSettings()
settings.setValue("PARAMETER_REWRITE_TIMEOUT", m_paramRewriteTimeout);
settings.setValue("PARAMETER_TRANSMISSION_GUARD_ENABLED", m_paramGuardEnabled);
settings.endGroup();
settings.sync();
//qDebug() << "Storing settings!";
}
MAVLinkProtocol::~MAVLinkProtocol()
......
......@@ -92,7 +92,6 @@ void QGCXPlaneLink::loadSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
settings.beginGroup("QGC_XPLANE_LINK");
setRemoteHost(settings.value("REMOTE_HOST", QString("%1:%2").arg(remoteHost.toString()).arg(remotePort)).toString());
setVersion(settings.value("XPLANE_VERSION", 10).toInt());
......@@ -111,7 +110,6 @@ void QGCXPlaneLink::storeSettings()
settings.setValue("AIRFRAME", airframeName);
settings.setValue("SENSOR_HIL", _sensorHilEnabled);
settings.endGroup();
settings.sync();
}
void QGCXPlaneLink::setVersion(const QString& version)
......
......@@ -136,7 +136,6 @@ void SerialLink::loadSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT"))
{
m_portName = settings.value("SERIALLINK_COMM_PORT").toString();
......@@ -160,7 +159,6 @@ void SerialLink::writeSettings()
settings.setValue("SERIALLINK_COMM_STOPBITS", getStopBits());
settings.setValue("SERIALLINK_COMM_DATABITS", getDataBits());
settings.setValue("SERIALLINK_COMM_FLOW_CONTROL", getFlowType());
settings.sync();
}
void SerialLink::checkIfCDC()
......
......@@ -69,7 +69,6 @@ void JoystickInput::loadGeneralSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
// Deal with settings specific to the JoystickInput
settings.beginGroup("JOYSTICK_INPUT");
......@@ -86,7 +85,6 @@ void JoystickInput::loadJoystickSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
// Now for the current joystick
settings.beginGroup(joystickName);
......@@ -162,7 +160,6 @@ void JoystickInput::storeGeneralSettings() const
settings.setValue("ENABLED", isEnabled);
settings.setValue("JOYSTICK_NAME", joystickName);
settings.endGroup();
settings.sync();
}
void JoystickInput::storeJoystickSettings() const
......@@ -254,7 +251,6 @@ void JoystickInput::storeJoystickSettings() const
}
settings.endArray(); // AUTOPILOTS
settings.endGroup();
settings.sync();
}
void JoystickInput::setActiveUAS(UASInterface* uas)
......
......@@ -271,7 +271,6 @@ void UAS::writeSettings()
settings.setValue("AP_TYPE", this->autopilot);
settings.setValue("BATTERY_SPECS", getBatterySpecs());
settings.endGroup();
settings.sync();
}
/**
......
......@@ -63,13 +63,11 @@ void UASManager::storeSettings()
settings.setValue("HOMELON", homeLon);
settings.setValue("HOMEALT", homeAlt);
settings.endGroup();
settings.sync();
}
void UASManager::loadSettings()
{
QSettings settings;
settings.sync();
settings.beginGroup("QGC_UASMANAGER");
bool changed = setHomePosition(settings.value("HOMELAT", homeLat).toDouble(),
settings.value("HOMELON", homeLon).toDouble(),
......
......@@ -138,7 +138,6 @@ void DebugConsole::loadSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
settings.beginGroup("QGC_DEBUG_CONSOLE");
m_ui->specialComboBox->setCurrentIndex(settings.value("SPECIAL_SYMBOL", m_ui->specialComboBox->currentIndex()).toInt());
m_ui->specialCheckBox->setChecked(settings.value("SPECIAL_SYMBOL_CHECKBOX_STATE", m_ui->specialCheckBox->isChecked()).toBool());
......@@ -159,7 +158,6 @@ void DebugConsole::storeSettings()
settings.setValue("MAVLINK_FILTER_ENABLED", filterMAVLINK);
settings.setValue("AUTO_HOLD_ENABLED", autoHold);
settings.endGroup();
settings.sync();
}
void DebugConsole::uasCreated(UASInterface* uas)
......
......@@ -233,13 +233,11 @@ void HDDisplay::saveState()
// qDebug() << "Saving" << instruments;
settings.setValue(windowTitle()+"_gauges", instruments);
settings.sync();
}
void HDDisplay::restoreState()
{
QSettings settings;
settings.sync();
acceptList->clear();
......
......@@ -170,7 +170,6 @@ void MAVLinkSettingsWidget::enableDroneOS(bool enable)
protocol->setAuthKey(m_ui->droneOSLineEdit->text().trimmed());
QSettings settings;
settings.setValue("DRONEOS_HOST", m_ui->droneOSComboBox->currentText());
settings.sync();
}
protocol->enableAuth(enable);
}
......
This diff is collapsed.
......@@ -195,7 +195,6 @@ public slots:
void handleMisconfiguration(UASInterface* uas);
/** @brief Load configuration views */
void loadSetupView();
void loadSoftwareConfigView();
/** @brief Load view for pilot */
void loadPilotView();
/** @brief Load view for simulation */
......@@ -301,17 +300,16 @@ protected:
typedef enum _VIEW_SECTIONS
{
VIEW_ENGINEER,
VIEW_MISSION,
VIEW_FLIGHT,
VIEW_SIMULATION,
VIEW_FIRMWAREUPDATE,
VIEW_SETUP,
VIEW_SOFTWARE_CONFIG,
VIEW_TERMINAL,
VIEW_LOCAL3D,
VIEW_GOOGLEEARTH,
VIEW_DEFAULT
VIEW_ENGINEER, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
VIEW_MISSION, // Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands.
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_SIMULATION, // HIL Simulation view. Useful overview of the entire system when doing hardware-in-the-loop simulations.
UNUSED1, // Unused spacer for backwards compatibility with older settings files.
VIEW_SETUP, // Setup view. Used for initializing the system for operation. Includes UI for calibration, firmware updating/checking, and parameter modifcation.
UNUSED2, // Unused spacer for backwards compatibility with older settings files.
VIEW_TERMINAL, // Terminal interface. Used for communicating with the remote system, usually in a special configuration input mode.
VIEW_LOCAL3D, // A local 3D view. Provides a local 3D view that makes visualizing 3D attitude/orientation/pose easy while in operation.
VIEW_GOOGLEEARTH // 3D Google Earth view. A 3D terrain view, though the vehicle is still 2D.
} VIEW_SECTIONS;
/**
......@@ -348,8 +346,6 @@ protected:
/** @brief Keeps track of the current view */
VIEW_SECTIONS currentView;
QGC_MAINWINDOW_STYLE currentStyle;
bool aboutToCloseFlag;
bool changingViewsFlag;
void storeViewState();
void loadViewState();
......
......@@ -58,7 +58,6 @@
<property name="title">
<string>File</string>
</property>
<addaction name="actionJoystick_Settings"/>
<addaction name="actionSimulate"/>
<addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/>
......@@ -87,22 +86,21 @@
<string>Help</string>
</property>
<addaction name="actionOnline_Documentation"/>
<addaction name="actionProject_Roadmap_2"/>
<addaction name="actionProject_Roadmap"/>
<addaction name="actionDeveloper_Credits"/>
</widget>
<widget class="QMenu" name="menuPerspectives">
<property name="title">
<string>Perspectives</string>
</property>
<addaction name="actionSetup"/>
<addaction name="actionMissionView"/>
<addaction name="actionFlightView"/>
<addaction name="actionSetup"/>
<addaction name="actionEngineersView"/>
<addaction name="actionGoogleEarthView"/>
<addaction name="actionLocal3DView"/>
<addaction name="actionTerminalView"/>
<addaction name="actionSimulationView"/>
<addaction name="actionFirmwareUpdateView"/>
<addaction name="separator"/>
<addaction name="actionFullscreen"/>
<addaction name="actionNormal"/>
......@@ -181,18 +179,6 @@
<string>Add Link</string>
</property>
</action>
<action name="actionJoystickSettings">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/devices/input-gaming.svg</normaloff>:/files/images/devices/input-gaming.svg</iconset>
</property>
<property name="text">
<string>Joystick Configuration</string>
</property>
<property name="visible">
<bool>true</bool>
</property>
</action>
<action name="actionSimulate">
<property name="checkable">
<bool>true</bool>
......@@ -208,27 +194,6 @@
<string>Simulate one vehicle to test and evaluate this application</string>
</property>
</action>
<action name="actionShow_Slugs_View">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/contrib/slugs.png</normaloff>:/files/images/contrib/slugs.png</iconset>
</property>
<property name="text">
<string>Show Slugs View</string>
</property>
</action>
<action name="actionJoystick_Settings">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/devices/input-gaming.svg</normaloff>:/files/images/devices/input-gaming.svg</iconset>
</property>
<property name="text">
<string>Joystick Settings</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="actionOnline_Documentation">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
......@@ -238,7 +203,7 @@
<string>Online Documentation</string>
</property>
</action>
<action name="actionProject_Roadmap_2">
<action name="actionProject_Roadmap">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/status/software-update-available.svg</normaloff>:/files/images/status/software-update-available.svg</iconset>
......@@ -280,18 +245,6 @@
<string>Analyze</string>
</property>
</action>
<action name="actionMavlinkView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/devices/network-wired.svg</normaloff>:/files/images/devices/network-wired.svg</iconset>
</property>
<property name="text">
<string>Mavlink</string>
</property>
</action>
<action name="actionFlightView">
<property name="checkable">
<bool>true</bool>
......@@ -329,18 +282,6 @@
<string>Mute Audio Output</string>
</property>
</action>
<action name="actionUnconnectedView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/devices/network-wireless.svg</normaloff>:/files/images/devices/network-wireless.svg</iconset>
</property>
<property name="text">
<string>Unconnected</string>
</property>
</action>
<action name="actionShutdownMAV">
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
......@@ -401,24 +342,6 @@
<string>Load Custom Widget File</string>
</property>
</action>
<action name="actionFirmwareUpdateView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/status/software-update-available.svg</normaloff>:/files/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
<string>Firmware Update</string>
</property>
<property name="toolTip">
<string>Update the firmware of one of the connected autopilots</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action name="actionSetup">
<property name="checkable">
<bool>true</bool>
......@@ -454,19 +377,7 @@
<normaloff>:/files/images/apps/accessories-calculator.svg</normaloff>:/files/images/apps/accessories-calculator.svg</iconset>
</property>
<property name="text">
<string>Simulation</string>
</property>
</action>
<action name="actionSoftwareConfig">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/files/images/categories/applications-system.svg</normaloff>:/files/images/categories/applications-system.svg</iconset>
</property>
<property name="text">
<string>Software</string>
<string>HIL Simulation</string>
</property>
</action>
<action name="actionTerminalView">
......
......@@ -42,7 +42,6 @@ QGCHilConfiguration::~QGCHilConfiguration()
settings.beginGroup("QGC_HILCONFIG");
settings.setValue("SIMULATOR_INDEX", ui->simComboBox->currentIndex());
settings.endGroup();
settings.sync();
delete ui;
}
......
......@@ -40,7 +40,6 @@ void QGCRGBDView::storeSettings()
settings.setValue("STREAM_RGB_ON", rgbEnabled);
settings.setValue("STREAM_DEPTH_ON", depthEnabled);
settings.endGroup();
settings.sync();
}
void QGCRGBDView::loadSettings()
......
......@@ -70,7 +70,6 @@ void QGCStatusBar::storeSettings()
settings.beginGroup("QGC_MAVLINKLOGPLAYER");
settings.setValue("LAST_LOG_DIRECTORY", lastLogDirectory);
settings.endGroup();
settings.sync();
}
QGCStatusBar::~QGCStatusBar()
......
......@@ -312,12 +312,12 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
// Add last button
advancedButton = new QToolButton(this);
advancedButton->setIcon(QIcon(":/files/images/apps/utilities-system-monitor.svg"));
advancedButton->setText(tr("Pro"));
advancedButton->setText(tr("More"));
advancedButton->setToolTip(tr("Options for advanced users"));
advancedButton->setCheckable(true);
advancedButton->setObjectName("advancedButton");
advancedButton->setPopupMode(QToolButton::InstantPopup);
advancedButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
advancedButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
addWidget(advancedButton);
group->addButton(advancedButton);
} else {
......@@ -809,7 +809,6 @@ void QGCToolBar::storeSettings()
QSettings settings;
settings.beginGroup("QGC_TOOLBAR");
settings.endGroup();
settings.sync();
}
void QGCToolBar::clearStatusString()
......
......@@ -267,7 +267,6 @@ void TerminalConsole::loadSettings()
{
// Load defaults from settings
QSettings settings;
settings.sync();
if (settings.contains("TERMINALCONSOLE_COMM_PORT"))
{
m_settings.name = settings.value("TERMINALCONSOLE_COMM_PORT").toString();
......@@ -295,7 +294,6 @@ void TerminalConsole::writeSettings()
settings.setValue("TERMINALCONSOLE_COMM_STOPBITS", m_settings.stopBits);
settings.setValue("TERMINALCONSOLE_COMM_DATABITS", m_settings.dataBits);
settings.setValue("TERMINALCONSOLE_COMM_FLOW_CONTROL", m_settings.flowControl);
settings.sync();
}
......
......@@ -185,13 +185,11 @@ void LinechartWidget::writeSettings()
if (ui.showUnitsCheckBox) settings.setValue("SHOW_UNITS", ui.showUnitsCheckBox->isChecked());
if (ui.shortNameCheckBox) settings.setValue("SHORT_NAMES", ui.shortNameCheckBox->isChecked());
settings.endGroup();
settings.sync();
}
void LinechartWidget::readSettings()
{
QSettings settings;
settings.sync();
settings.beginGroup("LINECHART");
if (activePlot) {
timeButton->setChecked(settings.value("ENFORCE_GROUNDTIME", timeButton->isChecked()).toBool());
......
......@@ -306,7 +306,6 @@ void QGCMapWidget::storeSettings()
settings.setValue("TRAIL_TYPE", static_cast<int>(trailType));
settings.setValue("TRAIL_INTERVAL", trailInterval);
settings.endGroup();
settings.sync();
}
void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event)
......
......@@ -104,7 +104,6 @@ void UASQuickView::saveSettings()
}
settings.endArray();
settings.setValue("UAS_QUICK_VIEW_COLUMNS",m_columnCount);
settings.sync();
}
void UASQuickView::loadSettings()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment