mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
do not show welcome page repeatedly
This commit is contained in:
parent
1cd809ed8f
commit
56715bc9a5
@ -10,6 +10,7 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
#include "utils/vutils.h"
|
#include "utils/vutils.h"
|
||||||
#include "vstyleparser.h"
|
#include "vstyleparser.h"
|
||||||
@ -1750,3 +1751,16 @@ void VConfigManager::updateLastUserTrackDate()
|
|||||||
"last_user_track_date",
|
"last_user_track_date",
|
||||||
date.toString(Qt::ISODate));
|
date.toString(Qt::ISODate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDateTime VConfigManager::getLastStartDateTime() const
|
||||||
|
{
|
||||||
|
auto dateStr = getConfigFromSessionSettings("global",
|
||||||
|
"last_start_time").toString();
|
||||||
|
return QDateTime::fromString(dateStr, Qt::ISODate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VConfigManager::updateLastStartDateTime()
|
||||||
|
{
|
||||||
|
auto dateTime = QDateTime::currentDateTime();
|
||||||
|
setConfigToSessionSettings("global", "last_start_time", dateTime.toString(Qt::ISODate));
|
||||||
|
}
|
||||||
|
@ -640,6 +640,9 @@ public:
|
|||||||
QDate getLastUserTrackDate() const;
|
QDate getLastUserTrackDate() const;
|
||||||
void updateLastUserTrackDate();
|
void updateLastUserTrackDate();
|
||||||
|
|
||||||
|
QDateTime getLastStartDateTime() const;
|
||||||
|
void updateLastStartDateTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initEditorConfigs();
|
void initEditorConfigs();
|
||||||
|
|
||||||
|
@ -3456,12 +3456,7 @@ void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
|||||||
openStartupPages();
|
openStartupPages();
|
||||||
openFiles(p_files, false, g_config->getNoteOpenMode(), false, true);
|
openFiles(p_files, false, g_config->getNoteOpenMode(), false, true);
|
||||||
|
|
||||||
if (g_config->versionChanged()
|
checkIfNeedToShowWelcomePage();
|
||||||
|| (QDate::currentDate().dayOfYear() % 64 == 1)) {
|
|
||||||
QString docFile = VUtils::getDocFile("welcome.md");
|
|
||||||
VFile *file = vnote->getFile(docFile, true);
|
|
||||||
m_editArea->openFile(file, OpenFileMode::Read);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_config->versionChanged() && !g_config->getAllowUserTrack()) {
|
if (g_config->versionChanged() && !g_config->getAllowUserTrack()) {
|
||||||
// Ask user whether allow tracking.
|
// Ask user whether allow tracking.
|
||||||
@ -3481,6 +3476,8 @@ void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_syncNoteListToCurrentTab = true;
|
m_syncNoteListToCurrentTab = true;
|
||||||
|
|
||||||
|
g_config->updateLastStartDateTime();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3617,3 +3614,14 @@ void VMainWindow::promptForVNoteRestart()
|
|||||||
restartVNote();
|
restartVNote();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VMainWindow::checkIfNeedToShowWelcomePage()
|
||||||
|
{
|
||||||
|
if (g_config->versionChanged()
|
||||||
|
|| (QDate::currentDate().dayOfYear() % 64 == 1
|
||||||
|
&& g_config->getLastStartDateTime().date() != QDate::currentDate())) {
|
||||||
|
QString docFile = VUtils::getDocFile("welcome.md");
|
||||||
|
VFile *file = vnote->getFile(docFile, true);
|
||||||
|
m_editArea->openFile(file, OpenFileMode::Read);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -333,6 +333,8 @@ private:
|
|||||||
|
|
||||||
void promptForVNoteRestart();
|
void promptForVNoteRestart();
|
||||||
|
|
||||||
|
void checkIfNeedToShowWelcomePage();
|
||||||
|
|
||||||
// Captain mode functions.
|
// Captain mode functions.
|
||||||
|
|
||||||
// Popup the attachment list if it is enabled.
|
// Popup the attachment list if it is enabled.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user