- version 0.9.6 - fixes desktop file creation + settings file location
This commit is contained in:
parent
81765e136f
commit
d99d8f7f84
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#define APP_VERSION_MAJOR 0
|
#define APP_VERSION_MAJOR 0
|
||||||
#define APP_VERSION_MINOR 9
|
#define APP_VERSION_MINOR 9
|
||||||
#define APP_VERSION_SUFFIX 5
|
#define APP_VERSION_SUFFIX 6
|
||||||
|
|
||||||
//#ifdef TARGET_OSX
|
//#ifdef TARGET_OSX
|
||||||
#define ICONS ":/assets/images"
|
#define ICONS ":/assets/images"
|
||||||
|
|||||||
@ -10,9 +10,8 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
helper::theme::applyCurrent(Settings::instance());
|
|
||||||
|
|
||||||
app.setApplicationName(APPNAME);
|
app.setApplicationName(APPNAME);
|
||||||
|
helper::theme::applyCurrent(Settings::instance());
|
||||||
auto& settings = Settings::instance();
|
auto& settings = Settings::instance();
|
||||||
QFont f;
|
QFont f;
|
||||||
if (settings.data().count(KEY_APP_FONT) > 0)
|
if (settings.data().count(KEY_APP_FONT) > 0)
|
||||||
|
|||||||
@ -1556,7 +1556,13 @@ void MainWindow::showMainWindow()
|
|||||||
void MainWindow::setupAppMenu()
|
void MainWindow::setupAppMenu()
|
||||||
{
|
{
|
||||||
#if defined(TARGET_LINUX)
|
#if defined(TARGET_LINUX)
|
||||||
appmenu::install(QCoreApplication::applicationFilePath().toStdString());
|
auto exe_path = QFileInfo(QCoreApplication::arguments().front()).absoluteFilePath();
|
||||||
|
const char* appimage = std::getenv("APPIMAGE");
|
||||||
|
if (appimage != nullptr)
|
||||||
|
exe_path = appimage;
|
||||||
|
|
||||||
|
qDebug() << "Found exe path: " << exe_path;
|
||||||
|
appmenu::install(exe_path.toStdString());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -98,8 +98,21 @@ static fs::path appmenu_install_dir()
|
|||||||
|
|
||||||
void appmenu::install(const std::string& path_to_me)
|
void appmenu::install(const std::string& path_to_me)
|
||||||
{
|
{
|
||||||
|
auto path_to_desktop = appmenu_install_dir() / NOO_DESKTOP_NAME;
|
||||||
|
|
||||||
|
// Check if app is installed already.
|
||||||
|
// The code below checks for path to app; as this app is distributed as .AppImage with version numbers - every new version will trigger desktop file rewriting
|
||||||
|
std::ifstream ifs(path_to_desktop);
|
||||||
|
std::string content((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
|
||||||
|
if (content.find(path_to_me) != std::string::npos)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Remove old one
|
||||||
|
std::string uninstall_cmd = "/usr/bin/xdg-desktop-menu uninstall --novendor " + (appmenu_install_dir() / NOO_DESKTOP_NAME).string();
|
||||||
|
system(uninstall_cmd.c_str());
|
||||||
|
|
||||||
// Put .desktop file to ~/.config/autostart
|
// Put .desktop file to ~/.config/autostart
|
||||||
std::ofstream ofs(appmenu_install_dir() / NOO_DESKTOP_NAME);
|
std::ofstream ofs(path_to_desktop);
|
||||||
if (ofs.is_open())
|
if (ofs.is_open())
|
||||||
{
|
{
|
||||||
ofs << fixup_desktop_file(read_desktop_file(), path_to_me);
|
ofs << fixup_desktop_file(read_desktop_file(), path_to_me);
|
||||||
@ -126,6 +139,9 @@ void appmenu::install(const std::string& path_to_me)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string install_cmd = "/usr/bin/xdg-desktop-menu install --novendor " + (appmenu_install_dir() / NOO_DESKTOP_NAME).string();
|
||||||
|
system(install_cmd.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void appmenu::uninstall()
|
void appmenu::uninstall()
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
{
|
{
|
||||||
@ -27,7 +28,8 @@ void Settings::save()
|
|||||||
auto path = helper::path::pathToSettings();
|
auto path = helper::path::pathToSettings();
|
||||||
QSettings settings(path, QSettings::IniFormat);
|
QSettings settings(path, QSettings::IniFormat);
|
||||||
settings.clear();
|
settings.clear();
|
||||||
for (const QString& e: data().keys())
|
|
||||||
|
for (const QString& e: mData.keys())
|
||||||
{
|
{
|
||||||
settings.setValue(e, data().value(e));
|
settings.setValue(e, data().value(e));
|
||||||
}
|
}
|
||||||
@ -42,6 +44,8 @@ void Settings::load()
|
|||||||
// Path to settings file
|
// Path to settings file
|
||||||
QString path = helper::path::pathToSettings();
|
QString path = helper::path::pathToSettings();
|
||||||
|
|
||||||
|
qDebug() << "Settings file path: " << path;
|
||||||
|
|
||||||
// Check if directory exists at all
|
// Check if directory exists at all
|
||||||
QString dir = QFileInfo(path).absoluteDir().path();
|
QString dir = QFileInfo(path).absoluteDir().path();
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
# I use this script on two different hosts so there are logic to find proper Qt installation
|
# I use this script on two different hosts so there are logic to find proper Qt installation
|
||||||
|
|
||||||
export QT_HOME=/home/$USER/qt/5.12.10/gcc_64
|
export QT_HOME=/home/$USER/qt5.15/5.15.2/gcc_64
|
||||||
if [ ! -d "$QT_HOME" ] ; then
|
if [ ! -d "$QT_HOME" ] ; then
|
||||||
export QT_HOME=/home/$USER/qt5/5.12.12/gcc_64
|
export QT_HOME=/home/$USER/qt5.15/5.15.2/gcc_64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build .appimage
|
# Build .appimage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user