Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void Settings::load()

QString key = QString::fromLatin1(KEY) + QLatin1String("/General/");

appVersion = settings->value(key + QLatin1String("AppVersion"), APP_VERSION_UNKN).toString().toUInt(0, 16);

// Angle mode special case.
QString angleUnitStr;
angleUnitStr = settings->value(key + QLatin1String("AngleMode"), "r").toString();
Expand Down Expand Up @@ -224,6 +226,8 @@ void Settings::save()
int k, i;
QString key = KEY + QLatin1String("/General/");

settings->setValue(key + QLatin1String("AppVersion"), QString().sprintf("0x%06X", APP_VERSION));

settings->setValue(key + QLatin1String("HistorySave"), historySave);
settings->setValue(key + QLatin1String("LeaveLastExpression"), leaveLastExpression);
settings->setValue(key + QLatin1String("VariableSave"), variableSave);
Expand Down
9 changes: 9 additions & 0 deletions src/core/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,22 @@
#include <QtCore/QStringList>
#include <QtCore/QList>

// current application version (0xMMNNPP format same as QT_VERSION)
#define APP_VERSION 0x001200
// milestones for compatibility checks
#define APP_VERSION_001200 0x001200
// unknown format (always <APP_VERSION)
#define APP_VERSION_UNKN 0x000000

class Settings {
public:
static Settings* instance();

void load();
void save();

unsigned appVersion; // 0xMMNNPP format

char radixCharacter() const; // 0: Automatic.
void setRadixCharacter(char c = 0);
bool isRadixCharacterAuto() const;
Expand Down
11 changes: 11 additions & 0 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ QTranslator* MainWindow::createTranslator(const QString& langCode)

void MainWindow::createUi()
{
// set docking behavior
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
setDockNestingEnabled(true);

createActions();
createActionGroups();
createActionShortcuts();
Expand Down Expand Up @@ -1002,6 +1009,10 @@ void MainWindow::applySettings()
} else
move(m_settings->windowPosition);

// docking layout has changed in 0.12 - reset window state
if (m_settings->appVersion < APP_VERSION_001200)
m_settings->windowState.clear();

restoreState(m_settings->windowState);

m_actions.viewFullScreenMode->setChecked(m_settings->windowOnfullScreen);
Expand Down