flameshot: bump version

This commit is contained in:
Gerasim Troeglazov
2022-05-11 21:42:10 +10:00
parent dbf36c367b
commit b5871f1cfc
3 changed files with 382 additions and 168 deletions

View File

@@ -6,12 +6,12 @@ DESCRIPTION="Features
* In-app screenshot edition.
* DBus interface.
* Upload to Imgur."
HOMEPAGE="https://github.com/lupoDharkael/flameshot/"
COPYRIGHT="2020 lupoDharkael"
HOMEPAGE="https://github.com/flameshot-org/flameshot/"
COPYRIGHT="2022 lupoDharkael"
LICENSE="GNU GPL v3"
REVISION="4"
SOURCE_URI="https://github.com/lupoDharkael/flameshot/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f820c1f8cd464988cfcfc1af1fbcea2a3d0e5c4fb32accc3f54d93a8b5e1e890"
REVISION="1"
SOURCE_URI="https://github.com/flameshot-org/flameshot/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="4cd158719031e97c97ecb6db1c14dd8ded44bf531c062bce496fc63be18bc2cf"
PATCHES="flameshot-$portVersion.patchset"
ADDITIONAL_FILES="
flameshot.rdef.in
@@ -60,6 +60,7 @@ BUILD()
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$appsDir/Flameshot
make $jobArgs
}

View File

@@ -1,163 +0,0 @@
From 24a735fc878e61a74fe83ddc0473983a55430058 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 6 Dec 2020 00:08:29 +1000
Subject: Add support for autolaunch
diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp
index ee50acb..0a0a144 100644
--- a/src/utils/confighandler.cpp
+++ b/src/utils/confighandler.cpp
@@ -296,7 +296,10 @@ bool ConfigHandler::verifyLaunchFile()
{
bool res = false;
-#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
+#if defined(Q_OS_HAIKU)
+ QString path = QDir::homePath() + "/config/settings/boot/launch/Flameshot";
+ res = QFile(path).exists();
+#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop";
res = QFile(path).exists();
#elif defined(Q_OS_WIN)
@@ -311,7 +314,16 @@ bool ConfigHandler::verifyLaunchFile()
void ConfigHandler::setStartupLaunch(const bool start)
{
-#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
+#if defined(Q_OS_HAIKU)
+ QString linkname = QDir::homePath() + "/config/settings/boot/launch/Flameshot";
+ QFile appFile(QCoreApplication::applicationFilePath());
+ QFile linkFile(linkname);
+ if (start) {
+ appFile.link(linkname);
+ } else {
+ linkFile.remove();
+ }
+#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
QString path = QDir::homePath() + "/.config/autostart/";
QDir autostartDir(path);
if (!autostartDir.exists()) {
--
2.28.0
From 4b818982fc484de02d324b579ee15981e5355416 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 6 Dec 2020 00:09:32 +1000
Subject: DBus autostart
diff --git a/src/main.cpp b/src/main.cpp
index 2d44f54..314642f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,6 +30,7 @@
#include <QTextStream>
#include <QTimer>
#include <QTranslator>
+#include <QProcess>
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
#include "src/core/flameshotdbusadapter.h"
@@ -48,6 +49,28 @@ int main(int argc, char* argv[])
// no arguments, just launch Flameshot
if (argc == 1) {
SingleApplication app(argc, argv);
+
+#ifdef Q_OS_HAIKU
+ int status=0;
+ QProcess dbusProcess;
+ QString exec = "/bin/dbus-launch";
+ QStringList params;
+ dbusProcess.start(exec, params);
+ dbusProcess.waitForFinished();
+ QString output(dbusProcess.readAllStandardOutput());
+
+ QFile file ("/tmp/flameshot_session");
+ if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+ QTextStream outstream(&file);
+ outstream << output;
+ file.close();
+ }
+
+ QStringList list = output.split("\n", QString::SkipEmptyParts);
+ foreach (const QString &str, list)
+ putenv(str.toLatin1().data());
+#endif
+
QApplication::setStyle(new StyleOverride);
QTranslator translator, qtTranslator;
@@ -89,10 +112,30 @@ int main(int argc, char* argv[])
// Exporting captures must be connected after the dbus interface
// or the dbus signal gets blocked until we end the exports.
c->enableExports();
+#ifdef Q_OS_HAIKU
+ status = app.exec();
+ system("kill -3 $DBUS_SESSION_BUS_PID");
+ return status;
+#else
return app.exec();
+#endif
}
#ifndef Q_OS_WIN
+
+#ifdef Q_OS_HAIKU
+QFile inputFile("/tmp/flameshot_session");
+if (inputFile.open(QIODevice::ReadOnly))
+{
+ QTextStream in(&inputFile);
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ putenv(line.toLatin1().data());
+ }
+ inputFile.close();
+}
+#endif
/*--------------|
* CLI parsing |
* ------------*/
diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp
index e3eb0e7..fb64d60 100644
--- a/src/utils/filenamehandler.cpp
+++ b/src/utils/filenamehandler.cpp
@@ -25,7 +25,9 @@
FileNameHandler::FileNameHandler(QObject* parent)
: QObject(parent)
{
+#ifndef __HAIKU__
std::locale::global(std::locale(""));
+#endif
}
QString FileNameHandler::parsedPattern()
--
2.28.0
From 2b60946e9bccb5fa51740ac21021180f74b5b1cf Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 16 Dec 2020 08:53:52 +1000
Subject: Don't use icon from theme
diff --git a/src/core/controller.cpp b/src/core/controller.cpp
index b0cf0b3..07c06ff 100644
--- a/src/core/controller.cpp
+++ b/src/core/controller.cpp
@@ -225,7 +225,7 @@ void Controller::enableTrayIcon()
m_trayIcon->setToolTip(QStringLiteral("Flameshot"));
m_trayIcon->setContextMenu(trayIconMenu);
QIcon trayicon =
- QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png"));
+ QIcon(":img/app/flameshot.png");
m_trayIcon->setIcon(trayicon);
auto trayIconActivated = [this](QSystemTrayIcon::ActivationReason r) {
--
2.28.0

View File

@@ -0,0 +1,376 @@
From 39ee1e6ed2a73d9fe7859cc2de2f5eeca683f45a Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 11 May 2022 21:31:12 +1000
Subject: Add support for autolaunch
diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp
index 42f5310..381db29 100644
--- a/src/utils/confighandler.cpp
+++ b/src/utils/confighandler.cpp
@@ -26,7 +26,10 @@
bool verifyLaunchFile()
{
-#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
+#if defined(Q_OS_HAIKU)
+ QString path = QDir::homePath() + "/config/settings/boot/launch/Flameshot";
+ bool res = QFile(path).exists();
+#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
QString path = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,
"autostart/",
QStandardPaths::LocateDirectory) +
@@ -260,6 +263,15 @@ void ConfigHandler::setStartupLaunch(const bool start)
qWarning() << "Unable to change login items, error:"
<< process.readAll();
}
+#elif defined(Q_OS_HAIKU)
+ QString linkname = QDir::homePath() + "/config/settings/boot/launch/Flameshot";
+ QFile appFile(QCoreApplication::applicationFilePath());
+ QFile linkFile(linkname);
+ if (start) {
+ appFile.link(linkname);
+ } else {
+ linkFile.remove();
+ }
#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
QString path =
QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) +
--
2.30.2
From 35973492e97b7875a819fac30553fded018940f9 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 11 May 2022 21:32:10 +1000
Subject: DBus autostart
diff --git a/src/main.cpp b/src/main.cpp
index 90a4a80..ec76cff 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -23,6 +23,7 @@
#include <QSharedMemory>
#include <QTimer>
#include <QTranslator>
+#include <QProcess>
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
#include "abstractlogger.h"
@@ -99,6 +100,27 @@ int main(int argc, char* argv[])
#else
QtSingleApplication app(argc, argv);
#endif
+
+#ifdef Q_OS_HAIKU
+ int status=0;
+ QProcess dbusProcess;
+ QString exec = "/bin/dbus-launch";
+ QStringList params;
+ dbusProcess.start(exec, params);
+ dbusProcess.waitForFinished();
+ QString output(dbusProcess.readAllStandardOutput());
+
+ QFile file ("/tmp/flameshot_session");
+ if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+ QTextStream outstream(&file);
+ outstream << output;
+ file.close();
+ }
+
+ QStringList list = output.split("\n", QString::SkipEmptyParts);
+ foreach (const QString &str, list)
+ putenv(str.toLatin1().data());
+#endif
QApplication::setStyle(new StyleOverride);
QTranslator translator, qtTranslator;
@@ -137,10 +159,30 @@ int main(int argc, char* argv[])
dbus.registerObject(QStringLiteral("/"), c);
dbus.registerService(QStringLiteral("org.flameshot.Flameshot"));
#endif
+#ifdef Q_OS_HAIKU
+ status = app.exec();
+ system("kill -3 $DBUS_SESSION_BUS_PID");
+ return status;
+#else
return qApp->exec();
+#endif
}
#if !defined(Q_OS_WIN)
+
+#ifdef Q_OS_HAIKU
+QFile inputFile("/tmp/flameshot_session");
+if (inputFile.open(QIODevice::ReadOnly))
+{
+ QTextStream in(&inputFile);
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ putenv(line.toLatin1().data());
+ }
+ inputFile.close();
+}
+#endif
/*--------------|
* CLI parsing |
* ------------*/
diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp
index 3bc5295..562a5a8 100644
--- a/src/utils/filenamehandler.cpp
+++ b/src/utils/filenamehandler.cpp
@@ -14,6 +14,7 @@ FileNameHandler::FileNameHandler(QObject* parent)
: QObject(parent)
{
auto err = AbstractLogger::error(AbstractLogger::Stderr);
+#ifndef __HAIKU__
try {
std::locale::global(std::locale(""));
} catch (std::exception& e) {
@@ -22,6 +23,7 @@ FileNameHandler::FileNameHandler(QObject* parent)
std::locale::global(std::locale("en_US.UTF-8"));
}
+#endif
}
QString FileNameHandler::parsedPattern()
--
2.30.2
From a6663600eef45942877c654d6fe2638797d91ab3 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 11 May 2022 21:32:54 +1000
Subject: Don't use tray icon from theme
diff --git a/src/core/controller.cpp b/src/core/controller.cpp
index 7221e84..53e3b52 100644
--- a/src/core/controller.cpp
+++ b/src/core/controller.cpp
@@ -522,8 +522,7 @@ void Controller::enableTrayIcon()
#else
m_trayIcon->setContextMenu(m_trayIconMenu);
#endif
- QIcon trayIcon =
- QIcon::fromTheme("flameshot-tray", QIcon(GlobalValues::iconPathPNG()));
+ QIcon trayIcon = QIcon(":img/app/flameshot.png");
m_trayIcon->setIcon(trayIcon);
#if defined(Q_OS_MACOS)
--
2.30.2
From 3568a9333bce959e82b5d856f4c27fdd849dcd01 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 11 May 2022 21:34:50 +1000
Subject: Link with libbe.so
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 97af4e9..5a46c1d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -197,6 +197,13 @@ if (APPLE)
)
endif ()
+if (HAIKU)
+ target_link_libraries(
+ flameshot
+ be
+ )
+endif ()
+
if (WIN32)
set(USE_OPENSSL FALSE)
if (ENABLE_OPENSSL)
--
2.30.2
From 1851c2f675025ce2658187fd1c2a4388cd825ff1 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Wed, 11 May 2022 21:36:19 +1000
Subject: Style tune
diff --git a/src/config/buttonlistview.cpp b/src/config/buttonlistview.cpp
index 54d5f44..0b83487 100644
--- a/src/config/buttonlistview.cpp
+++ b/src/config/buttonlistview.cpp
@@ -36,7 +36,7 @@ void ButtonListView::initButtonList()
QColor bgColor = this->palette().color(QWidget::backgroundRole());
m_buttonItem->setIcon(tool->icon(bgColor, false));
- m_buttonItem->setFlags(Qt::ItemIsUserCheckable);
+ //m_buttonItem->setFlags(Qt::ItemIsUserCheckable);
QColor foregroundColor =
this->palette().color(QWidget::foregroundRole());
m_buttonItem->setForeground(foregroundColor);
diff --git a/src/config/shortcutswidget.cpp b/src/config/shortcutswidget.cpp
index 8415044..b6882a1 100644
--- a/src/config/shortcutswidget.cpp
+++ b/src/config/shortcutswidget.cpp
@@ -22,6 +22,10 @@
#include <QScreen>
#endif
+#ifdef Q_OS_HAIKU
+#include <InterfaceDefs.h>
+#endif
+
ShortcutsWidget::ShortcutsWidget(QWidget* parent)
: QWidget(parent)
{
@@ -93,7 +97,7 @@ void ShortcutsWidget::populateInfoTable()
const auto key_sequence = current_shortcut.at(2);
m_table->setItem(i, 0, new QTableWidgetItem(description));
-#if defined(Q_OS_MACOS)
+#if defined(Q_OS_MACOS) || defined(Q_OS_HAIKU)
QTableWidgetItem* item =
new QTableWidgetItem(nativeOSHotKeyText(key_sequence));
#else
@@ -229,3 +233,19 @@ const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text)
return m_res;
}
#endif
+
+#if defined(Q_OS_HAIKU)
+const QString& ShortcutsWidget::nativeOSHotKeyText(const QString& text)
+{
+ uint32 ctrlKey;
+ get_modifier_key(B_LEFT_CONTROL_KEY, &ctrlKey);
+ m_res = text;
+ if (ctrlKey==0x5c) {
+ if (m_res.contains("Ctrl+"))
+ m_res.replace("Ctrl+", "Alt+");
+ else if (m_res.contains("Alt+"))
+ m_res.replace("Alt+", "Ctrl+");
+ }
+ return m_res;
+}
+#endif
diff --git a/src/config/shortcutswidget.h b/src/config/shortcutswidget.h
index 638bff3..c3314c2 100644
--- a/src/config/shortcutswidget.h
+++ b/src/config/shortcutswidget.h
@@ -22,7 +22,7 @@ public:
private:
void initInfoTable();
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
- defined(Q_OS_MACX))
+ defined(Q_OS_MACX) || defined(Q_OS_HAIKU))
const QString& nativeOSHotKeyText(const QString& text);
#endif
@@ -32,7 +32,7 @@ private slots:
private:
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
- defined(Q_OS_MACX))
+ defined(Q_OS_MACX) || defined(Q_OS_HAIKU))
QString m_res;
#endif
ConfigHandler m_config;
diff --git a/src/tools/pin/pinwidget.cpp b/src/tools/pin/pinwidget.cpp
index 7d6e949..ca05915 100644
--- a/src/tools/pin/pinwidget.cpp
+++ b/src/tools/pin/pinwidget.cpp
@@ -21,7 +21,7 @@ PinWidget::PinWidget(const QPixmap& pixmap,
setWindowIcon(QIcon(GlobalValues::iconPath()));
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
// set the bottom widget background transparent
- setAttribute(Qt::WA_TranslucentBackground);
+ //setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_DeleteOnClose);
ConfigHandler conf;
@@ -32,14 +32,17 @@ PinWidget::PinWidget(const QPixmap& pixmap,
const int margin = this->margin();
m_layout->setContentsMargins(margin, margin, margin, margin);
+#ifndef __HAIKU__
m_shadowEffect = new QGraphicsDropShadowEffect(this);
m_shadowEffect->setColor(m_baseColor);
m_shadowEffect->setBlurRadius(2 * margin);
m_shadowEffect->setOffset(0, 0);
setGraphicsEffect(m_shadowEffect);
-
+#endif
m_label = new QLabel();
m_label->setPixmap(m_pixmap);
+ m_label->setFrameStyle(QFrame::Box | QFrame::Plain);
+ m_label->setLineWidth(margin);
m_layout->addWidget(m_label);
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
@@ -73,7 +76,7 @@ PinWidget::PinWidget(const QPixmap& pixmap,
int PinWidget::margin() const
{
- return 7;
+ return 1;
}
void PinWidget::wheelEvent(QWheelEvent* e)
@@ -91,12 +94,12 @@ void PinWidget::wheelEvent(QWheelEvent* e)
void PinWidget::enterEvent(QEvent*)
{
- m_shadowEffect->setColor(m_hoverColor);
+ //m_shadowEffect->setColor(m_hoverColor);
}
void PinWidget::leaveEvent(QEvent*)
{
- m_shadowEffect->setColor(m_baseColor);
+ //m_shadowEffect->setColor(m_baseColor);
}
void PinWidget::mouseDoubleClickEvent(QMouseEvent*)
diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp
index c34a5f1..7ff28bd 100644
--- a/src/widgets/capture/capturewidget.cpp
+++ b/src/widgets/capture/capturewidget.cpp
@@ -40,6 +40,10 @@
#include <QShortcut>
#include <draggablewidgetmaker.h>
+#ifdef Q_OS_HAIKU
+#include <InterfaceDefs.h>
+#endif
+
#define MOUSE_DISTANCE_TO_START_MOVING 3
// CaptureWidget is the main component used to capture the screen. It contains
@@ -365,6 +369,10 @@ void CaptureWidget::handleButtonLeftClick(CaptureToolButton* b)
void CaptureWidget::initHelpMessage()
{
+#ifdef Q_OS_HAIKU
+ uint32 ctrlKey;
+ get_modifier_key(B_LEFT_CONTROL_KEY, &ctrlKey);
+#endif
QList<QPair<QString, QString>> keyMap;
if (keyMap.isEmpty()) {
keyMap << QPair(tr("Mouse"), tr("Select screenshot area"));
@@ -378,6 +386,10 @@ void CaptureWidget::initHelpMessage()
QString shortcut = ConfigHandler().shortcut(
QVariant::fromValue(toolType).toString());
shortcut.replace("Return", "Enter");
+#ifdef Q_OS_HAIKU
+ if (ctrlKey==0x5c)
+ shortcut.replace("Ctrl", "Alt");
+#endif
if (!shortcut.isEmpty()) {
keyMap << QPair(shortcut, tool->description());
}
--
2.30.2