Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

Commit b9515f7

Browse files
authored
Merge pull request #4 from Soundux/rewrite
Merge Rewrite changes
2 parents 2452a1f + 2936832 commit b9515f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1004
-652
lines changed

.github/workflows/build_linux.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
on:
22
push:
3-
branches: [master]
43
paths-ignore:
54
- "**/README.md"
65
- "**/build_windows.yml"
76
pull_request:
8-
branches: [master]
97

108
name: Build on Linux
119
jobs:

.github/workflows/build_windows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
on:
22
push:
3-
branches: [master]
43
paths-ignore:
54
- "**/README.md"
65
- "**/build_linux.yml"
76
pull_request:
8-
branches: [master]
97

108
name: Build on Windows
119
jobs:

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
cmake_minimum_required(VERSION 3.1)
2-
project(tray VERSION 0.1 DESCRIPTION "A cross-platform C++ system tray library")
2+
project(tray VERSION 0.2 DESCRIPTION "A cross-platform C++ system tray library")
33

44
file(GLOB src
5-
"src/*.cpp"
6-
"src/*/*.cpp"
7-
"src/*/*/*.cpp"
5+
"tray/main.cpp"
6+
"tray/src/*.cpp"
7+
"tray/src/*/*.cpp"
8+
"tray/src/*/*/*.cpp"
89
)
910

1011
add_library(tray STATIC ${src})
@@ -15,12 +16,11 @@ if (UNIX)
1516
pkg_check_modules(APPINDICATOR REQUIRED appindicator3-0.1)
1617

1718
target_link_libraries(tray INTERFACE ${GTK3_LIBRARIES} ${APPINDICATOR_LIBRARIES})
18-
target_compile_options(tray INTERFACE -Wall -Wextra -Werror -pedantic -Wno-unused-lambda-capture)
19+
target_compile_options(tray PRIVATE -Wall -Wextra -Werror -pedantic -Wno-unused-lambda-capture)
1920
target_include_directories(tray SYSTEM PUBLIC ${GTK3_INCLUDE_DIRS} ${APPINDICATOR_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
2021
endif()
2122

22-
target_include_directories(tray SYSTEM PUBLIC "src/")
23-
target_include_directories(tray SYSTEM PUBLIC "lib/json/single_include/nlohmann")
23+
target_include_directories(tray SYSTEM PUBLIC "tray/include")
2424

2525
target_compile_features(tray PUBLIC cxx_std_17)
2626
set_target_properties(tray PROPERTIES CMAKE_CXX_STANDARD 17)

example/simple/CMakeLists.txt

100644100755
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
cmake_minimum_required(VERSION 3.1)
2-
project(tray-example VERSION 0.1)
3-
4-
add_executable(tray-example "main.cpp")
5-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../../example_build EXCLUDE_FROM_ALL)
6-
target_link_libraries(tray-example tray)
7-
8-
target_compile_features(tray-example PUBLIC cxx_std_17)
9-
set_target_properties(tray-example PROPERTIES CMAKE_CXX_STANDARD 17)
10-
set_target_properties(tray-example PROPERTIES CMAKE_CXX_EXTENSIONS Off)
11-
set_target_properties(tray-example PROPERTIES CMAKE_CXX_STANDARD_REQUIRED On)
12-
set_target_properties(tray-example PROPERTIES VERSION ${PROJECT_VERSION})
1+
cmake_minimum_required(VERSION 3.1)
2+
project(tray-example VERSION 0.1)
3+
4+
add_executable(tray-example "main.cpp")
5+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../ ${CMAKE_CURRENT_SOURCE_DIR}/../../example_build EXCLUDE_FROM_ALL)
6+
target_link_libraries(tray-example tray)
7+
8+
target_compile_features(tray-example PUBLIC cxx_std_17)
9+
set_target_properties(tray-example PROPERTIES CMAKE_CXX_STANDARD 17)
10+
set_target_properties(tray-example PROPERTIES CMAKE_CXX_EXTENSIONS Off)
11+
set_target_properties(tray-example PROPERTIES CMAKE_CXX_STANDARD_REQUIRED On)
12+
set_target_properties(tray-example PROPERTIES VERSION ${PROJECT_VERSION})
1313
set_target_properties(tray-example PROPERTIES PROJECT_NAME ${PROJECT_NAME})

example/simple/main.cpp

100644100755
Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
1-
#include "tray.hpp"
2-
#include <iostream>
3-
4-
int main()
5-
{
6-
#if defined(__linux__)
7-
Soundux::Tray tray(
8-
"TestTray", "icon.png",
9-
Soundux::TrayCheck("Test Check", false, [](bool state) { std::cout << "Checked: " << state << std::endl; }),
10-
Soundux::TrayCheck("Test Check 2", true, [](bool state) { std::cout << "Checked 2: " << state << std::endl; }));
11-
#elif defined(_WIN32)
12-
Soundux::Tray tray(
13-
"TestTray", "icon.ico" /*ICON_PATH, ICON_RESOURCE or HICON*/,
14-
Soundux::TrayCheck("Test Check", false, [](bool state) { std::cout << "Checked: " << state << std::endl; }),
15-
Soundux::TrayCheck("Test Check 2", true, [](bool state) { std::cout << "Checked 2: " << state << std::endl; }));
16-
#endif
17-
18-
tray.addItem(Soundux::TraySubmenu(
19-
"Submenu", Soundux::TrayButton("Some button",
20-
[]() { std::cout << "Submenu Button 1 pressed!" << std::endl; })))
21-
->addItem(
22-
Soundux::TrayButton("Another button", []() { std::cout << "Submenu Button 2 pressed!" << std::endl; }));
23-
24-
tray.addItem(Soundux::TrayButton("Exit", [&] { tray.exit(); }));
25-
26-
while (tray.run())
27-
{
28-
}
29-
30-
return 0;
1+
#include <iostream>
2+
#include <tray.hpp>
3+
4+
int main()
5+
{
6+
Tray::Tray tray("test", "icon.ico");
7+
8+
tray.addEntry(Tray::Button("Exit", [&] { tray.exit(); }));
9+
tray.addEntry(Tray::Button("Test"))->setDisabled(true);
10+
tray.addEntry(Tray::Seperator());
11+
tray.addEntry(Tray::Label("Test Label"));
12+
tray.addEntry(Tray::Toggle("Test Toggle", false, [](bool state) { printf("State: %i\n", state); }));
13+
14+
tray.addEntry(Tray::Seperator());
15+
tray.addEntry(Tray::Submenu("Test Submenu"))->addEntry(Tray::Button("Submenu button!"))->setDisabled(true);
16+
17+
tray.run();
18+
19+
return 0;
3120
}

src/tray.hpp

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/tray/linux/appindicator.cpp

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/tray/linux/appindicator.hpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/tray/tray.cpp

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)