118 lines
4.4 KiB
Plaintext
118 lines
4.4 KiB
Plaintext
From d211437ffb404f24d7ed19b82b3afaa1bffd6afe Mon Sep 17 00:00:00 2001
|
|
From: cyrusbuilt <cyrusbuilt@gmail.com>
|
|
Date: Fri, 31 Jul 2020 19:31:45 -0400
|
|
Subject: Adding Haiku OS support
|
|
|
|
|
|
diff --git a/src/big_widgets/Controls.cpp b/src/big_widgets/Controls.cpp
|
|
index 14e11d8..6e92312 100644
|
|
--- a/src/big_widgets/Controls.cpp
|
|
+++ b/src/big_widgets/Controls.cpp
|
|
@@ -319,14 +319,19 @@ void Controls::pullCurrentBranch()
|
|
const auto ret = git->pull();
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
+ const auto msg = ret.output.toString();
|
|
+
|
|
if (ret.success)
|
|
- emit signalRepositoryUpdated();
|
|
+ {
|
|
+ if (msg.toLower().contains("merge conflict"))
|
|
+ emit signalPullConflict();
|
|
+ else
|
|
+ emit signalRepositoryUpdated();
|
|
+ }
|
|
else
|
|
{
|
|
- const auto errorMsg = ret.output.toString();
|
|
-
|
|
- if (errorMsg.contains("error: could not apply", Qt::CaseInsensitive)
|
|
- && errorMsg.contains("causing a conflict", Qt::CaseInsensitive))
|
|
+ if (msg.contains("error: could not apply", Qt::CaseInsensitive)
|
|
+ && msg.contains("causing a conflict", Qt::CaseInsensitive))
|
|
{
|
|
emit signalPullConflict();
|
|
}
|
|
@@ -336,7 +341,7 @@ void Controls::pullCurrentBranch()
|
|
QString("There were problems during the pull operation. Please, see the detailed "
|
|
"description for more information."),
|
|
QMessageBox::Ok, this);
|
|
- msgBox.setDetailedText(errorMsg);
|
|
+ msgBox.setDetailedText(msg);
|
|
msgBox.setStyleSheet(GitQlientStyles::getStyles());
|
|
msgBox.exec();
|
|
}
|
|
@@ -515,16 +520,19 @@ void Controls::processUpdateFile()
|
|
mLatestGitQlient = json["latest-version"].toString();
|
|
const auto changeLogUrl = json["changelog"].toString();
|
|
|
|
+ QJsonObject os;
|
|
+ auto platformSupported = true;
|
|
#if defined(Q_OS_WIN)
|
|
- const auto os = json["windows"].toObject();
|
|
+ os = json["windows"].toObject();
|
|
#elif defined(Q_OS_LINUX)
|
|
- const auto os = json["linux"].toObject();
|
|
+ os = json["linux"].toObject();
|
|
#elif defined(Q_OS_OSX)
|
|
- const auto os = json["osx"].toObject();
|
|
+ os = json["osx"].toObject();
|
|
+#else
|
|
+ platformSupported = false;
|
|
+ QLog_Error("Ui", QString("Platform not supported for updates"));
|
|
#endif
|
|
|
|
- mGitQlientDownloadUrl = os["download-url"].toString();
|
|
-
|
|
const auto newVersion = mLatestGitQlient.split(".");
|
|
const auto nv = newVersion.at(0).toInt() * 10000 + newVersion.at(1).toInt() * 100 + newVersion.at(2).toInt();
|
|
const auto curVersion = QString("%1").arg(VER).split(".");
|
|
@@ -532,20 +540,33 @@ void Controls::processUpdateFile()
|
|
|
|
if (nv > cv)
|
|
{
|
|
- mVersionCheck->setVisible(true);
|
|
+ if (!platformSupported)
|
|
+ {
|
|
+ QMessageBox::information(
|
|
+ this, tr("New version available!"),
|
|
+ tr("There is a new version of GitQlient available but your OS doesn't have a binary built. If you want to "
|
|
+ "get the latest version, pleas <a href='https://github.com/francescmm/GitQlient/releases/tag/v%1'>get "
|
|
+ "the source code from GitHub</a>.")
|
|
+ .arg(mLatestGitQlient));
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ mGitQlientDownloadUrl = os["download-url"].toString();
|
|
+ mVersionCheck->setVisible(true);
|
|
|
|
- QTimer::singleShot(200, this, [this, changeLogUrl] {
|
|
- QNetworkRequest request;
|
|
- request.setRawHeader("User-Agent", "GitQlient");
|
|
- request.setRawHeader("X-Custom-User-Agent", "GitQlient");
|
|
- request.setRawHeader("Content-Type", "application/json");
|
|
- request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
|
- request.setUrl(QUrl(changeLogUrl));
|
|
+ QTimer::singleShot(200, this, [this, changeLogUrl] {
|
|
+ QNetworkRequest request;
|
|
+ request.setRawHeader("User-Agent", "GitQlient");
|
|
+ request.setRawHeader("X-Custom-User-Agent", "GitQlient");
|
|
+ request.setRawHeader("Content-Type", "application/json");
|
|
+ request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
|
+ request.setUrl(QUrl(changeLogUrl));
|
|
|
|
- const auto reply = mManager->get(request);
|
|
+ const auto reply = mManager->get(request);
|
|
|
|
- connect(reply, &QNetworkReply::finished, this, &Controls::processChangeLog);
|
|
- });
|
|
+ connect(reply, &QNetworkReply::finished, this, &Controls::processChangeLog);
|
|
+ });
|
|
+ }
|
|
}
|
|
}
|
|
|
|
--
|
|
2.27.0
|
|
|