some refactore

This commit is contained in:
2026-02-05 14:33:19 +01:00
parent ce0643b6ac
commit 64b3babd3d
27 changed files with 239 additions and 141 deletions

View File

@@ -2,6 +2,7 @@
#include <memory>
#include <spdlog/spdlog.h>
#include "components/button/iconButton.hpp"
#include "glibmm/datetime.h"
#include "glibmm/fileutils.h"
@@ -85,12 +86,8 @@ void CopyNotification::createImageNotification(NotifyMessage notify) {
auto buttonBox = Gtk::make_managed<Gtk::Box>();
buttonBox->set_spacing(10);
// material icons unicode
auto saveToClipboardLabel = Gtk::make_managed<Gtk::Label>("\uF0EA"); // content copy icon
auto saveToFileLabel = Gtk::make_managed<Gtk::Label>("\uF1C5"); // save icon
auto saveToClipboardButton = Gtk::make_managed<Gtk::Button>();
saveToClipboardButton->set_child(*saveToClipboardLabel);
auto saveToClipboardButton = Gtk::make_managed<IconButton>(Icon::CONTENT_COPY);
saveToClipboardButton->signal_clicked().connect([this]() {
copyToClipboard(this->copiedImage);
spdlog::info("Copied image to clipboard");
@@ -101,8 +98,7 @@ void CopyNotification::createImageNotification(NotifyMessage notify) {
saveToClipboardButton->add_css_class("notification-button");
saveToClipboardButton->add_css_class("notification-icon-button");
auto saveToFileButton = Gtk::make_managed<Gtk::Button>();
saveToFileButton->set_child(*saveToFileLabel);
auto saveToFileButton = Gtk::make_managed<IconButton>(Icon::SAVE);
saveToFileButton->signal_clicked().connect([this]() {
// xdg-pic/screenshot // use env
auto xdgPicturesDir = Glib::get_user_special_dir(Glib::UserDirectory::PICTURES);
@@ -136,9 +132,7 @@ void CopyNotification::createTextNotification(NotifyMessage notify) {
textLabel->set_margin_bottom(10);
contentBox->append(*textLabel);
auto copyToClipboardButton = Gtk::make_managed<Gtk::Button>();
auto copyToClipboardLabel = Gtk::make_managed<Gtk::Label>("\uF0EA"); // content copy icon
copyToClipboardButton->set_child(*copyToClipboardLabel);
auto copyToClipboardButton = Gtk::make_managed<IconButton>(Icon::CONTENT_COPY);
copyToClipboardButton->signal_clicked().connect([this]() {
copyToClipboard(this->copiedText);
this->signal_close.emit(this->notificationId);