Saves/restores the current state of mainwindow's toolbars and dockwidgets.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-04-22 17:22:47 +03:00
parent 7834647208
commit 4e92968f36
8 changed files with 31 additions and 5 deletions

View File

@ -57,6 +57,7 @@ const QString VSettings::SettingGeneralRecentFileList = QStringLitera
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
@ -337,6 +338,18 @@ void VSettings::SetWindowState(const QByteArray &value)
setValue(SettingGeneralWindowState, value);
}
//---------------------------------------------------------------------------------------------------------------------
QByteArray VSettings::GetToolbarsState() const
{
return value(SettingGeneralToolbarsState).toByteArray();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetToolbarsState(const QByteArray &value)
{
setValue(SettingGeneralToolbarsState, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetServer() const
{

View File

@ -100,6 +100,9 @@ public:
QByteArray GetWindowState() const;
void SetWindowState(const QByteArray &value);
QByteArray GetToolbarsState() const;
void SetToolbarsState(const QByteArray &value);
QString GetServer() const;
void SetServer(const QString &value);
@ -155,6 +158,7 @@ private:
static const QString SettingGeneralRestoreFileList;
static const QString SettingGeneralGeometry;
static const QString SettingGeneralWindowState;
static const QString SettingGeneralToolbarsState;
static const QString SettingCommunityServer;
static const QString SettingCommunityServerSecure;

View File

@ -44,7 +44,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION_STR));
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
ui->label_QT_Version->setText(buildCompatibilityString());

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
app.setOrganizationName(VER_COMPANYNAME_STR);
app.setOrganizationDomain(VER_COMPANYDOMAIN_STR);
// Setting the Application version
app.setApplicationVersion(APP_VERSION);
app.setApplicationVersion(APP_VERSION_STR);
app.OpenSettings();
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
// Run creation log after sending crash report
app.StartLogging();
qDebug()<<"Version:"<<APP_VERSION;
qDebug()<<"Version:"<<APP_VERSION_STR;
qDebug()<<"Build revision:"<<BUILD_REVISION;
qDebug()<<buildCompatibilityString();
qDebug()<<"Built on"<<__DATE__<<"at"<<__TIME__;

View File

@ -2104,6 +2104,7 @@ void MainWindow::ReadSettings()
qCDebug(vMainWindow, "Reading settings.");
restoreGeometry(qApp->getSettings()->GetGeometry());
restoreState(qApp->getSettings()->GetWindowState());
restoreState(qApp->getSettings()->GetToolbarsState(), APP_VERSION);
// Scene antialiasing
const bool graphOutputValue = qApp->getSettings()->GetGraphicalOutput();
@ -2125,6 +2126,7 @@ void MainWindow::WriteSettings()
{
qApp->getSettings()->SetGeometry(saveGeometry());
qApp->getSettings()->SetWindowState(saveState());
qApp->getSettings()->SetToolbarsState(saveState(APP_VERSION));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -246,8 +246,10 @@ private:
void AutoSavePattern();
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
void ReadSettings();
void WriteSettings();
bool MaybeSave();
void UpdateRecentFileActions();
void CreateMenus();

View File

@ -35,7 +35,7 @@ extern const int MAJOR_VERSION = 0;
extern const int MINOR_VERSION = 3;
extern const int DEBUG_VERSION = 0;
extern const QString APP_VERSION(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
.arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));
//---------------------------------------------------------------------------------------------------------------------

View File

@ -35,7 +35,12 @@ extern const int MAJOR_VERSION;
extern const int MINOR_VERSION;
extern const int DEBUG_VERSION;
extern const QString APP_VERSION;
extern const QString APP_VERSION_STR;
/*
APP_VERSION is (major << 16) + (minor << 8) + patch.
*/
#define APP_VERSION 0x000300
// Change version number in version.cpp too.