mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
ConfigManager: remove check logics of obsolete config file
This commit is contained in:
parent
155199ed49
commit
2123e3abff
@ -19,8 +19,6 @@ const QString VConfigManager::appName = QString("vnote");
|
||||
|
||||
const QString VConfigManager::c_version = QString("1.18");
|
||||
|
||||
const QString VConfigManager::c_obsoleteDirConfigFile = QString(".vnote.json");
|
||||
|
||||
const QString VConfigManager::c_dirConfigFile = QString("_vnote.json");
|
||||
|
||||
const QString VConfigManager::c_defaultConfigFilePath = QString(":/resources/vnote.ini");
|
||||
@ -486,22 +484,6 @@ void VConfigManager::setConfigToSessionSettings(const QString &p_section,
|
||||
p_value);
|
||||
}
|
||||
|
||||
QString VConfigManager::fetchDirConfigFilePath(const QString &p_path)
|
||||
{
|
||||
QDir dir(p_path);
|
||||
QString fileName = c_dirConfigFile;
|
||||
|
||||
if (dir.exists(c_obsoleteDirConfigFile)) {
|
||||
V_ASSERT(!dir.exists(c_dirConfigFile));
|
||||
if (!dir.rename(c_obsoleteDirConfigFile, c_dirConfigFile)) {
|
||||
fileName = c_obsoleteDirConfigFile;
|
||||
}
|
||||
}
|
||||
|
||||
QString filePath = QDir::cleanPath(dir.filePath(fileName));
|
||||
return filePath;
|
||||
}
|
||||
|
||||
QJsonObject VConfigManager::readDirectoryConfig(const QString &path)
|
||||
{
|
||||
QString configFile = fetchDirConfigFilePath(path);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QSettings>
|
||||
#include <QHash>
|
||||
#include <QLinkedList>
|
||||
#include <QDir>
|
||||
|
||||
#include "vnotebook.h"
|
||||
#include "hgmarkdownhighlighter.h"
|
||||
@ -564,8 +565,6 @@ private:
|
||||
|
||||
void updateMarkdownEditStyle();
|
||||
|
||||
// See if the old c_obsoleteDirConfigFile exists. If so, rename it to
|
||||
// the new one; if not, use the c_dirConfigFile.
|
||||
static QString fetchDirConfigFilePath(const QString &p_path);
|
||||
|
||||
// Read the [shortcuts] section in settings to init m_shortcuts.
|
||||
@ -936,10 +935,6 @@ private:
|
||||
// Whether user has reset the configurations.
|
||||
bool m_hasReset;
|
||||
|
||||
// The name of the config file in each directory, obsolete.
|
||||
// Use c_dirConfigFile instead.
|
||||
static const QString c_obsoleteDirConfigFile;
|
||||
|
||||
// The name of the config file in each directory.
|
||||
static const QString c_dirConfigFile;
|
||||
|
||||
@ -2433,4 +2428,9 @@ inline void VConfigManager::setExplorerCurrentIndex(int p_idx)
|
||||
m_explorerCurrentIndex = p_idx;
|
||||
setConfigToSessionSettings("global", "explorer_current_entry", m_explorerCurrentIndex);
|
||||
}
|
||||
|
||||
inline QString VConfigManager::fetchDirConfigFilePath(const QString &p_path)
|
||||
{
|
||||
return QDir(p_path).filePath(c_dirConfigFile);
|
||||
}
|
||||
#endif // VCONFIGMANAGER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user