mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-01-21 14:42:04 +01:00
Add new prefs to the storage
This commit is contained in:
@@ -48,11 +48,11 @@ Preferences::Preferences( QObject *parent ) : QObject( parent )
|
||||
m_minimize_type = PREF_MINIMIZE_METHOD_1;
|
||||
m_close_type = PREF_MINIMIZE_MAIN_TRAY_CLOSE_CHILDREN_WINDOWS;
|
||||
m_minimize_icon_type = PREF_MINIMIZE_TRAY_ICON;
|
||||
m_startup_type = PREF_START_DEFAULT;
|
||||
|
||||
m_window_positions_correction = false;
|
||||
m_window_positions_correction_type = PREF_NO_CORRECTION;
|
||||
|
||||
m_startup_type = PREF_START_DEFAULT;
|
||||
m_restore_window_positions = false;
|
||||
|
||||
m_default_icon_type = PREF_DEFAULT_ICON_DEFAULT;
|
||||
@@ -423,6 +423,32 @@ void Preferences::setMinimizeIconType( MinimizeIconType minimize_icon_type )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the start minmized pref.
|
||||
*/
|
||||
Preferences::StartupType Preferences::getStartupType() const
|
||||
{
|
||||
return m_startup_type;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the startup type pref.
|
||||
*/
|
||||
void Preferences::setStartupType( Preferences::StartupType startup_type )
|
||||
{
|
||||
if( m_startup_type != startup_type )
|
||||
{
|
||||
m_startup_type = startup_type;
|
||||
|
||||
/*
|
||||
* Tell the world the new preference
|
||||
*/
|
||||
emit signalStartupTypeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the window positions correction state
|
||||
*/
|
||||
@@ -475,32 +501,6 @@ void Preferences::setWindowPositionsCorrectionType( WindowPositionsCorrection
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the start minmized pref.
|
||||
*/
|
||||
Preferences::StartupType Preferences::getStartupType() const
|
||||
{
|
||||
return m_startup_type;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the startup type pref.
|
||||
*/
|
||||
void Preferences::setStartupType( Preferences::StartupType startup_type )
|
||||
{
|
||||
if( m_startup_type != startup_type )
|
||||
{
|
||||
m_startup_type = startup_type;
|
||||
|
||||
/*
|
||||
* Tell the world the new preference
|
||||
*/
|
||||
emit signalStartupTypeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the start minmized pref.
|
||||
*/
|
||||
|
||||
@@ -197,34 +197,6 @@ class Preferences : public QObject
|
||||
*/
|
||||
void setBrowserBuildID( const QString buildID );
|
||||
|
||||
/**
|
||||
* @brief getStartupType. Get the startup type.
|
||||
*
|
||||
* @return The startup type.
|
||||
*/
|
||||
StartupType getStartupType() const;
|
||||
|
||||
/**
|
||||
* @brief setStartupType. Set the startup type.
|
||||
*
|
||||
* @param startup_type The startup type.
|
||||
*/
|
||||
void setStartupType( StartupType startup_type );
|
||||
|
||||
/**
|
||||
* @brief getRestoreWindowPositions. Get the restore window positions state.
|
||||
*
|
||||
* @return The state.
|
||||
*/
|
||||
bool getRestoreWindowPositions() const;
|
||||
|
||||
/**
|
||||
* @brief setRestoreWindowPositions. Set the restore window positions state.
|
||||
*
|
||||
* @param state The state.
|
||||
*/
|
||||
void setRestoreWindowPositions( bool state );
|
||||
|
||||
/**
|
||||
* @brief getMinimizeType. Get the minimize type.
|
||||
*
|
||||
@@ -267,6 +239,20 @@ class Preferences : public QObject
|
||||
*/
|
||||
void setMinimizeIconType( MinimizeIconType minimize_icon_type );
|
||||
|
||||
/**
|
||||
* @brief getStartupType. Get the startup type.
|
||||
*
|
||||
* @return The startup type.
|
||||
*/
|
||||
StartupType getStartupType() const;
|
||||
|
||||
/**
|
||||
* @brief setStartupType. Set the startup type.
|
||||
*
|
||||
* @param startup_type The startup type.
|
||||
*/
|
||||
void setStartupType( StartupType startup_type );
|
||||
|
||||
/**
|
||||
* @brief getWindowPositionsCorrection. Get the window positions correction state.
|
||||
*
|
||||
@@ -281,6 +267,20 @@ class Preferences : public QObject
|
||||
*/
|
||||
void setWindowPositionsCorrection( bool state );
|
||||
|
||||
/**
|
||||
* @brief getRestoreWindowPositions. Get the restore window positions state.
|
||||
*
|
||||
* @return The state.
|
||||
*/
|
||||
bool getRestoreWindowPositions() const;
|
||||
|
||||
/**
|
||||
* @brief setRestoreWindowPositions. Set the restore window positions state.
|
||||
*
|
||||
* @param state The state.
|
||||
*/
|
||||
void setRestoreWindowPositions( bool state );
|
||||
|
||||
/**
|
||||
* @brief getWindowPositionsCorrectionType. Get the window positions correction type
|
||||
*
|
||||
@@ -721,6 +721,11 @@ class Preferences : public QObject
|
||||
*/
|
||||
void signalMinimizeIconTypeChange();
|
||||
|
||||
/**
|
||||
* @brief signalStartupTypeChange. Signal a startup type change.
|
||||
*/
|
||||
void signalStartupTypeChange();
|
||||
|
||||
/**
|
||||
* @brief signalWindowPositionsCorrectionChange. Signal a window positions correction change.
|
||||
*/
|
||||
@@ -731,11 +736,6 @@ class Preferences : public QObject
|
||||
*/
|
||||
void signalWindowPositionsCorrectionTypeChange();
|
||||
|
||||
/**
|
||||
* @brief signalStartupTypeChange. Signal a startup type change.
|
||||
*/
|
||||
void signalStartupTypeChange();
|
||||
|
||||
/**
|
||||
* @brief signalRestoreWindowPositionsChange. Signal a restore window positions state change.
|
||||
*/
|
||||
|
||||
@@ -307,6 +307,15 @@ void PreferencesDialog::setMinimizeIconType( Preferences::MinimizeIconType mi
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the startup type
|
||||
*/
|
||||
void PreferencesDialog::setStartupType( Preferences::StartupType startup_type )
|
||||
{
|
||||
( m_ui->startupTypeGroup->button( startup_type ) )->setChecked( true );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the positions correction state
|
||||
*/
|
||||
@@ -325,15 +334,6 @@ void PreferencesDialog::setWindowPositionsCorrectionType( Preferences::Window
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the startup type
|
||||
*/
|
||||
void PreferencesDialog::setStartupType( Preferences::StartupType startup_type )
|
||||
{
|
||||
( m_ui->startupTypeGroup->button( startup_type ) )->setChecked( true );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the restore window positions state
|
||||
*/
|
||||
@@ -657,13 +657,11 @@ void PreferencesDialog::slotAccept()
|
||||
|
||||
m_pref->setMinimizeType( static_cast< Preferences::MinimizeType >( m_ui->minimizeTypeGroup->checkedId() ) );
|
||||
m_pref->setMinimizeIconType( static_cast< Preferences::MinimizeIconType >( m_ui->minimizeIconTypeGroup->checkedId() ) );
|
||||
|
||||
m_pref->setCloseType( static_cast< Preferences::CloseType >( m_ui->closeTypeGroup->checkedId() ) );
|
||||
m_pref->setStartupType( static_cast< Preferences::StartupType >( m_ui->startupTypeGroup->checkedId() ) );
|
||||
m_pref->setWindowPositionsCorrection( m_ui->correctWinPosCheckBox->isChecked() );
|
||||
m_pref->setWindowPositionsCorrectionType( static_cast< Preferences::WindowPositionsCorrectionType >( m_ui->positionGroup->checkedId() ) );
|
||||
|
||||
m_pref->setStartupType( static_cast< Preferences::StartupType >( m_ui->startupTypeGroup->checkedId() ) );
|
||||
m_pref->setRestoreWindowPositions( m_ui->restorePositionscheckBox->isChecked() );
|
||||
m_pref->setCloseType( static_cast< Preferences::CloseType >( m_ui->closeTypeGroup->checkedId() ) );
|
||||
m_pref->setInvertIcon( m_ui->invertIconCheckBox->isChecked() );
|
||||
|
||||
m_pref->setShowNumber( m_ui->showNumberCheckBox->isChecked() );
|
||||
@@ -729,11 +727,11 @@ void PreferencesDialog::slotReject()
|
||||
|
||||
setMinimizeType( m_pref->getMinimizeType() );
|
||||
setMinimizeIconType( m_pref->getMinimizeIconType() );
|
||||
setCloseType( m_pref->getCloseType() );
|
||||
setStartupType( m_pref->getStartupType() );
|
||||
setWindowPositionsCorrection( m_pref->getWindowPositionsCorrection() );
|
||||
setWindowPositionsCorrectionType( m_pref->getWindowPositionsCorrectionType() );
|
||||
setStartupType( m_pref->getStartupType() );
|
||||
setRestoreWindowPositions( m_pref->getRestoreWindowPositions() );
|
||||
setCloseType( m_pref->getCloseType() );
|
||||
setInvertIcon( m_pref->getInvertIcon() );
|
||||
|
||||
setShowNumber( m_pref->getShowNumber() );
|
||||
@@ -875,24 +873,6 @@ void PreferencesDialog::slotDebugChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the startup type change signal
|
||||
*/
|
||||
void PreferencesDialog::slotStartupTypeChange()
|
||||
{
|
||||
setStartupType( m_pref->getStartupType() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the restore window positions change signal
|
||||
*/
|
||||
void PreferencesDialog::slotRestoreWindowPositionsChange()
|
||||
{
|
||||
setRestoreWindowPositions( m_pref->getRestoreWindowPositions() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the minimize type change signal
|
||||
*/
|
||||
@@ -920,6 +900,42 @@ void PreferencesDialog::slotCloseTypeChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the startup type change signal
|
||||
*/
|
||||
void PreferencesDialog::slotStartupTypeChange()
|
||||
{
|
||||
setStartupType( m_pref->getStartupType() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the window positions correction change signal
|
||||
*/
|
||||
void PreferencesDialog::slotWindowPositionsCorrectionChange()
|
||||
{
|
||||
setWindowPositionsCorrection( m_pref->getWindowPositionsCorrection() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the window positions correction type change signal
|
||||
*/
|
||||
void PreferencesDialog::slotWindowPositionsCorrectionTypeChange()
|
||||
{
|
||||
setWindowPositionsCorrectionType( m_pref->getWindowPositionsCorrectionType() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the restore window positions change signal
|
||||
*/
|
||||
void PreferencesDialog::slotRestoreWindowPositionsChange()
|
||||
{
|
||||
setRestoreWindowPositions( m_pref->getRestoreWindowPositions() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the icon type change signal
|
||||
*/
|
||||
|
||||
@@ -83,6 +83,13 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void setMinimizeIconType( Preferences::MinimizeIconType minimize_icon_type );
|
||||
|
||||
/**
|
||||
* @brief setStartupType. Set the startup type.
|
||||
*
|
||||
* @param startup_type The startup type.
|
||||
*/
|
||||
void setStartupType( Preferences::StartupType startup_type );
|
||||
|
||||
/**
|
||||
* @brief setWindowPositionsCorrection. Set the window postions correction state.
|
||||
*
|
||||
@@ -97,13 +104,6 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void setWindowPositionsCorrectionType( Preferences::WindowPositionsCorrectionType position_correction );
|
||||
|
||||
/**
|
||||
* @brief setStartupType. Set the startup type.
|
||||
*
|
||||
* @param startup_type The startup type.
|
||||
*/
|
||||
void setStartupType( Preferences::StartupType startup_type );
|
||||
|
||||
/**
|
||||
* @brief setRestoreWindowPositions. Set the restore window positions state.
|
||||
*
|
||||
@@ -337,6 +337,16 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void slotStartupTypeChange();
|
||||
|
||||
/**
|
||||
* @brief slotWindowPositionsCorrectionChange. Slot for handling window positions correction change signals.
|
||||
*/
|
||||
void slotWindowPositionsCorrectionChange();
|
||||
|
||||
/**
|
||||
* @brief slotWindowPositionsCorrectionTypeChange. Slot for handling window positions correction type change signals.
|
||||
*/
|
||||
void slotWindowPositionsCorrectionTypeChange();
|
||||
|
||||
/**
|
||||
* @brief slotRestoreWindowPositionsChange. Slot for handling restore window positions change signals.
|
||||
*/
|
||||
|
||||
@@ -122,6 +122,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
connect( m_preferences, &Preferences::signalIconDataChange, m_pref_dialog, &PreferencesDialog::slotIconDataChange );
|
||||
connect( m_preferences, &Preferences::signalMinimizeTypeChange, m_pref_dialog, &PreferencesDialog::slotMinimizeTypeChange );
|
||||
connect( m_preferences, &Preferences::signalMinimizeIconTypeChange, m_pref_dialog, &PreferencesDialog::slotMinimizeIconTypeChange );
|
||||
connect( m_preferences, &Preferences::signalWindowPositionsCorrectionChange, m_pref_dialog, &PreferencesDialog::slotWindowPositionsCorrectionChange );
|
||||
connect( m_preferences, &Preferences::signalWindowPositionsCorrectionTypeChange, m_pref_dialog, &PreferencesDialog::slotWindowPositionsCorrectionTypeChange );
|
||||
connect( m_preferences, &Preferences::signalStartupTypeChange, m_pref_dialog, &PreferencesDialog::slotStartupTypeChange );
|
||||
connect( m_preferences, &Preferences::signalRestoreWindowPositionsChange, m_pref_dialog, &PreferencesDialog::slotRestoreWindowPositionsChange );
|
||||
connect( m_preferences, &Preferences::signalCloseTypeChange, m_pref_dialog, &PreferencesDialog::slotCloseTypeChange );
|
||||
|
||||
@@ -696,6 +696,26 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
|
||||
m_pref->setStartupType( startup_type );
|
||||
}
|
||||
|
||||
if( pref.contains( "windowPosCor" ) && pref[ "windowPosCor" ].isString() )
|
||||
{
|
||||
bool window_positions_correction = pref[ "windowPosCor" ].toString() == "true";
|
||||
|
||||
/*
|
||||
* Store the new window positions correction
|
||||
*/
|
||||
m_pref->setWindowPositionsCorrection( window_positions_correction );
|
||||
}
|
||||
|
||||
if( pref.contains( "windowPosCorType" ) && pref[ "windowPosCorType" ].isString() )
|
||||
{
|
||||
Preferences::WindowPositionsCorrectionType window_positions_correction_type = static_cast< Preferences::WindowPositionsCorrectionType >( pref[ "windowPosCorType" ].toString().toInt() );
|
||||
|
||||
/*
|
||||
* Store the window positions correction type
|
||||
*/
|
||||
m_pref->setWindowPositionsCorrectionType( window_positions_correction_type );
|
||||
}
|
||||
|
||||
if( pref.contains( "restorePositions" ) && pref[ "restorePositions" ].isString() )
|
||||
{
|
||||
bool resore_window_positions = pref[ "restorePositions" ].toString() == "true";
|
||||
@@ -994,6 +1014,8 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref )
|
||||
prefObject.insert( "minimizeType", QJsonValue::fromVariant( QString::number( pref.getMinimizeType() ) ) );
|
||||
prefObject.insert( "minimizeIconType", QJsonValue::fromVariant( QString::number( pref.getMinimizeIconType() ) ) );
|
||||
prefObject.insert( "startupType", QJsonValue::fromVariant( QString::number( pref.getStartupType() ) ) );
|
||||
prefObject.insert( "windowPosCor", QJsonValue::fromVariant( QString( pref.getWindowPositionsCorrection() ? "true" : "false" ) ) );
|
||||
prefObject.insert( "windowPosCorType", QJsonValue::fromVariant( QString::number( pref.getWindowPositionsCorrectionType() ) ) );
|
||||
prefObject.insert( "restorePositions", QJsonValue::fromVariant( QString( pref.getRestoreWindowPositions() ? "true" : "false" ) ) );
|
||||
prefObject.insert( "closeType", QJsonValue::fromVariant( QString::number( pref.getCloseType() ) ) );
|
||||
prefObject.insert( "defaultIconType", QJsonValue::fromVariant( QString::number( pref.getDefaultIconType() ) ) );
|
||||
|
||||
Reference in New Issue
Block a user