comparison src/gui/pages/seasons.cc @ 291:9a88e1725fd2

*: refactor lots of stuff I forgot to put this into different commits, oops! anyway, it doesn't really matter *that* much since this is an unfinished hobby project anyway. once it starts getting stable commit history will be more important, but for now it's not that big of a deal
author Paper <paper@paper.us.eu.org>
date Sun, 12 May 2024 16:31:07 -0400
parents 657fda1b9cac
children b82841e76e79
comparison
equal deleted inserted replaced
290:9347e2eaf6e5 291:9a88e1725fd2
46 toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 46 toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
47 toolbar->setIconSize(QSize(16, 16)); 47 toolbar->setIconSize(QSize(16, 16));
48 toolbar->setMovable(false); 48 toolbar->setMovable(false);
49 49
50 { 50 {
51 /* hard-coded this value */ 51 /* todo: clean this up... this sucks... */
52 static constexpr Date::Year last_year = 1960; 52 static constexpr Date::Year last_year = 1960;
53 53
54 auto create_year_menu = [this](QWidget* parent, QMenu* parent_menu, Date::Year year){ 54 auto create_year_menu = [this](QWidget* parent, QMenu* parent_menu, Date::Year year){
55 const QString year_s = QString::number(year); 55 const QString year_s = QString::number(year);
56 56
70 create_year_menu(parent, menu, decade + i); 70 create_year_menu(parent, menu, decade + i);
71 parent_menu->addMenu(menu); 71 parent_menu->addMenu(menu);
72 }; 72 };
73 73
74 /* we'll be extinct by the time this code breaks, so I guess it's fine :) */ 74 /* we'll be extinct by the time this code breaks, so I guess it's fine :) */
75 const Date::Year year = static_cast<Date::Year>(QDate::currentDate().year()); 75 const Date::Year current_year = static_cast<Date::Year>(QDate::currentDate().year());
76 const Date::Year year_before_collapse = GetClosestDecade(year) - 10; 76 const Date::Year year_before_collapse = GetClosestDecade(current_year) - 10;
77 season_button = new QToolButton(toolbar); 77 season_button = new QToolButton(toolbar);
78 QMenu* full_season_menu = new QMenu(season_button); 78 QMenu* full_season_menu = new QMenu(season_button);
79 79
80 for (Date::Year c = year; c >= year_before_collapse; c--) 80 for (Date::Year c = current_year; c >= year_before_collapse; c--)
81 create_year_menu(season_button, full_season_menu, c); 81 create_year_menu(season_button, full_season_menu, c);
82 82
83 full_season_menu->addSeparator(); 83 full_season_menu->addSeparator();
84 84
85 for (Date::Year c = year_before_collapse - 10; c >= last_year; c -= 10) 85 for (Date::Year c = year_before_collapse - 10; c >= last_year; c -= 10)
101 QToolButton* button = new QToolButton(toolbar); 101 QToolButton* button = new QToolButton(toolbar);
102 102
103 { 103 {
104 /* links */ 104 /* links */
105 QMenu* menu = new QMenu(button); 105 QMenu* menu = new QMenu(button);
106 menu->addAction("Airing status"); 106 menu->addAction(tr("Airing status"));
107 menu->addAction("List status"); 107 menu->addAction(tr("List status"));
108 menu->addAction("Type"); 108 menu->addAction(tr("Type"));
109 button->setMenu(menu); 109 button->setMenu(menu);
110 } 110 }
111 111
112 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 112 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
113 button->setIcon(QIcon(":/icons/16x16/category.png")); 113 button->setIcon(QIcon(":/icons/16x16/category.png"));
114 button->setText("Group by:"); 114 button->setText(tr("Group by:"));
115 button->setPopupMode(QToolButton::InstantPopup); 115 button->setPopupMode(QToolButton::InstantPopup);
116 toolbar->addWidget(button); 116 toolbar->addWidget(button);
117 } 117 }
118 118
119 { 119 {
120 QToolButton* button = new QToolButton(toolbar); 120 QToolButton* button = new QToolButton(toolbar);
121 121
122 { 122 {
123 /* links */ 123 /* links */
124 QMenu* menu = new QMenu(button); 124 QMenu* menu = new QMenu(button);
125 menu->addAction("Airing date"); 125 menu->addAction(tr("Airing date"));
126 menu->addAction("Episodes"); 126 menu->addAction(tr("Episodes"));
127 menu->addAction("Popularity"); 127 menu->addAction(tr("Popularity"));
128 menu->addAction("Score"); 128 menu->addAction(tr("Score"));
129 menu->addAction("Title"); 129 menu->addAction(tr("Title"));
130 button->setMenu(menu); 130 button->setMenu(menu);
131 } 131 }
132 132
133 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 133 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
134 button->setIcon(QIcon(":/icons/16x16/sort-quantity-descending.png")); 134 button->setIcon(QIcon(":/icons/16x16/sort-quantity-descending.png"));
135 button->setText("Sort by:"); 135 button->setText(tr("Sort by:"));
136 button->setPopupMode(QToolButton::InstantPopup); 136 button->setPopupMode(QToolButton::InstantPopup);
137 toolbar->addWidget(button); 137 toolbar->addWidget(button);
138 } 138 }
139 139
140 { 140 {
141 QToolButton* button = new QToolButton(toolbar); 141 QToolButton* button = new QToolButton(toolbar);
142 142
143 { 143 {
144 /* links */ 144 /* links */
145 QMenu* menu = new QMenu(button); 145 QMenu* menu = new QMenu(button);
146 menu->addAction("Images"); 146 menu->addAction(tr("Images"));
147 menu->addAction("Details"); 147 menu->addAction(tr("Details"));
148 button->setMenu(menu); 148 button->setMenu(menu);
149 } 149 }
150 150
151 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 151 button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
152 button->setIcon(QIcon(":/icons/16x16/ui-scroll-pane-detail.png")); 152 button->setIcon(QIcon(":/icons/16x16/ui-scroll-pane-detail.png"));
153 button->setText("View:"); 153 button->setText(tr("View:"));
154 button->setPopupMode(QToolButton::InstantPopup); 154 button->setPopupMode(QToolButton::InstantPopup);
155 toolbar->addWidget(button); 155 toolbar->addWidget(button);
156 } 156 }
157 157
158 full_layout->addWidget(toolbar); 158 full_layout->addWidget(toolbar);