Skip to content

Commit

Permalink
Qt update
Browse files Browse the repository at this point in the history
  • Loading branch information
rcaelers committed Jan 3, 2025
1 parent a3d2a07 commit 959109c
Show file tree
Hide file tree
Showing 30 changed files with 1,501 additions and 80 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,7 @@ if (WITH_CRASHPAD)
)
FetchContent_MakeAvailable(dump_syms)


set(DUMP_SYMS ${dump_syms_SOURCE_DIR}/target/release/dump_syms.exe)
add_custom_target(dump_syms ALL DEPENDS ${DUMP_SYMS})
add_custom_command(
Expand All @@ -1036,6 +1037,8 @@ if (WITH_CRASHPAD)
WORKING_DIRECTORY ${dump_syms_SOURCE_DIR}
)


# --target x86_64-pc-windows-gnu
set(HAVE_CRASHPAD ON)
set(HAVE_CRASH_REPORT ON)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down
2 changes: 1 addition & 1 deletion libs/updater/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (HAVE_UNFOLD_AUTO_UPDATE)
"Auto-update framework"
"MIT"
GIT_REPOSITORY https://github.com/rcaelers/unfold.git
GIT_TAG abc833f80b39e256c4a6ab88917ba0a223d0a1fd
GIT_TAG b6519c96d062aad4826b44afa59a624558cfb9dd
)
if(NOT unfold_POPULATED)
FetchContent_MakeAvailable(unfold)
Expand Down
4 changes: 4 additions & 0 deletions ui/app/Application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,8 @@ Application::hide_break_window()
TRACE_ENTRY();
active_break_id = BREAK_ID_NONE;

spdlog::info("Hide break window");

for (auto &window: prelude_windows)
{
window->stop();
Expand All @@ -504,6 +506,7 @@ Application::hide_break_window()
prelude_windows.clear();

toolkit->get_locker()->unlock();
spdlog::info("Unlocking screen");
}

void
Expand All @@ -529,6 +532,7 @@ Application::show_break_window()
if (!break_windows.empty() && GUIConfig::block_mode()() != BlockMode::Off)
{
TRACE_MSG("Locking screen");
spdlog::info("Locking screen");
toolkit->get_locker()->lock();
}
}
Expand Down
3 changes: 3 additions & 0 deletions ui/app/Menus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ Menus::on_menu_restbreak_now()
void
Menus::on_menu_about()
{
// int *p = NULL;
// *p = 1;
toolkit->show_window(IToolkit::WindowType::About);
}

void
Menus::on_menu_quit()
{
spdlog::info("Quitting Workrave");
app->get_toolkit()->terminate();
}

Expand Down
43 changes: 42 additions & 1 deletion ui/app/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ init_logging()
logger->flush_on(spdlog::level::critical);
spdlog::set_default_logger(logger);

spdlog::set_level(spdlog::level::info);
spdlog::set_level(spdlog::level::debug);
spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%n] [%^%-5l%$] %v");
spdlog::info("Workrave started");
spdlog::info("Log file: {}", log_file.string());
Expand All @@ -88,12 +88,53 @@ init_logging()
#endif
}

static void
update_keymap()
{
HKL current_layout;
BOOL changed = FALSE;
int i;

const int MAXSIZE = 32;
HKL layout_handles[MAXSIZE];
int n_layouts = GetKeyboardLayoutList(0, nullptr); // this doesn't work on Win7 64Bit
if (n_layouts <= 0 || n_layouts > MAXSIZE)
{
n_layouts = GetKeyboardLayoutList(MAXSIZE, layout_handles); // this seems be slow on some systems
}
else
{
GetKeyboardLayoutList(n_layouts, layout_handles);
}

spdlog::info("size = {}", n_layouts);

current_layout = GetKeyboardLayout(0);

spdlog::info("size = {}", (void *)current_layout);

for (i = 0; i < n_layouts; ++i)
{
HKL hkl = layout_handles[i];

ActivateKeyboardLayout(hkl, 0);

char layout_name[KL_NAMELENGTH];
GetKeyboardLayoutNameA(layout_name);
spdlog::info("name = {}", layout_name);
}

ActivateKeyboardLayout(current_layout, 0);
}

int
run(int argc, char **argv)
{
init_logging();
TRACE_ENTRY();

update_keymap();

#if defined(HAVE_CRASH_REPORT)
try
{
Expand Down
4 changes: 3 additions & 1 deletion ui/app/platforms/windows/WindowsHarpoonLocker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

#include <cstdint>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
Expand Down Expand Up @@ -57,6 +58,7 @@ WindowsHarpoonLocker::prepare_lock()
text.resize(GetWindowTextLengthA(active_window));
GetWindowTextA(active_window, text.data(), text.size() + 1);
TRACE_MSG("Save active window: {}", text);
spdlog::info("Save active window: {} {}", text, reinterpret_cast<intptr_t>(active_window));
}

void
Expand All @@ -77,7 +79,7 @@ WindowsHarpoonLocker::unlock()
text.resize(GetWindowTextLengthA(active_window));
GetWindowTextA(active_window, text.data(), text.size() + 1);
TRACE_MSG("Restore active window: {}", text);

spdlog::info("Restore active window: {} {}", text, reinterpret_cast<intptr_t>(active_window));
SetForegroundWindow(active_window);
active_window = nullptr;
}
Expand Down
3 changes: 0 additions & 3 deletions ui/app/toolkits/gtkmm/AutoUpdateDialog.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public:
void set_status(std::string status);
void start_install();

private:
void on_auto_toggled();

private:
update_choice_callback_t callback;
Gtk::TextView *text_view{nullptr};
Expand Down
Loading

0 comments on commit 959109c

Please sign in to comment.