@ -10,6 +10,7 @@
# include "MAVLinkProtocol.h"
# include "MAVLinkProtocol.h"
# include "MAVLinkSettingsWidget.h"
# include "MAVLinkSettingsWidget.h"
# include "GAudioOutput.h"
# include "GAudioOutput.h"
# include "QGCCore.h"
QGCSettingsWidget : : QGCSettingsWidget ( JoystickInput * joystick , QWidget * parent , Qt : : WindowFlags flags ) :
QGCSettingsWidget : : QGCSettingsWidget ( JoystickInput * joystick , QWidget * parent , Qt : : WindowFlags flags ) :
QDialog ( parent , flags ) ,
QDialog ( parent , flags ) ,
@ -55,6 +56,8 @@ QGCSettingsWidget::QGCSettingsWidget(JoystickInput *joystick, QWidget *parent, Q
ui - > titleBarCheckBox - > setChecked ( mainWindow - > dockWidgetTitleBarsEnabled ( ) ) ;
ui - > titleBarCheckBox - > setChecked ( mainWindow - > dockWidgetTitleBarsEnabled ( ) ) ;
connect ( ui - > titleBarCheckBox , SIGNAL ( clicked ( bool ) ) , mainWindow , SLOT ( enableDockWidgetTitleBars ( bool ) ) ) ;
connect ( ui - > titleBarCheckBox , SIGNAL ( clicked ( bool ) ) , mainWindow , SLOT ( enableDockWidgetTitleBars ( bool ) ) ) ;
connect ( ui - > deleteSettings , & QAbstractButton : : toggled , this , & QGCSettingsWidget : : _deleteSettingsToggled ) ;
// Custom mode
// Custom mode
ui - > customModeComboBox - > addItem ( tr ( " Default: Generic MAVLink and serial links " ) , MainWindow : : CUSTOM_MODE_NONE ) ;
ui - > customModeComboBox - > addItem ( tr ( " Default: Generic MAVLink and serial links " ) , MainWindow : : CUSTOM_MODE_NONE ) ;
@ -197,3 +200,20 @@ void QGCSettingsWidget::selectCustomMode(int mode)
MainWindow : : instance ( ) - > setCustomMode ( static_cast < enum MainWindow : : CUSTOM_MODE > ( ui - > customModeComboBox - > itemData ( mode ) . toInt ( ) ) ) ;
MainWindow : : instance ( ) - > setCustomMode ( static_cast < enum MainWindow : : CUSTOM_MODE > ( ui - > customModeComboBox - > itemData ( mode ) . toInt ( ) ) ) ;
MainWindow : : instance ( ) - > showInfoMessage ( tr ( " Please restart QGroundControl " ) , tr ( " The optimization selection was changed. The application needs to be closed and restarted to put all optimizations into effect. " ) ) ;
MainWindow : : instance ( ) - > showInfoMessage ( tr ( " Please restart QGroundControl " ) , tr ( " The optimization selection was changed. The application needs to be closed and restarted to put all optimizations into effect. " ) ) ;
}
}
void QGCSettingsWidget : : _deleteSettingsToggled ( bool checked )
{
if ( checked ) {
QMessageBox : : StandardButton answer = QMessageBox : : question ( this ,
tr ( " Delete Settings " ) ,
tr ( " All saved settgings will be deleted the next time you start QGroundControl. Is this really what you want? " ) ,
QMessageBox : : Yes | QMessageBox : : No ,
QMessageBox : : No ) ;
if ( answer = = QMessageBox : : Yes ) {
QSettings settings ;
settings . setValue ( QGCCore : : deleteAllSettingsKey , 1 ) ;
} else {
ui - > deleteSettings - > setChecked ( false ) ;
}
}
}