Compare commits
No commits in common. "master" and "v0.1.15" have entirely different histories.
@ -1,12 +1,10 @@
|
||||
#include "audio_support.h"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QSound>
|
||||
|
||||
extern void play_audio(const app_settings::selected_audio& item)
|
||||
{
|
||||
// Play audio
|
||||
|
||||
if (item.name != Audio_Empty && item.name != Audio_Custom)
|
||||
{
|
||||
// Find bundled audio
|
||||
@ -18,7 +16,4 @@ extern void play_audio(const app_settings::selected_audio& item)
|
||||
if (item.name == Audio_Custom && !item.path.isEmpty())
|
||||
QSound::play(item.path);
|
||||
}
|
||||
#else
|
||||
extern void play_audio(const app_settings::selected_audio& item)
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
// App version
|
||||
#define QBREAK_VERSION_MAJOR 0
|
||||
#define QBREAK_VERSION_MINOR 1
|
||||
#define QBREAK_VERSION_SUFFIX 17
|
||||
#define QBREAK_VERSION_SUFFIX 15
|
||||
|
||||
// How often UI is updated - interval in seconds
|
||||
#define INTERVAL_UPDATE_UI (10)
|
||||
#define INTERVAL_UPDATE_UI (15)
|
||||
|
||||
// How often progress bar is updated - interval in milliseconds
|
||||
#define INTERVAL_UPDATE_PROGRESS (1000)
|
||||
|
||||
@ -210,7 +210,6 @@ int get_idle_time_kde_wayland()
|
||||
|
||||
#endif
|
||||
|
||||
static bool Warning_X11InWayland = false;
|
||||
int get_idle_time_dynamically()
|
||||
{
|
||||
const char* wl_display = std::getenv("WAYLAND_DISPLAY");
|
||||
@ -236,14 +235,8 @@ int get_idle_time_dynamically()
|
||||
#else
|
||||
// Restrict to X11
|
||||
if (wl_display)
|
||||
{
|
||||
// One time error message
|
||||
if (!Warning_X11InWayland) {
|
||||
qDebug() << "Wayland is found, but app built for X11 only. Idle tracking is not supported.";
|
||||
Warning_X11InWayland = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return get_idle_time_x11();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -12,46 +12,25 @@
|
||||
#include <QAction>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <QSvgGenerator>
|
||||
#include <QPalette>
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
#include <QFileInfo>
|
||||
#include <QSound>
|
||||
#include <QCommandLineOption>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDateTime>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
# include <QDesktopWidget>
|
||||
# include <QSound>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
static void dispatchToMainThread(std::function<void()> callback, std::chrono::milliseconds delay = std::chrono::milliseconds(0))
|
||||
{
|
||||
// any thread
|
||||
QTimer* timer = new QTimer();
|
||||
timer->moveToThread(qApp->thread());
|
||||
timer->setSingleShot(true);
|
||||
timer->setInterval(delay);
|
||||
QObject::connect(timer, &QTimer::timeout, [=]()
|
||||
{
|
||||
// main thread
|
||||
callback();
|
||||
timer->deleteLater();
|
||||
});
|
||||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, 0));
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Defer init call for 100 ms - attempt to resolve the problem with non working setTooltip()
|
||||
dispatchToMainThread([this](){init();}, std::chrono::milliseconds(100));
|
||||
init();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -149,11 +128,11 @@ static int str_to_seconds(const QString& s)
|
||||
throw std::runtime_error("Bad parameter value.");
|
||||
|
||||
if (s.back() == 'h')
|
||||
return s.left(s.size()-1).toInt() * 3600;
|
||||
return s.leftRef(s.size()-1).toInt() * 3600;
|
||||
if (s.back() == 'm')
|
||||
return s.left(s.size()-1).toInt() * 60;
|
||||
return s.leftRef(s.size()-1).toInt() * 60;
|
||||
if (s.back() == 's')
|
||||
return s.left(s.size()-1).toInt();
|
||||
return s.leftRef(s.size()-1).toInt();
|
||||
|
||||
if (s.back().isDigit())
|
||||
return s.toInt();
|
||||
@ -286,11 +265,10 @@ void MainWindow::createTrayIcon()
|
||||
|
||||
mTrayIcon->setContextMenu(menu);
|
||||
mTrayIcon->setIcon(getTrayIcon());
|
||||
// mTrayIcon->setToolTip(AppName);
|
||||
mTrayIcon->setToolTip(AppName);
|
||||
mTrayIcon->show();
|
||||
connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
this, SLOT(onTrayIconActivated(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
mTrayIcon->show();
|
||||
}
|
||||
|
||||
static int msec2min(int msec)
|
||||
@ -315,6 +293,20 @@ QString state2str(AppState state)
|
||||
return QString();
|
||||
}
|
||||
|
||||
static void dispatchToMainThread(std::function<void()> callback)
|
||||
{
|
||||
// any thread
|
||||
QTimer* timer = new QTimer();
|
||||
timer->moveToThread(qApp->thread());
|
||||
timer->setSingleShot(true);
|
||||
QObject::connect(timer, &QTimer::timeout, [=]()
|
||||
{
|
||||
// main thread
|
||||
callback();
|
||||
timer->deleteLater();
|
||||
});
|
||||
QMetaObject::invokeMethod(timer, "start", Qt::QueuedConnection, Q_ARG(int, 0));
|
||||
}
|
||||
|
||||
void MainWindow::shiftTo(AppState newState)
|
||||
{
|
||||
@ -353,6 +345,7 @@ void MainWindow::shiftTo(AppState newState)
|
||||
dispatchToMainThread([this](){
|
||||
onUpdateUI();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::onUpdateUI()
|
||||
|
||||
@ -59,3 +59,5 @@ Release: DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
# When using wayland:
|
||||
# unix:LIBS += -L/usr/local/lib \
|
||||
# -lwayland-client-unstable++ -lwayland-client-extra++ -lwayland-client++
|
||||
|
||||
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# I use this script on two different hosts so there are logic to find proper Qt installation
|
||||
|
||||
export QT_HOME=/home/$USER/tools/qt/6.8.0/gcc_64
|
||||
if [ ! -d "$QT_HOME" ] ; then
|
||||
export QT_HOME=/home/$USER/tools/qt/6.8.0/gcc_64
|
||||
fi
|
||||
|
||||
# Build .appimage
|
||||
/usr/bin/python3 build_qbreak.py release
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# I use this script on two different hosts so there are logic to find proper Qt installation
|
||||
|
||||
export QT_HOME=/home/$USER/tools/qt/6.8.0/gcc_64
|
||||
if [ ! -d "$QT_HOME" ] ; then
|
||||
export QT_HOME=/home/$USER/tools/qt/6.8.0/gcc_64
|
||||
fi
|
||||
|
||||
# Build .appimage
|
||||
/usr/bin/python3 build_qbreak.py debug
|
||||
|
||||
@ -84,7 +84,7 @@ if platform.system() == 'Linux':
|
||||
'-qmake=' + os.environ['QT_HOME'] + '/bin/qmake',
|
||||
'-unsupported-allow-new-glibc',
|
||||
#'-no-translations',
|
||||
'-extra-plugins=iconengines,platformthemes/libqgtk3.so,platforms/libqxcb.so'
|
||||
'-extra-plugins=iconengines,platformthemes/libqgtk3.so'
|
||||
]
|
||||
|
||||
desktop_path = 'appimage_dir/usr/share/applications/qbreak.desktop'
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user