appimage fixes
This commit is contained in:
parent
31b058e63e
commit
ee5a0017ea
|
@ -9,7 +9,10 @@ private:
|
||||||
int32_t posx = -1;
|
int32_t posx = -1;
|
||||||
int32_t posy = -1;
|
int32_t posy = -1;
|
||||||
|
|
||||||
|
static std::string pathbase;
|
||||||
public:
|
public:
|
||||||
|
static void setPathBase(const std::string& pa);
|
||||||
|
|
||||||
Matcher(const std::string& filename);
|
Matcher(const std::string& filename);
|
||||||
Matcher(const cv::Mat& templ);
|
Matcher(const cv::Mat& templ);
|
||||||
~Matcher();
|
~Matcher();
|
||||||
|
|
|
@ -98,7 +98,11 @@ unix {
|
||||||
$$MOC_DIR/lolautoaccept.svg.commands = touch $$MOC_DIR/lolautoaccept.svg
|
$$MOC_DIR/lolautoaccept.svg.commands = touch $$MOC_DIR/lolautoaccept.svg
|
||||||
|
|
||||||
appimg.depends = $$PWD/linuxdeploy-x86_64.AppImage $${TARGET} $$MOC_DIR/lolautoaccept.svg
|
appimg.depends = $$PWD/linuxdeploy-x86_64.AppImage $${TARGET} $$MOC_DIR/lolautoaccept.svg
|
||||||
appimg.commands = rm -rf AppDir ; mkdir -p AppDir/ts; cp $$PWD/ts/*.qm ./AppDir/ts ; ./linuxdeploy-x86_64.AppImage --appdir=AppDir -e lolautoaccept -i $$MOC_DIR/lolautoaccept.svg -d lolautoaccept.desktop --output appimage
|
appimg.commands = rm -rf AppDir ; \
|
||||||
|
mkdir -p AppDir/ts AppDir/imgs; \
|
||||||
|
cp $$PWD/ts/*.qm ./AppDir/ts ; \
|
||||||
|
cp $$PWD/imgs/*.png ./AppDir/imgs; \
|
||||||
|
./linuxdeploy-x86_64.AppImage --appdir=AppDir -e lolautoaccept -i $$MOC_DIR/lolautoaccept.svg -d lolautoaccept.desktop --output appimage
|
||||||
|
|
||||||
QMAKE_EXTRA_TARGETS += appimg $$PWD/linuxdeploy-x86_64.AppImage $$MOC_DIR/lolautoaccept.svg
|
QMAKE_EXTRA_TARGETS += appimg $$PWD/linuxdeploy-x86_64.AppImage $$MOC_DIR/lolautoaccept.svg
|
||||||
|
|
||||||
|
|
28
src/main.cpp
28
src/main.cpp
|
@ -1,6 +1,9 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
|
@ -9,6 +12,20 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "lolautoaccept.h"
|
#include "lolautoaccept.h"
|
||||||
|
|
||||||
|
static std::string getBaseString(char** argv) {
|
||||||
|
std::string base;
|
||||||
|
|
||||||
|
char* appbase = getenv("APPDIR");
|
||||||
|
if(appbase) {
|
||||||
|
return std::string(appbase) + '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
char* cresolved = realpath(argv[0], NULL);
|
||||||
|
std::string resolved(cresolved);
|
||||||
|
free(cresolved);
|
||||||
|
return resolved.substr(0, resolved.rfind('/')+1);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
Log::init();
|
Log::init();
|
||||||
Log::setConsoleLogLevel(Log::Level::INFO);
|
Log::setConsoleLogLevel(Log::Level::INFO);
|
||||||
|
@ -20,10 +37,19 @@ int main(int argc, char** argv) {
|
||||||
Log::info << "Hello, World!";
|
Log::info << "Hello, World!";
|
||||||
Log::note << "Using Locale: " << QLocale().name().toStdString();
|
Log::note << "Using Locale: " << QLocale().name().toStdString();
|
||||||
|
|
||||||
|
if(argc == 0) {
|
||||||
|
Log::fatal << "arg[0] is not set";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string base = getBaseString(argv);
|
||||||
|
Log::info << "appbase: " << base;
|
||||||
|
Matcher::setPathBase(base);
|
||||||
|
|
||||||
LolAutoAccept lolaa;
|
LolAutoAccept lolaa;
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
if(translator.load(QLocale().name(), QLatin1String("ts"))) {
|
if(translator.load(QLocale().name(), QString::fromStdString(base + "ts"))) {
|
||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
} else {
|
} else {
|
||||||
Log::warn << "translation not found";
|
Log::warn << "translation not found";
|
||||||
|
|
|
@ -4,8 +4,14 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
std::string Matcher::pathbase;
|
||||||
|
|
||||||
|
void Matcher::setPathBase(const std::string& pa) {
|
||||||
|
pathbase = pa;
|
||||||
|
}
|
||||||
|
|
||||||
Matcher::Matcher(const std::string& filename) {
|
Matcher::Matcher(const std::string& filename) {
|
||||||
templ = cv::imread(filename, cv::IMREAD_UNCHANGED); // unchanged so alpha channel does not get dropped
|
templ = cv::imread(pathbase + filename, cv::IMREAD_UNCHANGED); // unchanged so alpha channel does not get dropped
|
||||||
maskFromTemplate();
|
maskFromTemplate();
|
||||||
}
|
}
|
||||||
Matcher::Matcher(const cv::Mat& templ) {
|
Matcher::Matcher(const cv::Mat& templ) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user