Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

news tab changes

tilakpatel221a76784198e3
diff --git a/fincept-qt/src/screens/news/NewsCommandBar.cpp b/fincept-qt/src/screens/news/NewsCommandBar.cpp
index 2565cd508..39dd5953c 100644
--- a/fincept-qt/src/screens/news/NewsCommandBar.cpp
+++ b/fincept-qt/src/screens/news/NewsCommandBar.cpp
@@ -107,15 +107,15 @@ void NewsCommandBar::build_command_row(QVBoxLayout* root) {
sort_newest_ = make_pill("NEW", "NEWEST", hl);
connect(sort_relevance_, &QPushButton::clicked, this, [this]() {
active_sort_ = "RELEVANCE";
- update_pill_group({sort_relevance_, sort_newest_}, "REL");
+ update_pill_group({sort_relevance_, sort_newest_}, active_sort_);
emit sort_changed("RELEVANCE");
});
connect(sort_newest_, &QPushButton::clicked, this, [this]() {
active_sort_ = "NEWEST";
- update_pill_group({sort_relevance_, sort_newest_}, "NEW");
+ update_pill_group({sort_relevance_, sort_newest_}, active_sort_);
emit sort_changed("NEWEST");
});
- update_pill_group({sort_relevance_, sort_newest_}, "REL");
+ update_pill_group({sort_relevance_, sort_newest_}, active_sort_);
hl->addSpacing(2);
@@ -124,15 +124,15 @@ void NewsCommandBar::build_command_row(QVBoxLayout* root) {
view_clusters_ = make_pill("CLST", "CLUSTERS", hl);
connect(view_wire_, &QPushButton::clicked, this, [this]() {
active_view_ = "WIRE";
- update_pill_group({view_wire_, view_clusters_}, "WIRE");
+ update_pill_group({view_wire_, view_clusters_}, active_view_);
emit view_mode_changed("WIRE");
});
connect(view_clusters_, &QPushButton::clicked, this, [this]() {
active_view_ = "CLUSTERS";
- update_pill_group({view_wire_, view_clusters_}, "CLST");
+ update_pill_group({view_wire_, view_clusters_}, active_view_);
emit view_mode_changed("CLUSTERS");
});
- update_pill_group({view_wire_, view_clusters_}, "WIRE");
+ update_pill_group({view_wire_, view_clusters_}, active_view_);
hl->addStretch();
@@ -339,18 +339,24 @@ void NewsCommandBar::build_intel_row(QVBoxLayout* root) {
}
QPushButton* NewsCommandBar::make_pill(const QString& text, const QString& value, QHBoxLayout* layout) {
- Q_UNUSED(value);
auto* btn = new QPushButton(text, this);
btn->setObjectName("newsCommandBarPill");
btn->setFixedHeight(18);
btn->setCursor(Qt::PointingHandCursor);
+ // Carry the logical value (e.g. "RELEVANCE" for the "REL" pill) as a
+ // property so update_pill_group can match on intent rather than the
+ // abbreviated label — lets callers pass the canonical value.
+ btn->setProperty("pillValue", value);
layout->addWidget(btn);
return btn;
}
void NewsCommandBar::update_pill_group(const QVector<QPushButton*>& btns, const QString& active_value) {
for (auto* btn : btns) {
- bool active = (btn->text() == active_value);
+ // Match against the pill's logical value, falling back to its label so
+ // groups created before pillValue was set still behave.
+ const QString value = btn->property("pillValue").toString();
+ bool active = (value == active_value) || (btn->text() == active_value);
btn->setProperty("active", active);
btn->style()->unpolish(btn);
btn->style()->polish(btn);
@@ -362,6 +368,21 @@ void NewsCommandBar::set_active_category(const QString& cat) {
update_pill_group(category_btns_, active_category_);
}
+void NewsCommandBar::set_active_sort(const QString& sort) {
+ active_sort_ = sort;
+ update_pill_group({sort_relevance_, sort_newest_}, active_sort_);
+}
+
+void NewsCommandBar::set_active_view(const QString& view) {
+ active_view_ = view;
+ update_pill_group({view_wire_, view_clusters_}, active_view_);
+}
+
+void NewsCommandBar::set_active_time_range(const QString& range) {
+ active_time_ = range;
+ update_pill_group(time_btns_, active_time_);
+}
+
void NewsCommandBar::set_loading(bool loading) {
refresh_btn_->setEnabled(!loading);
refresh_btn_->setText(loading ? "..." : "REFRESH");
diff --git a/fincept-qt/src/screens/news/NewsCommandBar.h b/fincept-qt/src/screens/news/NewsCommandBar.h
index df92b7392..89bc9e5a3 100644
--- a/fincept-qt/src/screens/news/NewsCommandBar.h
+++ b/fincept-qt/src/screens/news/NewsCommandBar.h
@@ -20,6 +20,14 @@ class NewsCommandBar : public QWidget {
explicit NewsCommandBar(QWidget* parent = nullptr);
void set_active_category(const QString& cat);
+ /// Re-highlight the REL/NEW sort pills to match `sort` ("RELEVANCE" /
+ /// "NEWEST"). Used to sync the UI with persisted/restored state without
+ /// emitting sort_changed.
+ void set_active_sort(const QString& sort);
+ /// Re-highlight the WIRE/CLST view pills ("WIRE" / "CLUSTERS").
+ void set_active_view(const QString& view);
+ /// Re-highlight the time-range pills ("1H".."30D").
+ void set_active_time_range(const QString& range);
void set_loading(bool loading);
void set_loading_progress(int done, int total);
void set_article_count(int count);
diff --git a/fincept-qt/src/screens/news/NewsScreen.cpp b/fincept-qt/src/screens/news/NewsScreen.cpp
index 9adc176db..f9fafa53a 100644
--- a/fincept-qt/src/screens/news/NewsScreen.cpp
+++ b/fincept-qt/src/screens/news/NewsScreen.cpp
@@ -52,6 +52,14 @@ NewsScreen::NewsScreen(QWidget* parent) : QWidget(parent) {
build_ui();
connect_signals();
+ // Push the persisted preferences into the command bar so the pill
+ // highlights (category / time / REL-NEW sort / WIRE-CLST view) reflect the
+ // restored state on first paint instead of their hardcoded defaults.
+ command_bar_->set_active_category(active_category_);
+ command_bar_->set_active_time_range(time_range_);
+ command_bar_->set_active_sort(sort_mode_);
+ command_bar_->set_active_view(view_mode_);
+
// Drop a symbol anywhere on the News screen to filter the feed by that
// ticker. Reuses the search-query pipeline so caching/highlighting stay
// coherent with keyword search.
@@ -1212,8 +1220,12 @@ void NewsScreen::restore_state(const QVariantMap& state) {
search_query_.clear();
active_variant_ = state.value("variant", "FULL").toString();
- if (command_bar_)
+ if (command_bar_) {
command_bar_->set_active_category(active_category_);
+ command_bar_->set_active_time_range(time_range_);
+ command_bar_->set_active_sort(sort_mode_);
+ command_bar_->set_active_view(view_mode_);
+ }
}
} // namespace fincept::screens
diff --git a/images/Geopolitics.png b/images/Geopolitics.png
new file mode 100644
index 000000000..42dc45240
Binary files /dev/null and b/images/Geopolitics.png differ
diff --git a/images/Maritime.png b/images/Maritime.png
new file mode 100644
index 000000000..e5f67bd4c
Binary files /dev/null and b/images/Maritime.png differ
diff --git a/images/Portfolio.png b/images/Portfolio.png
index fd417a3d9..716e35328 100644
Binary files a/images/Portfolio.png and b/images/Portfolio.png differ
diff --git a/images/Research.png b/images/Research.png
new file mode 100644
index 000000000..6a9879739
Binary files /dev/null and b/images/Research.png differ