-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,014 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"POT-Creation-Date: 2024-05-21 00:20-0400\n" | ||
"POT-Creation-Date: 2024-05-21 19:48-0400\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
org.nickvision.money.gnome/blueprints/account_settings_dialog.blp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Gtk 4.0; | ||
using Adw 1; | ||
|
||
Adw.Dialog root { | ||
content-width: 420; | ||
|
||
child: Adw.ToolbarView { | ||
[top] | ||
Adw.HeaderBar { | ||
title-widget: Adw.WindowTitle { | ||
title: _("Account Settings"); | ||
}; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef DIALOGBASE_H | ||
#define DIALOGBASE_H | ||
|
||
#include <string> | ||
#include <adwaita.h> | ||
|
||
namespace Nickvision::Money::GNOME::Helpers | ||
{ | ||
/** | ||
* @brief A base class for custom AdwDialogs with blueprints. | ||
*/ | ||
class DialogBase | ||
{ | ||
public: | ||
/** | ||
* @brief Constructs a DialogBase. | ||
* @param parent GtkWindow* | ||
* @param fileName The file name for the blueprint file of the dialog | ||
* @param rootName The name of the AdwDialog component in the blueprint file | ||
*/ | ||
DialogBase(GtkWindow* parent, const std::string& fileName, const std::string& rootName = "root"); | ||
/** | ||
* @brief Destructs a DialogBase. | ||
*/ | ||
~DialogBase(); | ||
/** | ||
* @brief Gets the underlying AdwDialog pointer. | ||
* @return AdwDialog* | ||
*/ | ||
AdwDialog* get(); | ||
/** | ||
* @brief Presents the AdwDialog. | ||
*/ | ||
void present() const; | ||
|
||
protected: | ||
GtkBuilder* m_builder; | ||
GtkWindow* m_parent; | ||
AdwDialog* m_dialog; | ||
}; | ||
} | ||
|
||
#endif //DIALOGBASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#ifndef DIALOGPTR_H | ||
#define DIALOGPTR_H | ||
|
||
#include <adwaita.h> | ||
#include "dialogbase.h" | ||
|
||
namespace Nickvision::Money::GNOME::Helpers | ||
{ | ||
template<typename T> | ||
concept DerivedDialogBase = std::is_base_of_v<DialogBase, T>; | ||
|
||
/** | ||
* @brief A pointer for a custom AdwDialog. | ||
* @brief Keeps the pointer alive until the dialog has closed. | ||
*/ | ||
template<DerivedDialogBase T> | ||
class DialogPtr | ||
{ | ||
public: | ||
/** | ||
* @brief Constructs a DialogPtr. | ||
* @param args The arguments to pass to T's constructor. | ||
*/ | ||
template<typename... Args> | ||
DialogPtr(Args... args) | ||
: m_ptr{ new T(args...) } | ||
{ | ||
g_signal_connect(m_ptr->get(), "closed", GCallback(+[](AdwDialog*, gpointer data){ delete reinterpret_cast<T*>(data); }), m_ptr); | ||
} | ||
/** | ||
* @brief Constructs a DialogPtr. | ||
* @brief The DialogPtr assumes ownership of ptr. | ||
* @param ptr T* | ||
*/ | ||
DialogPtr(T* ptr) | ||
: m_ptr{ ptr } | ||
{ | ||
g_signal_connect(m_ptr->get(), "closed", GCallback(+[](AdwDialog*, gpointer data){ delete reinterpret_cast<T*>(data); }), m_ptr); | ||
} | ||
/** | ||
* @brief Returns the underlying pointer. | ||
* @return T* | ||
*/ | ||
T* operator->() | ||
{ | ||
return m_ptr; | ||
} | ||
|
||
private: | ||
T* m_ptr; | ||
}; | ||
} | ||
|
||
#endif //DIALOGPTR_H |
29 changes: 29 additions & 0 deletions
29
org.nickvision.money.gnome/include/views/accountsettingsdialog.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef ACCOUNTSETTINGSDIALOG_H | ||
#define ACCOUNTSETTINGSDIALOG_H | ||
|
||
#include <memory> | ||
#include <adwaita.h> | ||
#include "controllers/accountsettingsdialogcontroller.h" | ||
#include "helpers/dialogbase.h" | ||
|
||
namespace Nickvision::Money::GNOME::Views | ||
{ | ||
/** | ||
* @brief A dialog for managing account settings. | ||
*/ | ||
class AccountSettingsDialog : public Helpers::DialogBase | ||
{ | ||
public: | ||
/** | ||
* @brief Constructs an AccountSettingsDialog. | ||
* @param controller AccountSettingsDialogController | ||
* @param parent The GtkWindow object of the parent window | ||
*/ | ||
AccountSettingsDialog(const std::shared_ptr<Shared::Controllers::AccountSettingsDialogController>& controller, GtkWindow* parent); | ||
|
||
private: | ||
std::shared_ptr<Shared::Controllers::AccountSettingsDialogController> m_controller; | ||
}; | ||
} | ||
|
||
#endif //ACCOUNTSETTINGSDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "helpers/dialogbase.h" | ||
#include "helpers/builder.h" | ||
|
||
namespace Nickvision::Money::GNOME::Helpers | ||
{ | ||
DialogBase::DialogBase(GtkWindow* parent, const std::string& fileName, const std::string& rootName) | ||
: m_builder{ BuilderHelpers::fromBlueprint(fileName) }, | ||
m_parent{ parent }, | ||
m_dialog{ ADW_DIALOG(gtk_builder_get_object(m_builder, rootName.c_str())) } | ||
{ | ||
|
||
} | ||
|
||
DialogBase::~DialogBase() | ||
{ | ||
adw_dialog_force_close(m_dialog); | ||
g_object_unref(m_builder); | ||
} | ||
|
||
AdwDialog* DialogBase::get() | ||
{ | ||
return m_dialog; | ||
} | ||
|
||
void DialogBase::present() const | ||
{ | ||
adw_dialog_present(m_dialog, GTK_WIDGET(m_parent)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
org.nickvision.money.gnome/src/views/accountsettingsdialog.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "views/accountsettingsdialog.h" | ||
#include <libnick/localization/gettext.h> | ||
|
||
using namespace Nickvision::Money::GNOME::Helpers; | ||
using namespace Nickvision::Money::Shared::Controllers; | ||
|
||
namespace Nickvision::Money::GNOME::Views | ||
{ | ||
AccountSettingsDialog::AccountSettingsDialog(const std::shared_ptr<AccountSettingsDialogController>& controller, GtkWindow* parent) | ||
: DialogBase{ parent, "account_settings_dialog" }, | ||
m_controller{ controller } | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.