mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(osx): Update deprecated QDateTime and QProcess APIs
This commit is contained in:
parent
bc2d41b42d
commit
b42b1f5e15
|
@ -872,7 +872,11 @@ QDateTime History::getDateWhereFindPhrase(const QString& friendPk, const QDateTi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameter.period == PeriodSearch::AfterDate || parameter.period == PeriodSearch::BeforeDate) {
|
if (parameter.period == PeriodSearch::AfterDate || parameter.period == PeriodSearch::BeforeDate) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||||
|
date = parameter.date.startOfDay();
|
||||||
|
#else
|
||||||
date = QDateTime(parameter.date);
|
date = QDateTime(parameter.date);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString period;
|
QString period;
|
||||||
|
|
|
@ -52,8 +52,6 @@ void osx::moveToAppFolder()
|
||||||
QString bindir = qApp->applicationDirPath();
|
QString bindir = qApp->applicationDirPath();
|
||||||
QString appdir = bindir;
|
QString appdir = bindir;
|
||||||
appdir.chop(15);
|
appdir.chop(15);
|
||||||
QString sudo = bindir + "/qtox_sudo rsync -avzhpltK " + appdir + " /Applications";
|
|
||||||
QString qtox = "open /Applications/qtox.app";
|
|
||||||
|
|
||||||
QString appdir_noqtox = appdir;
|
QString appdir_noqtox = appdir;
|
||||||
appdir_noqtox.chop(8);
|
appdir_noqtox.chop(8);
|
||||||
|
@ -66,7 +64,9 @@ void osx::moveToAppFolder()
|
||||||
|
|
||||||
QDir old_app(appdir);
|
QDir old_app(appdir);
|
||||||
|
|
||||||
sudoprocess->start(sudo); // Where the magic actually happens, safety checks ^
|
const QString sudoProgram = bindir + "/qtox_sudo";
|
||||||
|
const QStringList sudoArguments = {"rsync", "-avzhpltK", appdir, "/Applications"};
|
||||||
|
sudoprocess->start(sudoProgram, sudoArguments); // Where the magic actually happens, safety checks ^
|
||||||
sudoprocess->waitForFinished();
|
sudoprocess->waitForFinished();
|
||||||
|
|
||||||
if (old_app.removeRecursively()) // We've just deleted the running program
|
if (old_app.removeRecursively()) // We've just deleted the running program
|
||||||
|
@ -77,7 +77,9 @@ void osx::moveToAppFolder()
|
||||||
if (fork() != 0) // Forking is required otherwise it won't actually cleanly launch
|
if (fork() != 0) // Forking is required otherwise it won't actually cleanly launch
|
||||||
exit(EXIT_UPDATE_MACX);
|
exit(EXIT_UPDATE_MACX);
|
||||||
|
|
||||||
qtoxprocess->start(qtox);
|
const QString qtoxProgram = "open";
|
||||||
|
const QStringList qtoxArguments = {"/Applications/qtox.app"};
|
||||||
|
qtoxprocess->start(qtoxProgram, qtoxArguments);
|
||||||
|
|
||||||
exit(0); // Actually kills it
|
exit(0); // Actually kills it
|
||||||
}
|
}
|
||||||
|
@ -107,7 +109,7 @@ void osx::migrateProfiles()
|
||||||
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already "
|
qDebug() << "OS X: Profile migration failed. ~/Library/Application Support/Tox already "
|
||||||
"exists. Using alternate migration method.";
|
"exists. Using alternate migration method.";
|
||||||
QString OSXMigrater = "../Resources/OSX-Migrater.sh";
|
QString OSXMigrater = "../Resources/OSX-Migrater.sh";
|
||||||
QProcess::execute(OSXMigrater);
|
QProcess::execute(OSXMigrater, {});
|
||||||
QMessageBox MigrateProfile;
|
QMessageBox MigrateProfile;
|
||||||
MigrateProfile.setIcon(QMessageBox::Information);
|
MigrateProfile.setIcon(QMessageBox::Information);
|
||||||
MigrateProfile.setWindowModality(Qt::ApplicationModal);
|
MigrateProfile.setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user