Skip to content
Merged
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
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(NOT APPLE)
add_subdirectory(cmake/corrosion-rs)
endif()
add_subdirectory(cmake/corrosion-rs)

if(APPLE)
enable_language(Swift)
Expand Down Expand Up @@ -148,6 +146,7 @@ if(APPLE)
endif()

add_subdirectory(src/engine)
add_subdirectory(src/platform)
add_subdirectory(src/frontend)
add_subdirectory(src/shared)

Expand Down
6 changes: 3 additions & 3 deletions src/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include_directories(../shared 3rdParty macOS)
include_directories(../shared ../platform/include 3rdParty macOS)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
Expand All @@ -21,7 +21,7 @@ set(SRC_MAIN main.cpp
AvroPhonetic.cpp
PlatformConfig.cpp)

set(LINK_LIBS libShared Qt5::Widgets Qt5::Network)
set(LINK_LIBS libShared Qt5::Widgets Qt5::Network platform)

if(OS_LINUX)
list(APPEND LINK_LIBS ${ZSTD_LIBRARIES})
Expand All @@ -38,7 +38,7 @@ endif(WIN32)
if(APPLE)
add_subdirectory(macOS)

list(APPEND LINK_LIBS macOS "-framework Foundation" zstd::libzstd)
list(APPEND LINK_LIBS macOS "-framework Foundation" "-framework AppKit" zstd::libzstd)
endif(APPLE)

if(APPLE)
Expand Down
7 changes: 4 additions & 3 deletions src/frontend/TopBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ TopBar::TopBar(bool darkIcon, QWidget *parent) :
gLayout = new Layout();

if(darkIcon) {
m_iconTheme = "black";
} else {
m_iconTheme = "white";
} else {
m_iconTheme = "black";
}

/* Dialogs */
Expand All @@ -79,7 +79,8 @@ TopBar::TopBar(bool darkIcon, QWidget *parent) :
});

auto set_icon = [&](QPushButton* obj, QString icon) {
obj->setIcon(QIcon(":/images/" + m_iconTheme + "/" + icon + ".svg"));
// TODO: Change this logic if we ever have white theme for TopBar
obj->setIcon(QIcon(":/images/" + QString("white") + "/" + icon + ".svg"));
};
set_icon(ui->buttonSetLayout, "layouts");
set_icon(ui->buttonViewLayout, "layout");
Expand Down
12 changes: 4 additions & 8 deletions src/frontend/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "PlatformConfig.h"
#include "Log.h"
#include "FileSystem.h"
#include "platform.h"

#ifdef Q_OS_MACOS
#include "macOS.h"
Expand All @@ -43,10 +44,8 @@ int main(int argc, char *argv[]) {
parser.setApplicationDescription("OpenBangla Keyboard");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption darkIcon("dark","Enable dark theme support");
QCommandLineOption startInTray("tray","Start in tray");
QCommandLineOption setupSystem("setup-system","Setup OpenBangla input source");
parser.addOption(darkIcon);
parser.addOption(startInTray);
parser.addOption(setupSystem);
parser.process(app);
Expand All @@ -72,12 +71,9 @@ int main(int argc, char *argv[]) {

instance.listen(name);

// Detect Dark Mode
QPalette palette = app.palette();
QColor color = palette.color(QPalette::Button);
QColor darker = QColor::fromRgb(55, 55, 55); // Grayish color used for button in dark mode

bool darkMode = (color == darker) || parser.isSet(darkIcon);
// Detect Dark Mode via the OS color scheme (platform crate).
bool darkMode = (get_system_theme() == Dark);
LOG_INFO("System Theme Dark Mode: %s\n", darkMode ? "true" : "false");

TopBar w(darkMode);
if (parser.isSet(startInTray))
Expand Down
5 changes: 5 additions & 0 deletions src/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
corrosion_import_crate(
MANIFEST_PATH Cargo.toml
CRATE_TYPES staticlib
CRATES platform
)
Loading
Loading