Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux port v0.1.0 #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ deployment/Strategr_x86.iss

# gh-pages files
_include
appcast.xml
appcast.xml
build
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ set(CMAKE_CXX_STANDARD 17)
set(Boost_USE_STATIC_LIBS ON)

find_package(Boost COMPONENTS filesystem REQUIRED)
find_package(catch2 REQUIRED)
# find_package(catch2 REQUIRED)
find_package(Catch2 REQUIRED)
find_package(Qt5 COMPONENTS Widgets Test REQUIRED)

find_library(utf8Proc_LIBRARY_PATH libutf8proc.a utf8proc.lib utf8proc)
Expand All @@ -22,6 +23,10 @@ if (WIN32)
find_library(WinSparkle_PATH WinSparkle)
endif ()

if (UNIX)
add_compile_options("-fpermissive")
endif ()

include_directories(.)
include_directories(models)
include_directories(models/apple)
Expand Down
14 changes: 7 additions & 7 deletions models/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ namespace stg {
hue = hue * 360 / 60;

auto chroma = (1 - std::abs(2 * lightness - 1)) * saturation;
auto x = chroma * (1 - std::abs(std::fmodf(hue, 2) - 1));
auto x = chroma * (1 - std::abs(fmodf(hue, 2) - 1));

auto rgb = std::array<float, 3>();

if (std::ceilf(hue) == 1) {
if (std::ceil(hue) == 1) {
rgb = {chroma, x, 0};
} else if (std::ceilf(hue) == 2) {
} else if (std::ceil(hue) == 2) {
rgb = {x, chroma, 0};
} else if (std::ceilf(hue) == 3) {
} else if (std::ceil(hue) == 3) {
rgb = {0, chroma, x};
} else if (std::ceilf(hue) == 4) {
} else if (std::ceil(hue) == 4) {
rgb = {0, x, chroma};
} else if (std::ceilf(hue) == 5) {
} else if (std::ceil(hue) == 5) {
rgb = {x, 0, chroma};
} else if (std::ceilf(hue) == 6) {
} else if (std::ceil(hue) == 6) {
rgb = {chroma, 0, x};
}

Expand Down
4 changes: 2 additions & 2 deletions ui/aboutwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//

#include <QDate>
#include <QDesktopServices.h>
#include <QUrl.h>
#include <QDesktopServices>
#include <QUrl>

#include "aboutwindow.h"
#include "applicationicon.h"
Expand Down
5 changes: 3 additions & 2 deletions ui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ auto Application::theme() -> const stg::theme & {
return theme;
}

#ifdef Q_OS_WIN

void Application::checkForUpdates() {
#ifdef Q_OS_WIN
win_sparkle_check_update_with_ui();
#endif

}

#endif
1 change: 1 addition & 0 deletions ui/overviewwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

#include <QPainter>
#include <QPainterPath>
#include <QScrollBar>
#include <QMouseEvent>

Expand Down
43 changes: 23 additions & 20 deletions utility/notifierbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,33 @@
#include "application.h"
#include "applicationicon.h"

#ifdef Q_OS_WIN

#ifndef Q_OS_MAC
#include <QSystemTrayIcon>
#endif

#ifdef Q_OS_WIN
#include <Windows.h>
#include <QtWinExtras>
#endif

#ifdef Q_OS_UNIX
#include <QIcon>
#endif

#ifdef Q_OS_WIN
#ifndef Q_OS_MAC
NotifierBackend::NotifierBackend() {

if (!Application::trayIcon) {
Application::trayIcon = new QSystemTrayIcon();
if (!Application::trayIcon) {
Application::trayIcon = new QSystemTrayIcon();

auto hInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
auto hicon = static_cast<HICON>(LoadIcon(hInstance,"IDI_ICON1"));
auto icon = QtWin::fromHICON(hicon);
// auto pmap = QPixmap(22, 22);
// pmap.fill();
// auto icon = QIcon(pmap);
auto icon = QIcon("Strategr.ico");

Application::trayIcon->setIcon(icon);
Application::trayIcon->show();
}
Application::trayIcon->setIcon(icon);
Application::trayIcon->show();
}

}
#endif
Expand All @@ -38,15 +45,11 @@ NotifierBackend::NotifierBackend() {
#ifndef Q_OS_MAC

void NotifierBackend::sendMessage(const QString &title, const QString &message) {
#ifdef Q_OS_WIN

if (Application::trayIcon && QSystemTrayIcon::supportsMessages()) {
Application::trayIcon->showMessage(title, message, ApplicationIcon::defaultIcon(), 10000);
} else {
std::cout << "Error: Can't send notification\n";
}

#endif
if (Application::trayIcon && QSystemTrayIcon::supportsMessages()) {
Application::trayIcon->showMessage(title, message, ApplicationIcon::defaultIcon(), 10000);
} else {
std::cout << "Error: Can't send notification\n";
}
}

#endif