Skip to content
This repository has been archived by the owner on Sep 1, 2019. It is now read-only.

Commit

Permalink
support Qt v5.6 on windows for 32-bit builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozeiko committed Jul 1, 2017
1 parent 8b9e11e commit 3c9c69a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ void MainWindow::rcloneGetVersion()

void MainWindow::rcloneConfig()
{
#if defined(Q_OS_WIN32) && (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
QProcess::startDetached(GetRclone(), QStringList() << "config" << GetRcloneConf());
return;
#else

QProcess* p = new QProcess(this);

QObject::connect(p, static_cast<void(QProcess::*)(int)>(&QProcess::finished), this, [=](int code)
Expand All @@ -249,15 +254,20 @@ void MainWindow::rcloneConfig()
}
p->deleteLater();
});
#endif

#if defined(Q_OS_WIN32)

#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
p->setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments* args)
{
args->flags |= CREATE_NEW_CONSOLE;
args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES;
});
p->setProgram(GetRclone());
p->setArguments(QStringList() << "config" << GetRcloneConf());
#endif

#elif defined(Q_OS_OSX)
auto tmp = new QFile("/tmp/rclone_config.command");
tmp->open(QIODevice::WriteOnly);
Expand Down Expand Up @@ -287,8 +297,11 @@ void MainWindow::rcloneConfig()
p->setProgram(terminal);
p->setArguments(QStringList() << "-e" << (GetRclone() + " config" + GetRcloneConf().join(" ")));
#endif

#if !defined(Q_OS_WIN32) || (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
UseRclonePassword(p);
p->start(QIODevice::NotOpen);
#endif
}

void MainWindow::rcloneListRemotes()
Expand Down

0 comments on commit 3c9c69a

Please sign in to comment.