diff --git a/org.nickvision.money.json b/org.nickvision.money.json index aad9dff34..2dad3dcb5 100644 --- a/org.nickvision.money.json +++ b/org.nickvision.money.json @@ -59,7 +59,7 @@ { "type": "git", "url": "https://github.com/nlogozzo/NickvisionMoney.git", - "tag": "2022.10.0-beta1" + "tag": "2022.10.0-beta2" } ] } diff --git a/org.nickvision.money.metainfo.xml b/org.nickvision.money.metainfo.xml index 07aa34dbc..4d0df1f27 100644 --- a/org.nickvision.money.metainfo.xml +++ b/org.nickvision.money.metainfo.xml @@ -24,7 +24,7 @@ org.nickvision.money - +

- Redesign with GTK4 and libadwaita 1.2

diff --git a/src/models/transaction.cpp b/src/models/transaction.cpp index 3420f1e89..7b445d140 100644 --- a/src/models/transaction.cpp +++ b/src/models/transaction.cpp @@ -47,6 +47,39 @@ RepeatInterval Transaction::getRepeatInterval() const return m_repeatInterval; } +std::string Transaction::getRepeatIntervalAsString() const +{ + if(m_repeatInterval == RepeatInterval::Never) + { + return "Never"; + } + else if(m_repeatInterval == RepeatInterval::Daily) + { + return "Daily"; + } + else if(m_repeatInterval == RepeatInterval::Weekly) + { + return "Weekly"; + } + else if(m_repeatInterval == RepeatInterval::Monthly) + { + return "Monthly"; + } + else if(m_repeatInterval == RepeatInterval::Quarterly) + { + return "Quarterly"; + } + else if(m_repeatInterval == RepeatInterval::Yearly) + { + return "Yearly"; + } + else if(m_repeatInterval == RepeatInterval::Biyearly) + { + return "Biyearly"; + } + return ""; +} + void Transaction::setRepeatInterval(RepeatInterval repeatInterval) { m_repeatInterval = repeatInterval; diff --git a/src/models/transaction.hpp b/src/models/transaction.hpp index 6e1cf1d7c..0cd781c9b 100644 --- a/src/models/transaction.hpp +++ b/src/models/transaction.hpp @@ -89,6 +89,12 @@ namespace NickvisionMoney::Models * @returns The repeat interval of the transaction */ RepeatInterval getRepeatInterval() const; + /** + * Gets the repeat interval of the transaction as a string + * + * @returns The repeat interval of the transaction as a string + */ + std::string getRepeatIntervalAsString() const; /** * Sets the repeat interval of the transaction * diff --git a/src/ui/application.cpp b/src/ui/application.cpp index 73ff426ca..86ecf728e 100644 --- a/src/ui/application.cpp +++ b/src/ui/application.cpp @@ -13,7 +13,7 @@ Application::Application(const std::string& id, GApplicationFlags flags) : m_adw m_appInfo.setName("Nickvision Money"); m_appInfo.setShortName("Money"); m_appInfo.setDescription("A personal finance manager."); - m_appInfo.setVersion("2022.10.0-beta1"); + m_appInfo.setVersion("2022.10.0-beta2"); m_appInfo.setChangelog("
  • Redesign with GTK4 and libadwaita 1.2
"); m_appInfo.setGitHubRepo("https://github.com/nlogozzo/NickvisionMoney"); m_appInfo.setIssueTracker("https://github.com/nlogozzo/NickvisionMoney/issues/new"); diff --git a/src/ui/controls/transactionrow.cpp b/src/ui/controls/transactionrow.cpp index 519dae593..76372545f 100644 --- a/src/ui/controls/transactionrow.cpp +++ b/src/ui/controls/transactionrow.cpp @@ -13,9 +13,18 @@ TransactionRow::TransactionRow(const Transaction& transaction, const std::string adw_preferences_row_set_title(ADW_PREFERENCES_ROW(m_gobj), builder.str().c_str()); builder.str(""); builder.clear(); - builder << (m_transaction.getType() == TransactionType::Income ? "+ " : "- ") << currencySymbol << m_transaction.getAmount() << "\n"; builder << boost::gregorian::to_iso_extended_string(m_transaction.getDate()); + if(m_transaction.getRepeatInterval() != RepeatInterval::Never) + { + builder << "\n" << "Repeat Interval: " << m_transaction.getRepeatIntervalAsString(); + } adw_action_row_set_subtitle(ADW_ACTION_ROW(m_gobj), builder.str().c_str()); + //Amount Label + builder.str(""); + builder.clear(); + builder << currencySymbol << m_transaction.getAmount(); + m_lblAmount = gtk_label_new(builder.str().c_str()); + gtk_style_context_add_class(gtk_widget_get_style_context(m_lblAmount), m_transaction.getType() == TransactionType::Income ? "success" : "error"); //Edit Button m_btnEdit = gtk_button_new(); gtk_widget_set_valign(m_btnEdit, GTK_ALIGN_CENTER); @@ -31,11 +40,12 @@ TransactionRow::TransactionRow(const Transaction& transaction, const std::string gtk_button_set_icon_name(GTK_BUTTON(m_btnDelete), "user-trash-symbolic"); gtk_widget_set_tooltip_text(m_btnDelete, "Delete Transaction"); g_signal_connect(m_btnDelete, "clicked", G_CALLBACK((void (*)(GtkButton*, gpointer))[](GtkButton*, gpointer data) { reinterpret_cast(data)->onDelete(); }), this); - //Buttons Box - m_boxButtons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); - gtk_box_append(GTK_BOX(m_boxButtons), m_btnEdit); - gtk_box_append(GTK_BOX(m_boxButtons), m_btnDelete); - adw_action_row_add_suffix(ADW_ACTION_ROW(m_gobj), m_boxButtons); + //Box + m_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); + gtk_box_append(GTK_BOX(m_box), m_lblAmount); + gtk_box_append(GTK_BOX(m_box), m_btnEdit); + gtk_box_append(GTK_BOX(m_box), m_btnDelete); + adw_action_row_add_suffix(ADW_ACTION_ROW(m_gobj), m_box); } GtkWidget* TransactionRow::gobj() diff --git a/src/ui/controls/transactionrow.hpp b/src/ui/controls/transactionrow.hpp index a8cc4fbc8..edac6a13c 100644 --- a/src/ui/controls/transactionrow.hpp +++ b/src/ui/controls/transactionrow.hpp @@ -43,7 +43,8 @@ namespace NickvisionMoney::UI::Controls std::function m_editCallback; std::function m_deleteCallback; GtkWidget* m_gobj; - GtkWidget* m_boxButtons; + GtkWidget* m_box; + GtkWidget* m_lblAmount; GtkWidget* m_btnEdit; GtkWidget* m_btnDelete; /**