Use upstream patches for appimage (#52)
This commit is contained in:
parent
3189a8ebfe
commit
834bd67b2a
5 changed files with 16 additions and 1326 deletions
25
.github/workflows/appimage.yml
vendored
25
.github/workflows/appimage.yml
vendored
|
|
@ -5,6 +5,7 @@ on:
|
|||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
- '!docs/building-cmake.md'
|
||||
- 'changelog.txt'
|
||||
- 'kotatogram_changes.txt'
|
||||
- 'LEGAL'
|
||||
|
|
@ -14,9 +15,6 @@ on:
|
|||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- 'Telegram/Patches/**'
|
||||
- '!Telegram/Patches/qtbase_5_12_8_appimage.diff'
|
||||
- '!Telegram/Patches/qtwayland_5_12_8.diff'
|
||||
- '!Telegram/Patches/qtstyleplugins.diff'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/Resources/winrc/**'
|
||||
- 'Telegram/SourceFiles/platform/win/**'
|
||||
|
|
@ -28,6 +26,7 @@ on:
|
|||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
- '!docs/building-cmake.md'
|
||||
- 'changelog.txt'
|
||||
- 'kotatogram_changes.txt'
|
||||
- 'LEGAL'
|
||||
|
|
@ -37,9 +36,6 @@ on:
|
|||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- 'Telegram/Patches/**'
|
||||
- '!Telegram/Patches/qtbase_5_12_8_appimage.diff'
|
||||
- '!Telegram/Patches/qtwayland_5_12_8.diff'
|
||||
- '!Telegram/Patches/qtstyleplugins.diff'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/Resources/winrc/**'
|
||||
- 'Telegram/SourceFiles/platform/win/**'
|
||||
|
|
@ -147,6 +143,15 @@ jobs:
|
|||
cd Libraries
|
||||
echo ::set-env name=LibrariesPath::`pwd`
|
||||
|
||||
- name: Patches.
|
||||
run: |
|
||||
echo "Find necessary commit from doc."
|
||||
checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$DOC_PATH | sed -n 2p)
|
||||
cd $LibrariesPath
|
||||
git clone $GIT/desktop-app/patches.git
|
||||
cd patches
|
||||
eval $checkoutCommit
|
||||
|
||||
- name: OpenSSL cache.
|
||||
id: cache-openssl
|
||||
uses: actions/cache@v1
|
||||
|
|
@ -467,7 +472,7 @@ jobs:
|
|||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ env.LibrariesPath }}/qt-cache
|
||||
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8_appimage.diff') }}-${{ hashFiles('**/qtwayland_5_12_8.diff') }}
|
||||
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8.diff') }}-${{ hashFiles('**/qtwayland_5_12_8.diff') }}
|
||||
- name: Qt 5.12.8 build.
|
||||
if: steps.cache-qt.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
|
|
@ -478,10 +483,10 @@ jobs:
|
|||
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qttools,qtx11extras
|
||||
git submodule update qtbase qtwayland qtimageformats qtsvg qttools qtx11extras
|
||||
cd qtbase
|
||||
git apply ../../../$REPO_NAME/Telegram/Patches/qtbase_${QT}_appimage.diff
|
||||
git apply ../../patches/qtbase_${QT}.diff
|
||||
cd ..
|
||||
cd qtwayland
|
||||
git apply ../../../$REPO_NAME/Telegram/Patches/qtwayland_${QT}.diff
|
||||
git apply ../../patches/qtwayland_${QT}.diff
|
||||
cd ..
|
||||
|
||||
./configure -prefix /usr/local \
|
||||
|
|
@ -517,7 +522,7 @@ jobs:
|
|||
|
||||
git clone --depth=1 git://code.qt.io/qt/qtstyleplugins.git
|
||||
cd qtstyleplugins
|
||||
git apply ../../$REPO_NAME/Telegram/Patches/qtstyleplugins.diff
|
||||
git apply ../patches/qtstyleplugins.diff
|
||||
qmake
|
||||
make -j$(nproc)
|
||||
sudo make install
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,87 +0,0 @@
|
|||
diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
|
||||
index 62e5dd2..3e609f7 100644
|
||||
--- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
|
||||
+++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <qcolor.h>
|
||||
#include <qdebug.h>
|
||||
#include <qfont.h>
|
||||
+#include <qfileinfo.h>
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformfontdatabase.h>
|
||||
@@ -50,6 +51,16 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
+// GTK file chooser image preview: thanks to Chromium
|
||||
+
|
||||
+// The size of the preview we display for selected image files. We set height
|
||||
+// larger than width because generally there is more free space vertically
|
||||
+// than horiztonally (setting the preview image will alway expand the width of
|
||||
+// the dialog, but usually not the height). The image's aspect ratio will always
|
||||
+// be preserved.
|
||||
+#define PREVIEW_WIDTH 256
|
||||
+#define PREVIEW_HEIGHT 512
|
||||
+
|
||||
class QGtk2Dialog : public QWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -70,18 +81,24 @@ Q_SIGNALS:
|
||||
|
||||
protected:
|
||||
static void onResponse(QGtk2Dialog *dialog, int response);
|
||||
+ static void onUpdatePreview(QGtk2Dialog *dialog);
|
||||
|
||||
private slots:
|
||||
void onParentWindowDestroyed();
|
||||
|
||||
private:
|
||||
GtkWidget *gtkWidget;
|
||||
+ GtkWidget *previewWidget;
|
||||
};
|
||||
|
||||
QGtk2Dialog::QGtk2Dialog(GtkWidget *gtkWidget) : gtkWidget(gtkWidget)
|
||||
{
|
||||
g_signal_connect_swapped(G_OBJECT(gtkWidget), "response", G_CALLBACK(onResponse), this);
|
||||
g_signal_connect(G_OBJECT(gtkWidget), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
|
||||
+
|
||||
+ previewWidget = gtk_image_new();
|
||||
+ g_signal_connect_swapped(G_OBJECT(gtkWidget), "update-preview", G_CALLBACK(onUpdatePreview), this);
|
||||
+ gtk_file_chooser_set_preview_widget(GTK_FILE_CHOOSER(gtkWidget), previewWidget);
|
||||
}
|
||||
|
||||
QGtk2Dialog::~QGtk2Dialog()
|
||||
@@ -151,6 +168,32 @@ void QGtk2Dialog::onResponse(QGtk2Dialog *dialog, int response)
|
||||
emit dialog->reject();
|
||||
}
|
||||
|
||||
+void QGtk2Dialog::onUpdatePreview(QGtk2Dialog *dialog) {
|
||||
+ gchar *filename = gtk_file_chooser_get_preview_filename(GTK_FILE_CHOOSER(dialog->gtkWidget));
|
||||
+ if (!filename) {
|
||||
+ gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), false);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Don't attempt to open anything which isn't a regular file. If a named pipe,
|
||||
+ // this may hang. See https://crbug.com/534754.
|
||||
+ QFileInfo fileinfo(filename);
|
||||
+ if (!fileinfo.exists() || !fileinfo.isFile()) {
|
||||
+ g_free(filename);
|
||||
+ gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), false);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // This will preserve the image's aspect ratio.
|
||||
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size(filename, PREVIEW_WIDTH, PREVIEW_HEIGHT, 0);
|
||||
+ g_free(filename);
|
||||
+ if (pixbuf) {
|
||||
+ gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->previewWidget), pixbuf);
|
||||
+ g_object_unref(pixbuf);
|
||||
+ }
|
||||
+ gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(dialog->gtkWidget), pixbuf ? true : false);
|
||||
+}
|
||||
+
|
||||
void QGtk2Dialog::onParentWindowDestroyed()
|
||||
{
|
||||
// The QGtk2*DialogHelper classes own this object. Make sure the parent doesn't delete it.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
|
||||
index 46bef294..845bb038 100644
|
||||
--- a/src/client/qwaylandintegration.cpp
|
||||
+++ b/src/client/qwaylandintegration.cpp
|
||||
@@ -293,12 +293,12 @@ QWaylandDisplay *QWaylandIntegration::display() const
|
||||
|
||||
QStringList QWaylandIntegration::themeNames() const
|
||||
{
|
||||
- return GenericWaylandTheme::themeNames();
|
||||
+ return QGenericUnixTheme::themeNames();
|
||||
}
|
||||
|
||||
QPlatformTheme *QWaylandIntegration::createPlatformTheme(const QString &name) const
|
||||
{
|
||||
- return GenericWaylandTheme::createUnixTheme(name);
|
||||
+ return QGenericUnixTheme::createUnixTheme(name);
|
||||
}
|
||||
|
||||
// May be called from non-GUI threads
|
||||
|
|
@ -54,7 +54,7 @@ Go to ***BuildPath*** and run
|
|||
|
||||
git clone https://github.com/desktop-app/patches.git
|
||||
cd patches
|
||||
git checkout b08b497
|
||||
git checkout 3e9be0f
|
||||
cd ../
|
||||
|
||||
git clone https://github.com/xiph/opus
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue