Skip to content

Commit

Permalink
[mod]修改配置保存路径
Browse files Browse the repository at this point in the history
修改配置保存路径,使程序安装后能修改配置文件
  • Loading branch information
itisyang committed Jun 24, 2018
1 parent 6e952a6 commit 8a3f614
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 3 deletions.
2 changes: 1 addition & 1 deletion playerdemo.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ Global
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2734523B-9695-4915-9E29-A87D76F0D04D}
Qt5Version = $(DefaultQtVersion)
Qt5Version = Qt5.9.3
EndGlobalSection
EndGlobal
6 changes: 4 additions & 2 deletions playerdemo/globalhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void GlobalHelper::SetIcon(QPushButton* btn, int iconSize, QChar icon)

void GlobalHelper::SavePlaylist(QStringList& playList)
{
QString strPlayerConfigFileName = QCoreApplication::applicationDirPath() + QDir::separator() + PLAYER_CONFIG;
//QString strPlayerConfigFileName = QCoreApplication::applicationDirPath() + QDir::separator() + PLAYER_CONFIG;
QString strPlayerConfigFileName = QDir::tempPath() + QDir::separator() + PLAYER_CONFIG;
QSettings settings(strPlayerConfigFileName, QSettings::IniFormat);
settings.beginWriteArray("playlist");
for (int i = 0; i < playList.size(); ++i)
Expand All @@ -54,7 +55,8 @@ void GlobalHelper::SavePlaylist(QStringList& playList)

void GlobalHelper::GetPlaylist(QStringList& playList)
{
QString strPlayerConfigFileName = QCoreApplication::applicationDirPath() + QDir::separator() + PLAYER_CONFIG;
//QString strPlayerConfigFileName = QCoreApplication::applicationDirPath() + QDir::separator() + PLAYER_CONFIG;
QString strPlayerConfigFileName = QDir::tempPath() + QDir::separator() + PLAYER_CONFIG;
QSettings settings(strPlayerConfigFileName, QSettings::IniFormat);

int size = settings.beginReadArray("playlist");
Expand Down
Loading

0 comments on commit 8a3f614

Please sign in to comment.