Mercurial > hg > easyhg
changeset 672:88fa1544b407
Merge from branch qt5. There's much more to be done before we can make another release, but clearly it's going to be done using qt5
author | Chris Cannam |
---|---|
date | Wed, 05 Dec 2018 09:44:10 +0000 |
parents | 88061103b878 (current diff) ce29dc775650 (diff) |
children | e4d18e8ef430 |
files | deploy/osx/build-all.sh deploy/osx/combine.sh deploy/osx/deploy.sh deploy/osx/extract-leopard.sh deploy/osx/paths.sh |
diffstat | 18 files changed, 158 insertions(+), 175 deletions(-) [+] |
line wrap: on
line diff
--- a/deploy/osx/Info.plist Wed Mar 23 14:49:49 2016 +0000 +++ b/deploy/osx/Info.plist Wed Dec 05 09:44:10 2018 +0000 @@ -14,5 +14,11 @@ <string>org.easymercurial.EasyMercurial</string> <key>CFBundleShortVersionString</key> <string>EASYHG_VERSION</string> + + <!-- enable HiDPI --> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>NSHighResolutionCapable</key> + <string>True</string> </dict> </plist>
--- a/deploy/osx/build-all.sh Wed Mar 23 14:49:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#!/bin/bash - -# Carbon (10.4+ PPC/i386). -# -$HOME/qt-builds/qt-471-carbon-10.4u/bin/qmake -spec macx-g++40 || exit -make clean && make && \ - cp EasyMercurial.app/Contents/MacOS/EasyMercurial \ - EasyMercurial.carbon.app/Contents/MacOS/ && \ - bash deploy/osx/paths.sh EasyMercurial.carbon - -# Cocoa (10.6+ x86_64) -# -/usr/bin/qmake -spec macx-g++ || exit -make clean && make && \ - cp EasyMercurial.app/Contents/MacOS/EasyMercurial \ - EasyMercurial.cocoa.app/Contents/MacOS/ && \ - bash deploy/osx/paths.sh EasyMercurial.cocoa - -# Complicated lipo business -# -bash deploy/osx/combine.sh || exit 1 - -# Info.plist etc and make dmg -bash deploy/osx/deploy.sh EasyMercurial.app EasyMercurial - - - -
--- a/deploy/osx/combine.sh Wed Mar 23 14:49:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -#!/bin/bash -app=EasyMercurial -if [ ! -d "$app.carbon.app" ] || [ ! -d "$app.cocoa.app" ]; then - echo Carbon or Cocoa bundle not found - exit 1 -fi -(cd "$app.cocoa.app" ; find . -type f -print) | while read f; do - d=$(dirname "$f") - mkdir -p "$app.app/$d" - case $(file "$app.cocoa.app/$f") in - *universal*x86_64*) - lipo "$app.cocoa.app/$f" -extract x86_64 -output "/tmp/$$.x86_64";; - *x86_64*) - lipo "$app.cocoa.app/$f" -create -output "/tmp/$$.x86_64";; - *) - cp "$app.cocoa.app/$f" "$app.app/$f" - continue;; - esac - case $(file "$app.carbon.app/$f") in - *x86_64*) - lipo "$app.carbon.app/$f" -remove x86_64 -output "/tmp/$$.rest" - ;; - *universal*) - cp "$app.carbon.app/$f" "/tmp/$$.rest" - ;; - *) - lipo "$app.carbon.app/$f" -create -output "/tmp/$$.rest" - ;; - esac - lipo "/tmp/$$.x86_64" "/tmp/$$.rest" -create -output "$app.app/$f" - rm "/tmp/$$".* -done - -
--- a/deploy/osx/deploy.sh Wed Mar 23 14:49:49 2016 +0000 +++ b/deploy/osx/deploy.sh Wed Dec 05 09:44:10 2018 +0000 @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Execute this from the top-level directory of the project (the one # that contains the .app bundle). Supply the name of the .app bundle # as argument (the target will use $app.app regardless, but we need @@ -13,6 +15,8 @@ fi app=EasyMercurial +set -u + version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h` case "$version" in [0-9].[0-9]) bundleVersion="$version".0 ;; @@ -21,6 +25,36 @@ esac echo +echo "Copying in frameworks and plugins from Qt installation directory." + +deploy/osx/copy-qt.sh "$app" || exit 2 + +echo +echo "Fixing up paths." + +deploy/osx/paths.sh "$app" + +echo +echo "Copying in qt.conf to set local-only plugin paths." +echo "Make sure all necessary Qt plugins are in $source/Contents/plugins/*" +echo "You probably want platforms/, accessible/ and imageformats/ subdirectories." +cp deploy/osx/qt.conf "$source"/Contents/Resources/qt.conf + +echo "Writing version $bundleVersion in to bundle." +echo "(This should be a three-part number: major.minor.point)" + +perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ + > "$source"/Contents/Info.plist + +echo "Done: check $source/Contents/Info.plist for sanity please" + +echo +echo "Copying in helper scripts" +cp easyhg-extdiff.sh "$source"/Contents/MacOS/ +cp easyhg-merge.sh "$source"/Contents/MacOS/ +chmod +x "$source"/Contents/MacOS/easyhg-extdiff.sh "$source"/Contents/MacOS/easyhg-merge.sh + +echo echo "Making target tree." volume="$app"-"$version" @@ -31,17 +65,11 @@ ln -s /Applications "$volume"/Applications cp COPYING "$volume/COPYING.txt" -cp -RPp "$source" "$target" +cp -rp "$source" "$target" echo "Done" -echo "Writing version $bundleVersion in to bundle." -echo "(This should be a three-part number: major.minor.point)" - -perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \ - > "$target"/Contents/Info.plist - -echo "Done: check $target/Contents/Info.plist for sanity please" +deploy/osx/sign.sh "$volume" || exit 1 echo echo "Making dmg..."
--- a/deploy/osx/extract-leopard.sh Wed Mar 23 14:49:49 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -mkdir -p 10.5/src -cd 10.5 -cp -a ../EasyMercurial.app . -lipo ../EasyMercurial.app/Contents/MacOS/EasyMercurial -remove x86_64 -output ./EasyMercurial.app/Contents/MacOS/EasyMercurial -cp -a ../src/version.h src/ -cp -a ../COPYING . -bash ../deploy/osx/deploy.sh EasyMercurial.app EasyMercurial_leopard -cp *_leopard*.dmg .. -cd .. -rm -r 10.5 -echo Done - -
--- a/deploy/osx/paths.sh Wed Mar 23 14:49:49 2016 +0000 +++ b/deploy/osx/paths.sh Wed Dec 05 09:44:10 2018 +0000 @@ -1,5 +1,7 @@ #!/bin/bash +set -e + app="$1" if [ -z "$app" ]; then echo "Usage: $0 <appname>" @@ -7,28 +9,68 @@ exit 2 fi +set -u + +frameworks="QtCore QtNetwork QtGui QtWidgets QtPrintSupport QtDBus" + echo -echo "I expect you to have already copied QtCore, QtNetwork and QtGui to " -echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to " -echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing" +echo "I expect you to have already copied these frameworks from the Qt installation to" +echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:" +echo "$frameworks" echo echo "Fixing up loader paths in binaries..." -install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore" -install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui" -install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" +for fwk in $frameworks; do + install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk" +done -for fwk in QtCore QtGui QtNetwork; do - find "$app.app" -type f -print | while read x; do - current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }') - [ -z "$current" ] && continue - echo "$x has $current" - relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ - -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) - echo "replacing with relative path $relative" - install_name_tool -change "$current" "@loader_path/$relative" "$x" - done +find "$app.app" -name \*.dylib -print | while read x; do + install_name_tool -id "`basename \"$x\"`" "$x" +done + +for fwk in $frameworks; do + find "$app.app" -type f -print | while read x; do + + current=$(otool -L "$x" | + grep "$fwk" | grep amework | grep -v ':$' | + awk '{ print $1; }') + + [ -z "$current" ] && continue + + echo "$x has $current" + + case "$x" in + *PyQt4*) + # These are "special" Qt4 libraries used by + # the PyQt module. They need to refer to their + # own local neighbours. Ugh, but let's handle + # those manually here. + relative="$fwk.so" + ;; + *) + # The normal Qt5 case + relative=$(echo "$x" | + sed -e "s,$app.app/Contents/,," \ + -e 's,[^/]*/,../,g' \ + -e 's,/[^/]*$,/Frameworks/'"$fwk"',' ) + ;; + esac + + echo "replacing with relative path $relative" + install_name_tool -change \ + "$current" "@loader_path/$relative" "$x" + done +done + +find "$app.app" -type f -print | while read x; do + qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }') + if [ -n "$qtdep" ]; then + echo + echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:" + echo $qtdep + exit 1 + fi done echo "Done: be sure to run the app and see that it works!"
--- a/easyhg.pro Wed Mar 23 14:49:49 2016 +0000 +++ b/easyhg.pro Wed Dec 05 09:44:10 2018 +0000 @@ -5,23 +5,7 @@ TARGET = EasyMercurial QT += widgets -QMAKE_CXXFLAGS += -DQT_DISABLE_DEPRECATED_BEFORE=0x000000 -# We use the 10.5 SDK and Carbon for all 32-bit OS/X, -# and 10.6 with Cocoa for all 64-bit. (Since EasyHg 1.2, -# we can sadly no longer build for 10.4 because we need -# the FSEvents API) -macx-g++40 { - # Note, to use the 10.4 SDK on 10.6+ you need qmake -spec macx-g++40 - QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk - QMAKE_CFLAGS += -mmacosx-version-min=10.5 - QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 - CONFIG += x86 ppc -} -macx-g++ { - QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.6.sdk - CONFIG += x86_64 -} macx-llvm { CONFIG += x86_64 QMAKE_CFLAGS += -mmacosx-version-min=10.6
--- a/src/changesetdetailitem.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/changesetdetailitem.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -65,14 +65,13 @@ void ChangesetDetailItem::paint(QPainter *paint, - const QStyleOptionGraphicsItem *option, - QWidget *w) + const QStyleOptionGraphicsItem *, + QWidget *) { paint->save(); ColourSet *colourSet = ColourSet::instance(); QColor branchColour = colourSet->getColourFor(m_changeset->branch()); - QColor userColour = colourSet->getColourFor(m_changeset->author()); QTransform t = paint->worldTransform(); float scale = std::min(t.m11(), t.m22()); @@ -105,15 +104,6 @@ pts.push_back(QPointF(0, height/3 - 5)); paint->drawPolygon(QPolygonF(pts)); -/* - paint->setBrush(branchColour); - QVector<QPointF> pts; - pts.push_back(QPointF(width/2 - 5, 0)); - pts.push_back(QPointF(width/2 + 5, 0)); - pts.push_back(QPointF(width/2, -10)); - pts.push_back(QPointF(width/2 - 5, 0)); - paint->drawPolygon(QPolygonF(pts)); -*/ m_doc->drawContents(paint, r); paint->restore();
--- a/src/changesetitem.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/changesetitem.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -513,7 +513,6 @@ f.setPixelSize(ps); } - bool showText = (scale >= 0.2); bool showProperLines = (scale >= 0.1); if (!showProperLines) {
--- a/src/common.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/common.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -299,7 +299,7 @@ // chars: replace with Unicode character if (i+5 < s.length() && s[i] == '\\' && s[i+1] == 'u') { QString uni = s.mid(i+2, 4); - QByteArray ba = QByteArray::fromHex(uni.toAscii()); + QByteArray ba = QByteArray::fromHex(uni.toLatin1()); d += QChar(ba[1], ba[0]); i += 5; continue;
--- a/src/debug.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/debug.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -25,7 +25,7 @@ #include <QDir> #include <QCoreApplication> #include <QDateTime> -#include <QDesktopServices> +#include <QStandardPaths> #include <cstdio> @@ -41,8 +41,8 @@ prefix = new char[20]; sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback - QString logDir = QDesktopServices::storageLocation - (QDesktopServices::DataLocation); + QString logDir = QStandardPaths::writableLocation + (QStandardPaths::DataLocation); if (logDir != "" && (QDir(logDir).exists() || QDir().mkpath(logDir))) {
--- a/src/hgrunner.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/hgrunner.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -22,7 +22,7 @@ #include <QSettings> #include <QInputDialog> -#include <QDesktopServices> +#include <QStandardPaths> #include <QTemporaryFile> #include <QDir> #include <QProgressBar> @@ -411,7 +411,7 @@ emit commandCompleted(completedAction, m_stdout); } else { DEBUG << "HgRunner::finished: Command failed, exit code " - << procExitCode << ", exit status " << procExitStatus + << procExitCode << ", exit status " << int(procExitStatus) << ", stderr follows" << endl; DEBUG << m_stderr << endl; emit commandFailed(completedAction, m_stderr, m_stdout); @@ -454,8 +454,8 @@ void HgRunner::pruneOldAuthFiles() { - QString path = QDesktopServices::storageLocation - (QDesktopServices::CacheLocation); + QString path = QStandardPaths::writableLocation + (QStandardPaths::CacheLocation); QDir d(path); if (!d.exists()) return; QStringList filters; @@ -489,8 +489,8 @@ } QString fileExt16 = QString::fromLocal8Bit(fileExt.toBase64()).left(16) .replace('+', '-').replace('/', '_'); - QString path = QDesktopServices::storageLocation - (QDesktopServices::CacheLocation); + QString path = QStandardPaths::writableLocation + (QStandardPaths::CacheLocation); QDir().mkpath(path); if (path == "") { DEBUG << "HgRunner::addExtensionOptions: Failed to get cache location" << endl;
--- a/src/historywidget.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/historywidget.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -219,8 +219,6 @@ setChangesetParents(); ChangesetScene *scene = new ChangesetScene(); - ChangesetItem *tipItem = 0; - QGraphicsScene *oldScene = m_panned->scene(); m_panned->setScene(0);
--- a/src/mainwindow.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/mainwindow.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -858,7 +858,7 @@ hgRefresh(); } -void MainWindow::hgUnIgnoreFiles(QStringList files) +void MainWindow::hgUnIgnoreFiles(QStringList) { // Not implemented: edit the .hgignore instead hgEditIgnore(); @@ -2048,7 +2048,7 @@ output); } -void MainWindow::commandStarting(HgAction action) +void MainWindow::commandStarting(HgAction) { m_commandSequenceInProgress = true; } @@ -2591,7 +2591,7 @@ } } -void MainWindow::commandCancelled(HgAction cancelledAction) +void MainWindow::commandCancelled(HgAction) { // Originally I had this checking whether the cancelled action was // a network one and, if so, calling hgQueryPaths to update the @@ -3115,9 +3115,6 @@ spacerBefore = spacerAfter = " "; #endif - bool spacingReqd = false; - QString spacer = ""; - m_repoToolBar = addToolBar(tr("Remote")); m_repoToolBar->setIconSize(QSize(sz, sz)); if (spacerBefore != "") {
--- a/src/multichoicedialog.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/multichoicedialog.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -221,14 +221,14 @@ } void -MultiChoiceDialog::urlChanged(const QString &s) +MultiChoiceDialog::urlChanged(const QString &) { updateOkButton(); updateFileComboFromURL(); } void -MultiChoiceDialog::fileChanged(const QString &s) +MultiChoiceDialog::fileChanged(const QString &) { updateOkButton(); }
--- a/src/panned.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/panned.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -88,7 +88,7 @@ } void -Panned::drawForeground(QPainter *paint, const QRectF &) +Panned::drawForeground(QPainter *, const QRectF &) { QPointF nearpt = mapToScene(0, 0); QPointF farpt = mapToScene(width(), height()); @@ -222,6 +222,10 @@ m_dragDirection = FreeDrag; } break; + + case FreeDrag: + // stick with it + break; }; }
--- a/src/versiontester.cpp Wed Mar 23 14:49:49 2016 +0000 +++ b/src/versiontester.cpp Wed Dec 05 09:44:10 2018 +0000 @@ -20,24 +20,30 @@ #include <iostream> -#include <QHttp> +#include <QNetworkAccessManager> + +static QNetworkAccessManager nm; VersionTester::VersionTester(QString hostname, QString versionFilePath, QString myVersion) : - m_httpFailed(false), - m_myVersion(myVersion) + m_myVersion(myVersion), + m_reply(0), + m_httpFailed(false) { - QHttp *http = new QHttp(); - connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), - this, SLOT(httpResponseHeaderReceived(const QHttpResponseHeader &))); - connect(http, SIGNAL(done(bool)), - this, SLOT(httpDone(bool))); - http->setHost(hostname); - http->get(versionFilePath); + QUrl url(QString("http://%1/%2").arg(hostname).arg(versionFilePath)); + std::cerr << "VersionTester: URL is " << url << std::endl; + m_reply = nm.get(QNetworkRequest(url)); + connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), + this, SLOT(error(QNetworkReply::NetworkError))); + connect(m_reply, SIGNAL(finished()), this, SLOT(finished())); } VersionTester::~VersionTester() { + if (m_reply) { + m_reply->abort(); + m_reply->deleteLater(); + } } bool @@ -66,31 +72,35 @@ } void -VersionTester::httpResponseHeaderReceived(const QHttpResponseHeader &h) +VersionTester::error(QNetworkReply::NetworkError) { - if (h.statusCode() / 100 != 2) m_httpFailed = true; + std::cerr << "VersionTester: error: " << m_reply->errorString() << std::endl; + m_httpFailed = true; } void -VersionTester::httpDone(bool error) +VersionTester::finished() { - QHttp *http = const_cast<QHttp *>(dynamic_cast<const QHttp *>(sender())); - if (!http) return; - http->deleteLater(); - if (error || m_httpFailed) return; + m_reply->deleteLater(); + if (m_httpFailed) return; - QByteArray responseData = http->readAll(); + int status = m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (status / 100 != 2) { + std::cerr << "VersionTester: error: http status = " << status << std::endl; + return; + } + + QByteArray responseData = m_reply->readAll(); QString str = QString::fromUtf8(responseData.data()); QStringList lines = str.split('\n', QString::SkipEmptyParts); if (lines.empty()) return; QString latestVersion = lines[0]; DEBUG << "Comparing current version \"" << m_myVersion - << "\" with latest version \"" << latestVersion - << "\"" << endl; + << "\" with latest version \"" << latestVersion + << "\"" << endl; if (isVersionNewerThan(latestVersion, m_myVersion)) { emit newerVersionAvailable(latestVersion); } } -
--- a/src/versiontester.h Wed Mar 23 14:49:49 2016 +0000 +++ b/src/versiontester.h Wed Dec 05 09:44:10 2018 +0000 @@ -21,8 +21,7 @@ #include <QStringList> #include <QString> #include <QObject> - -class QHttpResponseHeader; +#include <QNetworkReply> class VersionTester : public QObject { @@ -38,12 +37,13 @@ void newerVersionAvailable(QString); protected slots: - void httpResponseHeaderReceived(const QHttpResponseHeader &); - void httpDone(bool); + void finished(); + void error(QNetworkReply::NetworkError); private: + QString m_myVersion; + QNetworkReply *m_reply; bool m_httpFailed; - QString m_myVersion; }; #endif