Skip to content

Commit

Permalink
V2022.10.0-beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Oct 29, 2022
1 parent f7e818a commit 2e6245f
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 10 deletions.
2 changes: 1 addition & 1 deletion org.nickvision.money.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
{
"type": "git",
"url": "https://github.com/nlogozzo/NickvisionMoney.git",
"tag": "2022.10.0-beta1"
"tag": "2022.10.0-beta2"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion org.nickvision.money.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<binary>org.nickvision.money</binary>
</provides>
<releases>
<release version="2022.10.0-beta1" date="2022-10-28">
<release version="2022.10.0-beta2" date="2022-10-28">
<description>
<p>- Redesign with GTK4 and libadwaita 1.2</p>
</description>
Expand Down
33 changes: 33 additions & 0 deletions src/models/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/models/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion src/ui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("<ul><li>Redesign with GTK4 and libadwaita 1.2</li></ul>");
m_appInfo.setGitHubRepo("https://github.com/nlogozzo/NickvisionMoney");
m_appInfo.setIssueTracker("https://github.com/nlogozzo/NickvisionMoney/issues/new");
Expand Down
22 changes: 16 additions & 6 deletions src/ui/controls/transactionrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<TransactionRow*>(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()
Expand Down
3 changes: 2 additions & 1 deletion src/ui/controls/transactionrow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace NickvisionMoney::UI::Controls
std::function<void(unsigned int)> m_editCallback;
std::function<void(unsigned int)> m_deleteCallback;
GtkWidget* m_gobj;
GtkWidget* m_boxButtons;
GtkWidget* m_box;
GtkWidget* m_lblAmount;
GtkWidget* m_btnEdit;
GtkWidget* m_btnDelete;
/**
Expand Down

0 comments on commit 2e6245f

Please sign in to comment.