Merge with develop

This commit is contained in:
kervala 2016-11-03 14:46:44 +01:00
parent 5964288f14
commit d865dc5a70
5 changed files with 18 additions and 8 deletions

View file

@ -25,7 +25,7 @@
CConfigFile *CConfigFile::s_instance = NULL; CConfigFile *CConfigFile::s_instance = NULL;
CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1), CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1),
m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true) m_defaultServerIndex(0), m_defaultProfileIndex(0), m_installerCopied(false), m_use64BitsClient(false), m_shouldUninstallOldClient(true)
{ {
s_instance = this; s_instance = this;
@ -945,8 +945,8 @@ OperationStep CConfigFile::getInstallNextStep() const
} }
} }
// current installer more recent than installed one // current installer more recent than installed one and not already copied
if (compareInstallersVersion() == 1) return CopyInstaller; if (!m_installerCopied && compareInstallersVersion() == 1) return CopyInstaller;
// no default profile // no default profile
if (profile.id.isEmpty()) if (profile.id.isEmpty())
@ -992,7 +992,7 @@ OperationStep CConfigFile::getInstallNextStep() const
// current installer more recent than installed one // current installer more recent than installed one
switch (compareInstallersVersion()) switch (compareInstallersVersion())
{ {
// current installer more recent, copy it // current installer more recent, should be already copied
case 1: break; case 1: break;
// current installer older, launch the more recent installer // current installer older, launch the more recent installer

View file

@ -57,6 +57,9 @@ public:
QString getLanguage() const { return m_language; } QString getLanguage() const { return m_language; }
bool getInstallerCopied() const { return m_installerCopied; }
void setInstallerCopied(bool copied) { m_installerCopied = copied; }
int getProfilesCount() const; int getProfilesCount() const;
CProfile getProfile(int i = -1) const; CProfile getProfile(int i = -1) const;
CProfile getProfile(const QString &id) const; CProfile getProfile(const QString &id) const;
@ -145,6 +148,7 @@ private:
int m_version; int m_version;
int m_defaultServerIndex; int m_defaultServerIndex;
int m_defaultProfileIndex; int m_defaultProfileIndex;
bool m_installerCopied;
CServers m_servers; CServers m_servers;
CProfiles m_profiles; CProfiles m_profiles;

View file

@ -194,6 +194,9 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
processedSize += file.size; processedSize += file.size;
} }
// wait 1 second to be sure all files have been copied (because to disk cache)
QThread::sleep(1);
if (m_listener) if (m_listener)
{ {
m_listener->operationSuccess(totalSize); m_listener->operationSuccess(totalSize);

View file

@ -462,7 +462,7 @@ bool CFilesExtractor::extract7z()
} }
// create file // create file
QFile outFile(destPath); QSaveFile outFile(destPath);
if (!outFile.open(QFile::WriteOnly)) if (!outFile.open(QFile::WriteOnly))
{ {
@ -496,7 +496,7 @@ bool CFilesExtractor::extract7z()
break; break;
} }
outFile.close(); outFile.commit();
totalUncompressed += uncompressedSize; totalUncompressed += uncompressedSize;
@ -620,7 +620,7 @@ bool CFilesExtractor::extractZip()
return true; return true;
} }
QFile f(absPath); QSaveFile f(absPath);
if (!f.open(QIODevice::WriteOnly)) if (!f.open(QIODevice::WriteOnly))
{ {
@ -637,7 +637,7 @@ bool CFilesExtractor::extractZip()
nlwarning("Unable to change permissions of %s", Q2C(absPath)); nlwarning("Unable to change permissions of %s", Q2C(absPath));
} }
f.close(); f.commit();
// set the right modification date // set the right modification date
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t())) if (!NLMISC::CFile::setFileModificationDate(qToUtf8(absPath), fi.lastModified.toTime_t()))

View file

@ -791,6 +791,9 @@ void COperationDialog::copyInstaller()
#endif #endif
createShortcut(shortcut, name, executable, "", icon, ""); createShortcut(shortcut, name, executable, "", icon, "");
// installer already copied, don't need to copy it again
config->setInstallerCopied(true);
} }
emit done(); emit done();