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.

v4.0.3 update

tilakpatel226a3bf60db402
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 50a9cb422..75e2513fb 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1002,21 +1002,47 @@ jobs:
set -euo pipefail
APP_BUNDLE="build/${{ env.APP_NAME }}.app"
ZIP_PATH="$RUNNER_TEMP/app-for-notary.zip"
+ SUBMIT_JSON="$RUNNER_TEMP/notary-app-submit.json"
# ditto preserves symlinks + xattrs correctly; `zip` doesn't.
/usr/bin/ditto -c -k --keepParent "${APP_BUNDLE}" "${ZIP_PATH}"
+ # Submit and wait. `--output-format json` makes the result
+ # machine-parseable. Important: `notarytool submit --wait` exits 0
+ # even when Apple returns status: Invalid — the exit code only
+ # signals "could we talk to Apple". The actual verdict lives in
+ # the .status field, so we MUST inspect it ourselves. If we don't,
+ # the next step (`stapler staple`) fails with a cryptic "Error 65"
+ # because Apple never minted a ticket.
echo "Submitting .app to Apple notary (this can take a few minutes)..."
xcrun notarytool submit "${ZIP_PATH}" \
--apple-id "$APPLE_ID" \
--team-id "$TEAM_ID" \
--password "$NOTARY_PASSWORD" \
- --wait
+ --wait \
+ --output-format json | tee "${SUBMIT_JSON}"
+
+ SUB_ID=$(jq -r '.id' < "${SUBMIT_JSON}")
+ STATUS=$(jq -r '.status' < "${SUBMIT_JSON}")
+ echo "Notarization submission ${SUB_ID} → ${STATUS}"
+
+ if [ "${STATUS}" != "Accepted" ]; then
+ echo "::error::Notarization failed for .app (status: ${STATUS}). Fetching Apple's log..."
+ # `notarytool log <id>` returns the pretty-printed JSON log
+ # whose .issues[] array names the exact files Apple rejected
+ # and why (missing hardened runtime, unsigned Mach-O, etc.).
+ xcrun notarytool log "${SUB_ID}" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ || echo "::warning::Could not fetch notarization log for ${SUB_ID}"
+ exit 1
+ fi
echo "Stapling ticket to .app..."
xcrun stapler staple "${APP_BUNDLE}"
xcrun stapler validate "${APP_BUNDLE}"
- rm -f "${ZIP_PATH}"
+ rm -f "${ZIP_PATH}" "${SUBMIT_JSON}"
# ── Copy signed bundle to dist/ ───────────────────────────────────────
- name: Finalize dist
@@ -1077,17 +1103,38 @@ jobs:
echo "Signing DMG: ${DMG}"
codesign --force --sign "$SIGNING_IDENTITY" --timestamp "$DMG"
+ # Same status-handling pattern as the .app notarization step
+ # above — submit --wait can exit 0 on Invalid, so we parse
+ # .status from the JSON and pull the log on rejection.
+ SUBMIT_JSON="$RUNNER_TEMP/notary-dmg-submit.json"
+
echo "Submitting to Apple notary service (this can take a few minutes)..."
xcrun notarytool submit "$DMG" \
--apple-id "$APPLE_ID" \
--team-id "$TEAM_ID" \
--password "$NOTARY_PASSWORD" \
- --wait
+ --wait \
+ --output-format json | tee "${SUBMIT_JSON}"
+
+ SUB_ID=$(jq -r '.id' < "${SUBMIT_JSON}")
+ STATUS=$(jq -r '.status' < "${SUBMIT_JSON}")
+ echo "DMG notarization submission ${SUB_ID} → ${STATUS}"
+
+ if [ "${STATUS}" != "Accepted" ]; then
+ echo "::error::Notarization failed for DMG (status: ${STATUS}). Fetching Apple's log..."
+ xcrun notarytool log "${SUB_ID}" \
+ --apple-id "$APPLE_ID" \
+ --team-id "$TEAM_ID" \
+ --password "$NOTARY_PASSWORD" \
+ || echo "::warning::Could not fetch notarization log for ${SUB_ID}"
+ exit 1
+ fi
echo "Stapling ticket..."
xcrun stapler staple "$DMG"
xcrun stapler validate "$DMG"
spctl --assess --type open --context context:primary-signature -vv "$DMG" || true
+ rm -f "${SUBMIT_JSON}"
# ── Clean up the temp keychain ────────────────────────────────────────
- name: Clean up keychain
diff --git a/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.cpp b/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.cpp
index 84a964785..04e85ed21 100644
--- a/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.cpp
+++ b/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.cpp
@@ -11,6 +11,7 @@
#include <QHeaderView>
#include <QRandomGenerator>
#include <QScrollArea>
+#include <QSet>
#include <QSplitter>
#include <QUrl>
@@ -104,20 +105,41 @@ void ConflictMonitorPanel::build_ui() {
auto* cat_cell = events_table_->item(row, 0);
const QString raw_cat = cat_cell ? cat_cell->data(Qt::UserRole).toString() : QString();
+ const QString title = get_text(3);
+ if (detail_title_)
+ detail_title_->setText(title.isEmpty() ? QStringLiteral("Untitled event") : title);
detail_category_->setText(get_text(0).toUpper());
- detail_country_->setText(get_text(1));
- detail_city_->setText(get_text(2));
- detail_keywords_->setText(get_text(3));
- detail_date_->setText(get_text(4));
- if (auto* it = events_table_->item(row, 3); it && detail_source_)
- detail_source_->setText(it->data(Qt::UserRole).toString());
+ detail_country_->setText(get_text(1).isEmpty() ? QStringLiteral("—") : get_text(1));
+ detail_city_->setText(get_text(2).isEmpty() ? QStringLiteral("—") : get_text(2));
+ detail_date_->setText(get_text(4).isEmpty() ? QStringLiteral("—") : get_text(4));
+
+ QString src_name;
+ QString src_url;
+ if (auto* it = events_table_->item(row, 3)) {
+ src_name = it->data(Qt::UserRole).toString();
+ src_url = it->data(Qt::UserRole + 1).toString();
+ }
+ if (detail_source_)
+ detail_source_->setText(src_name.isEmpty() ? QStringLiteral("—") : src_name);
+
+ current_url_ = src_url;
+ if (detail_open_btn_)
+ detail_open_btn_->setVisible(!src_url.isEmpty());
const auto cat_color = category_color(raw_cat);
- detail_category_->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;")
- .arg(cat_color.name())
- .arg(ui::fonts::SMALL)
+ const QString cat_hex = cat_color.name();
+ const QString cat_rgb =
+ QString("%1,%2,%3").arg(cat_color.red()).arg(cat_color.green()).arg(cat_color.blue());
+ detail_category_->setStyleSheet(QString("color:%1; background:rgba(%2,0.12);"
+ "border:1px solid rgba(%2,0.45);"
+ "padding:3px 8px; font-size:%3px; font-weight:700;"
+ "font-family:%4; letter-spacing:1px;")
+ .arg(cat_hex)
+ .arg(cat_rgb)
+ .arg(ui::fonts::TINY)
.arg(ui::fonts::DATA_FAMILY));
+ if (empty_state_) empty_state_->setVisible(false);
detail_panel_->setVisible(true);
});
left_splitter->addWidget(events_table_);
@@ -131,106 +153,295 @@ void ConflictMonitorPanel::build_ui() {
left_splitter->setSizes({360, 360});
root->addWidget(left_splitter, 1);
- // Right sidebar: stats + selected detail
+ root->addWidget(build_sidebar());
+}
+
+// ── Sidebar: scrollable column with overview, top categories, hotspots, event details
+QWidget* ConflictMonitorPanel::build_sidebar() {
auto* sidebar = new QWidget(this);
- sidebar->setFixedWidth(240);
+ sidebar->setFixedWidth(280);
sidebar->setStyleSheet(
QString("background:%1; border-left:1px solid %2;").arg(ui::colors::BG_SURFACE(), ui::colors::BORDER_DIM()));
- auto* svl = new QVBoxLayout(sidebar);
- svl->setContentsMargins(12, 12, 12, 12);
- svl->setSpacing(8);
-
- auto* stats_title = new QLabel("TOP CATEGORIES", sidebar);
- stats_title->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
- "letter-spacing:1px; padding-bottom:6px; border-bottom:1px solid %4;")
- .arg(ui::colors::NEGATIVE())
- .arg(ui::fonts::TINY)
- .arg(ui::fonts::DATA_FAMILY())
- .arg(ui::colors::BORDER_DIM()));
- svl->addWidget(stats_title);
-
- auto* stats_container = new QWidget(sidebar);
- stats_layout_ = new QVBoxLayout(stats_container);
+ auto* outer = new QVBoxLayout(sidebar);
+ outer->setContentsMargins(0, 0, 0, 0);
+ outer->setSpacing(0);
+
+ auto* scroll = new QScrollArea(sidebar);
+ scroll->setWidgetResizable(true);
+ scroll->setFrameShape(QFrame::NoFrame);
+ scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ scroll->setStyleSheet(QString("QScrollArea { background:transparent; border:none; }"
+ "QScrollBar:vertical { background:%1; width:6px; }"
+ "QScrollBar::handle:vertical { background:%2; border-radius:3px; }"
+ "QScrollBar::add-line, QScrollBar::sub-line { height:0px; }")
+ .arg(ui::colors::BG_SURFACE(), ui::colors::BORDER_MED()));
+
+ auto* content = new QWidget(scroll);
+ content->setStyleSheet(QString("background:%1;").arg(ui::colors::BG_SURFACE()));
+ auto* svl = new QVBoxLayout(content);
+ svl->setContentsMargins(14, 14, 14, 14);
+ svl->setSpacing(14);
+
+ svl->addWidget(build_overview_section(content));
+ svl->addWidget(make_divider(content));
+ svl->addWidget(build_top_categories_section(content));
+ svl->addWidget(make_divider(content));
+ svl->addWidget(build_hotspots_section(content));
+ svl->addWidget(make_divider(content));
+ svl->addWidget(build_event_details_section(content));
+ svl->addStretch(1);
+
+ scroll->setWidget(content);
+ outer->addWidget(scroll);
+ return sidebar;
+}
+
+QWidget* ConflictMonitorPanel::make_section_header(const QString& text, QWidget* parent) {
+ auto* lbl = new QLabel(text, parent);
+ lbl->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "letter-spacing:1.5px;")
+ .arg(ui::colors::NEGATIVE())
+ .arg(ui::fonts::TINY)
+ .arg(ui::fonts::DATA_FAMILY()));
+ return lbl;
+}
+
+QWidget* ConflictMonitorPanel::make_divider(QWidget* parent) {
+ auto* sep = new QWidget(parent);
+ sep->setFixedHeight(1);
+ sep->setStyleSheet(QString("background:%1;").arg(ui::colors::BORDER_DIM()));
+ return sep;
+}
+
+QWidget* ConflictMonitorPanel::make_stat_tile(const QString& label, QLabel** value_out, QWidget* parent) {
+ auto* tile = new QWidget(parent);
+ tile->setStyleSheet(QString("background:%1; border:1px solid %2;")
+ .arg(ui::colors::BG_RAISED(), ui::colors::BORDER_DIM()));
+ auto* tl = new QVBoxLayout(tile);
+ tl->setContentsMargins(8, 6, 8, 6);
+ tl->setSpacing(2);
+
+ auto* val = new QLabel("0", tile);
+ val->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "background:transparent; border:none;")
+ .arg(ui::colors::TEXT_PRIMARY())
+ .arg(ui::fonts::HEADER)
+ .arg(ui::fonts::DATA_FAMILY()));
+ val->setAlignment(Qt::AlignCenter);
+ tl->addWidget(val);
+
+ auto* lbl = new QLabel(label, tile);
+ lbl->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; letter-spacing:1px;"
+ "background:transparent; border:none;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::TINY)
+ .arg(ui::fonts::DATA_FAMILY()));
+ lbl->setAlignment(Qt::AlignCenter);
+ tl->addWidget(lbl);
+
+ *value_out = val;
+ return tile;
+}
+
+QWidget* ConflictMonitorPanel::build_overview_section(QWidget* parent) {
+ auto* w = new QWidget(parent);
+ auto* vl = new QVBoxLayout(w);
+ vl->setContentsMargins(0, 0, 0, 0);
+ vl->setSpacing(8);
+
+ vl->addWidget(make_section_header("OVERVIEW", w));
+
+ auto* tiles = new QWidget(w);
+ auto* tl = new QHBoxLayout(tiles);
+ tl->setContentsMargins(0, 0, 0, 0);
+ tl->setSpacing(6);
+ tl->addWidget(make_stat_tile("EVENTS", &stat_total_, tiles), 1);
+ tl->addWidget(make_stat_tile("MAPPED", &stat_mapped_, tiles), 1);
+ tl->addWidget(make_stat_tile("NATIONS", &stat_countries_, tiles), 1);
+ vl->addWidget(tiles);
+ return w;
+}
+
+QWidget* ConflictMonitorPanel::build_top_categories_section(QWidget* parent) {
+ auto* w = new QWidget(parent);
+ auto* vl = new QVBoxLayout(w);
+ vl->setContentsMargins(0, 0, 0, 0);
+ vl->setSpacing(6);
+ vl->addWidget(make_section_header("TOP CATEGORIES", w));
+
+ auto* container = new QWidget(w);
+ stats_layout_ = new QVBoxLayout(container);
stats_layout_->setContentsMargins(0, 0, 0, 0);
- stats_layout_->setSpacing(3);
- svl->addWidget(stats_container);
+ stats_layout_->setSpacing(6);
+ vl->addWidget(container);
+
+ auto* empty = new QLabel("Waiting for events…", w);
+ empty->setObjectName("topcat_empty");
+ empty->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; font-style:italic;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ stats_layout_->addWidget(empty);
+ return w;
+}
+
+QWidget* ConflictMonitorPanel::build_hotspots_section(QWidget* parent) {
+ auto* w = new QWidget(parent);
+ auto* vl = new QVBoxLayout(w);
+ vl->setContentsMargins(0, 0, 0, 0);
+ vl->setSpacing(6);
+ vl->addWidget(make_section_header("HOTSPOTS", w));
+
+ auto* container = new QWidget(w);
+ hotspots_layout_ = new QVBoxLayout(container);
+ hotspots_layout_->setContentsMargins(0, 0, 0, 0);
+ hotspots_layout_->setSpacing(5);
+ vl->addWidget(container);
+
+ auto* empty = new QLabel("Waiting for events…", w);
+ empty->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; font-style:italic;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ hotspots_layout_->addWidget(empty);
+ return w;
+}
- stats_label_ = new QLabel("No data", sidebar);
- stats_label_->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3;")
+QWidget* ConflictMonitorPanel::build_event_details_section(QWidget* parent) {
+ auto* w = new QWidget(parent);
+ auto* vl = new QVBoxLayout(w);
+ vl->setContentsMargins(0, 0, 0, 0);
+ vl->setSpacing(8);
+ vl->addWidget(make_section_header("EVENT DETAILS", w));
+
+ // Empty-state placeholder
+ empty_state_ = new QLabel(QStringLiteral("⌖ Select an event from the map or table\n to inspect details here."), w);
+ empty_state_->setWordWrap(true);
+ empty_state_->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+ empty_state_->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3;"
+ "background:%4; border:1px dashed %5;"
+ "padding:14px 12px;")
.arg(ui::colors::TEXT_TERTIARY())
.arg(ui::fonts::SMALL)
- .arg(ui::fonts::DATA_FAMILY));
- svl->addWidget(stats_label_);
+ .arg(ui::fonts::DATA_FAMILY())
+ .arg(ui::colors::BG_RAISED())
+ .arg(ui::colors::BORDER_DIM()));
+ vl->addWidget(empty_state_);
- svl->addSpacing(8);
-
- // Selected event detail panel
- detail_panel_ = new QWidget(sidebar);
+ // Detail panel
+ detail_panel_ = new QWidget(w);
detail_panel_->setVisible(false);
{
QColor neg(ui::colors::NEGATIVE());
auto neg_rgb = QString("%1,%2,%3").arg(neg.red()).arg(neg.green()).arg(neg.blue());
- detail_panel_->setStyleSheet(QString("background:rgba(%1,0.04); border:1px solid rgba(%1,0.2);"
- "border-left:3px solid %2;")
+ detail_panel_->setStyleSheet(QString("QWidget#geo_detail_root { background:rgba(%1,0.04);"
+ "border:1px solid rgba(%1,0.18);"
+ "border-left:3px solid %2; }")
.arg(neg_rgb)
.arg(ui::colors::NEGATIVE()));
}
+ detail_panel_->setObjectName("geo_detail_root");
auto* dvl = new QVBoxLayout(detail_panel_);
- dvl->setContentsMargins(10, 10, 10, 10);
- dvl->setSpacing(6);
-
- auto* detail_title = new QLabel("SELECTED EVENT", detail_panel_);
- detail_title->setStyleSheet(
- QString("color:%1; font-size:%2px; font-weight:700; font-family:%3; letter-spacing:1px;")
- .arg(ui::colors::NEGATIVE())
- .arg(ui::fonts::TINY)
- .arg(ui::fonts::DATA_FAMILY()));
- dvl->addWidget(detail_title);
-
- auto* grid_widget = new QWidget(detail_panel_);
- auto* grid = new QGridLayout(grid_widget);
- grid->setContentsMargins(0, 4, 0, 0);
- grid->setHorizontalSpacing(8);
- grid->setVerticalSpacing(4);
- grid->setColumnStretch(1, 1);
-
- auto field_label_style = QString("color:%1; font-size:%2px; font-family:%3;")
+ dvl->setContentsMargins(12, 12, 12, 12);
+ dvl->setSpacing(8);
+
+ // Category badge (colored pill)
+ detail_category_ = new QLabel(detail_panel_);
+ detail_category_->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+ detail_category_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
+ dvl->addWidget(detail_category_, 0, Qt::AlignLeft);
+
+ // Headline title
+ detail_title_ = new QLabel(detail_panel_);
+ detail_title_->setWordWrap(true);
+ detail_title_->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "background:transparent; border:none; line-height:1.3;")
+ .arg(ui::colors::TEXT_PRIMARY())
+ .arg(ui::fonts::BODY)
+ .arg(ui::fonts::DATA_FAMILY()));
+ dvl->addWidget(detail_title_);
+
+ // Field rows: label (caps) on its own line above value
+ auto field_label_style = QString("color:%1; font-size:%2px; font-family:%3;"
+ "letter-spacing:1px; background:transparent; border:none;")
.arg(ui::colors::TEXT_TERTIARY())
.arg(ui::fonts::TINY)
- .arg(ui::fonts::DATA_FAMILY);
- auto value_style = QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;")
+ .arg(ui::fonts::DATA_FAMILY());
+ auto value_style = QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "background:transparent; border:none;")
.arg(ui::colors::TEXT_PRIMARY())
.arg(ui::fonts::SMALL)
- .arg(ui::fonts::DATA_FAMILY);
+ .arg(ui::fonts::DATA_FAMILY());
+
+ auto* fields_grid_w = new QWidget(detail_panel_);
+ fields_grid_w->setStyleSheet("background:transparent;");
+ auto* fg = new QGridLayout(fields_grid_w);
+ fg->setContentsMargins(0, 4, 0, 0);
+ fg->setHorizontalSpacing(10);
+ fg->setVerticalSpacing(8);
+ fg->setColumnStretch(0, 1);
+ fg->setColumnStretch(1, 1);
struct FieldDef {
const char* label;
QLabel** target;
+ int row;
+ int col;
+ int colspan;
};
FieldDef fields[] = {
- {"CATEGORY", &detail_category_}, {"COUNTRY", &detail_country_}, {"CITY", &detail_city_},
- {"TITLE", &detail_keywords_}, {"DATE", &detail_date_}, {"SOURCE", &detail_source_},
+ {"COUNTRY", &detail_country_, 0, 0, 1},
+ {"CITY", &detail_city_, 0, 1, 1},
+ {"DATE", &detail_date_, 1, 0, 1},
+ {"SOURCE", &detail_source_, 1, 1, 1},
};
- for (int r = 0; r < 6; ++r) {
- auto* fl = new QLabel(fields[r].label, grid_widget);
- fl->setStyleSheet(field_label_style);
- fl->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- grid->addWidget(fl, r, 0);
+ for (const auto& f : fields) {
+ auto* cell = new QWidget(fields_grid_w);
+ cell->setStyleSheet("background:transparent;");
+ auto* cl = new QVBoxLayout(cell);
+ cl->setContentsMargins(0, 0, 0, 0);
+ cl->setSpacing(2);
+
+ auto* l = new QLabel(f.label, cell);
+ l->setStyleSheet(field_label_style);
+ cl->addWidget(l);
- *fields[r].target = new QLabel(grid_widget);
- (*fields[r].target)->setStyleSheet(value_style);
- (*fields[r].target)->setWordWrap(true);
- grid->addWidget(*fields[r].target, r, 1);
+ *f.target = new QLabel(QStringLiteral("—"), cell);
+ (*f.target)->setStyleSheet(value_style);
+ (*f.target)->setWordWrap(true);
+ cl->addWidget(*f.target);
+
+ fg->addWidget(cell, f.row, f.col, 1, f.colspan);
}
+ dvl->addWidget(fields_grid_w);
- dvl->addWidget(grid_widget);
- svl->addWidget(detail_panel_);
- svl->addStretch();
+ // Open-source button
+ detail_open_btn_ = new QPushButton(QStringLiteral("OPEN SOURCE ↗"), detail_panel_);
+ detail_open_btn_->setCursor(Qt::PointingHandCursor);
+ detail_open_btn_->setVisible(false);
+ {
+ QColor neg(ui::colors::NEGATIVE());
+ detail_open_btn_->setStyleSheet(QString("QPushButton { background:%1; color:%2;"
+ "font-family:%3; font-size:%4px; font-weight:700;"
+ "border:none; padding:7px 12px; letter-spacing:1px; }"
+ "QPushButton:hover { background:%5; }")
+ .arg(ui::colors::NEGATIVE())
+ .arg(ui::colors::BG_BASE())
+ .arg(ui::fonts::DATA_FAMILY())
+ .arg(ui::fonts::SMALL)
+ .arg(neg.darker(120).name()));
+ }
+ connect(detail_open_btn_, &QPushButton::clicked, this, [this]() {
+ if (!current_url_.isEmpty())
+ QDesktopServices::openUrl(QUrl(current_url_));
+ });
+ dvl->addWidget(detail_open_btn_);
- root->addWidget(sidebar);
+ vl->addWidget(detail_panel_);
+ return w;
}
void ConflictMonitorPanel::set_events(const QVector<NewsEvent>& events) {
@@ -254,6 +465,7 @@ void ConflictMonitorPanel::set_events(const QVector<NewsEvent>& events) {
events_table_->setItem(i, 2, new QTableWidgetItem(ev.city));
auto* title_item = new QTableWidgetItem(ev.title);
title_item->setData(Qt::UserRole, ev.source);
+ title_item->setData(Qt::UserRole + 1, ev.url);
title_item->setToolTip(ev.title);
events_table_->setItem(i, 3, title_item);
events_table_->setItem(i, 4, new QTableWidgetItem(ev.extracted_date));
@@ -269,7 +481,19 @@ void ConflictMonitorPanel::set_events(const QVector<NewsEvent>& events) {
events_table_->setSortingEnabled(true);
update_stats(events);
+ update_hotspots(events);
update_map(events);
+
+ // Overview tiles
+ if (stat_total_) stat_total_->setText(QString::number(events.size()));
+ int mapped = 0;
+ QSet<QString> countries;
+ for (const auto& ev : events) {
+ if (ev.has_coords) ++mapped;
+ if (!ev.country.isEmpty()) countries.insert(ev.country);
+ }
+ if (stat_mapped_) stat_mapped_->setText(QString::number(mapped));
+ if (stat_countries_) stat_countries_->setText(QString::number(countries.size()));
}
void ConflictMonitorPanel::update_map(const QVector<NewsEvent>& events) {
@@ -333,40 +557,170 @@ void ConflictMonitorPanel::update_stats(const QVector<NewsEvent>& events) {
sorted.append({it.key(), it.value()});
std::sort(sorted.begin(), sorted.end(), [](const auto& a, const auto& b) { return a.second > b.second; });
- for (int i = 0; i < qMin(sorted.size(), 10); ++i) {
+ if (sorted.isEmpty()) {
+ auto* empty = new QLabel("No events match the current filters.", this);
+ empty->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; font-style:italic;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ stats_layout_->addWidget(empty);
+ return;
+ }
+
+ const int max_count = sorted.first().second;
+
+ for (int i = 0; i < qMin(sorted.size(), 8); ++i) {
const auto& [cat, count] = sorted[i];
const QColor cat_col = category_color(cat);
const QString col_hex = cat_col.name();
const QString col_rgb = QString("%1,%2,%3").arg(cat_col.red()).arg(cat_col.green()).arg(cat_col.blue());
+ const double pct = max_count > 0 ? double(count) / max_count : 0.0;
auto* row = new QWidget(this);
- row->setStyleSheet(QString("border-left:2px solid %1; padding-left:4px;"
- "background:rgba(%2,0.04);")
- .arg(col_hex)
- .arg(col_rgb));
- auto* rl = new QHBoxLayout(row);
- rl->setContentsMargins(6, 2, 4, 2);
- rl->setSpacing(6);
-
- auto* name = new QLabel(pretty_category(cat), row);
- name->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; border:none; background:transparent;")
+ row->setStyleSheet("background:transparent;");
+ auto* rvl = new QVBoxLayout(row);
+ rvl->setContentsMargins(0, 0, 0, 0);
+ rvl->setSpacing(3);
+
+ // Top line: dot + name + count
+ auto* top = new QWidget(row);
+ top->setStyleSheet("background:transparent;");
+ auto* tl = new QHBoxLayout(top);
+ tl->setContentsMargins(0, 0, 0, 0);
+ tl->setSpacing(6);
+
+ auto* dot = new QWidget(top);
+ dot->setFixedSize(8, 8);
+ dot->setStyleSheet(QString("background:%1; border-radius:4px;").arg(col_hex));
+ tl->addWidget(dot, 0, Qt::AlignVCenter);
+
+ auto* name = new QLabel(pretty_category(cat), top);
+ name->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3;"
+ "background:transparent; border:none;")
.arg(ui::colors::TEXT_SECONDARY())
.arg(ui::fonts::SMALL)
- .arg(ui::fonts::DATA_FAMILY));
- rl->addWidget(name, 1);
+ .arg(ui::fonts::DATA_FAMILY()));
+ tl->addWidget(name, 1);
- auto* cnt = new QLabel(QString::number(count), row);
+ auto* cnt = new QLabel(QString::number(count), top);
cnt->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
- "border:none; background:transparent;")
- .arg(ui::colors::TEXT_PRIMARY())
- .arg(ui::fonts::SMALL)
- .arg(ui::fonts::DATA_FAMILY));
- rl->addWidget(cnt);
-
+ "background:transparent; border:none;")
+ .arg(ui::colors::TEXT_PRIMARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ tl->addWidget(cnt, 0, Qt::AlignRight);
+ rvl->addWidget(top);
+
+ // Proportional bar (track + fill)
+ auto* track = new QWidget(row);
+ track->setFixedHeight(4);
+ track->setStyleSheet(QString("background:rgba(%1,0.10); border:none;").arg(col_rgb));
+ auto* trackHl = new QHBoxLayout(track);
+ trackHl->setContentsMargins(0, 0, 0, 0);
+ trackHl->setSpacing(0);
+
+ auto* fill = new QWidget(track);
+ fill->setStyleSheet(QString("background:%1; border:none;").arg(col_hex));
+ fill->setFixedHeight(4);
+ trackHl->addWidget(fill, qMax(1, int(pct * 1000)));
+ trackHl->addStretch(qMax(0, int((1.0 - pct) * 1000)));
+
+ rvl->addWidget(track);
stats_layout_->addWidget(row);
}
+}
- stats_label_->setText(QString("%1 events loaded").arg(events.size()));
+void ConflictMonitorPanel::update_hotspots(const QVector<NewsEvent>& events) {
+ if (!hotspots_layout_) return;
+ while (hotspots_layout_->count() > 0) {
+ auto* item = hotspots_layout_->takeAt(0);
+ if (item->widget()) item->widget()->deleteLater();
+ delete item;
+ }
+
+ QHash<QString, int> counts;
+ for (const auto& ev : events) {
+ if (ev.country.isEmpty()) continue;
+ counts[ev.country]++;
+ }
+
+ QVector<QPair<QString, int>> sorted;
+ for (auto it = counts.begin(); it != counts.end(); ++it)
+ sorted.append({it.key(), it.value()});
+ std::sort(sorted.begin(), sorted.end(), [](const auto& a, const auto& b) { return a.second > b.second; });
+
+ if (sorted.isEmpty()) {
+ auto* empty = new QLabel("No country data.", this);
+ empty->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3; font-style:italic;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ hotspots_layout_->addWidget(empty);
+ return;
+ }
+
+ const int max_count = sorted.first().second;
+ const QColor accent(ui::colors::NEGATIVE());
+ const QString accent_rgb = QString("%1,%2,%3").arg(accent.red()).arg(accent.green()).arg(accent.blue());
+
+ for (int i = 0; i < qMin(sorted.size(), 5); ++i) {
+ const auto& [country, count] = sorted[i];
+ const double pct = max_count > 0 ? double(count) / max_count : 0.0;
+
+ auto* row = new QWidget(this);
+ row->setStyleSheet("background:transparent;");
+ auto* rvl = new QVBoxLayout(row);
+ rvl->setContentsMargins(0, 0, 0, 0);
+ rvl->setSpacing(3);
+
+ auto* top = new QWidget(row);
+ top->setStyleSheet("background:transparent;");
+ auto* tl = new QHBoxLayout(top);
+ tl->setContentsMargins(0, 0, 0, 0);
+ tl->setSpacing(6);
+
+ auto* rank = new QLabel(QString("%1.").arg(i + 1), top);
+ rank->setFixedWidth(18);
+ rank->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "background:transparent; border:none;")
+ .arg(ui::colors::TEXT_TERTIARY())
+ .arg(ui::fonts::TINY)
+ .arg(ui::fonts::DATA_FAMILY()));
+ tl->addWidget(rank);
+
+ auto* name = new QLabel(country, top);
+ name->setStyleSheet(QString("color:%1; font-size:%2px; font-family:%3;"
+ "background:transparent; border:none;")
+ .arg(ui::colors::TEXT_PRIMARY())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ tl->addWidget(name, 1);
+
+ auto* cnt = new QLabel(QString::number(count), top);
+ cnt->setStyleSheet(QString("color:%1; font-size:%2px; font-weight:700; font-family:%3;"
+ "background:transparent; border:none;")
+ .arg(ui::colors::NEGATIVE())
+ .arg(ui::fonts::SMALL)
+ .arg(ui::fonts::DATA_FAMILY()));
+ tl->addWidget(cnt, 0, Qt::AlignRight);
+ rvl->addWidget(top);
+
+ auto* track = new QWidget(row);
+ track->setFixedHeight(3);
+ track->setStyleSheet(QString("background:rgba(%1,0.10); border:none;").arg(accent_rgb));
+ auto* trackHl = new QHBoxLayout(track);
+ trackHl->setContentsMargins(0, 0, 0, 0);
+ trackHl->setSpacing(0);
+
+ auto* fill = new QWidget(track);
+ fill->setStyleSheet(QString("background:%1; border:none;").arg(ui::colors::NEGATIVE()));
+ fill->setFixedHeight(3);
+ trackHl->addWidget(fill, qMax(1, int(pct * 1000)));
+ trackHl->addStretch(qMax(0, int((1.0 - pct) * 1000)));
+ rvl->addWidget(track);
+
+ hotspots_layout_->addWidget(row);
+ }
}
} // namespace fincept::screens
diff --git a/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.h b/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.h
index c07b5ddb1..d0a5c5eea 100644
--- a/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.h
+++ b/fincept-qt/src/screens/geopolitics/ConflictMonitorPanel.h
@@ -3,6 +3,7 @@
#include "services/geopolitics/GeopoliticsTypes.h"
#include <QLabel>
+#include <QPushButton>
#include <QTableWidget>
#include <QVBoxLayout>
#include <QWidget>
@@ -23,24 +24,46 @@ class ConflictMonitorPanel : public QWidget {
private:
void build_ui();
+ QWidget* build_sidebar();
+ QWidget* build_overview_section(QWidget* parent);
+ QWidget* build_top_categories_section(QWidget* parent);
+ QWidget* build_hotspots_section(QWidget* parent);
+ QWidget* build_event_details_section(QWidget* parent);
+ QWidget* make_section_header(const QString& text, QWidget* parent);
+ QWidget* make_divider(QWidget* parent);
+ QWidget* make_stat_tile(const QString& label, QLabel** value_out, QWidget* parent);
+
void update_stats(const QVector<fincept::services::geo::NewsEvent>& events);
+ void update_hotspots(const QVector<fincept::services::geo::NewsEvent>& events);
void update_map(const QVector<fincept::services::geo::NewsEvent>& events);
// Map
fincept::ui::WorldMapWidget* map_widget_ = nullptr;
QTableWidget* events_table_ = nullptr;
- QLabel* stats_label_ = nullptr;
+
+ // Overview tiles
+ QLabel* stat_total_ = nullptr;
+ QLabel* stat_mapped_ = nullptr;
+ QLabel* stat_countries_ = nullptr;
+
+ // Top categories list
QVBoxLayout* stats_layout_ = nullptr;
+ // Hotspots (top countries) list
+ QVBoxLayout* hotspots_layout_ = nullptr;
+
// Selected event detail
+ QLabel* detail_title_ = nullptr;
QLabel* detail_category_ = nullptr;
QLabel* detail_country_ = nullptr;
QLabel* detail_city_ = nullptr;
- QLabel* detail_keywords_ = nullptr;
QLabel* detail_date_ = nullptr;
QLabel* detail_source_ = nullptr;
+ QPushButton* detail_open_btn_ = nullptr;
QWidget* detail_panel_ = nullptr;
+ QLabel* empty_state_ = nullptr;
+ QString current_url_;
};
} // namespace fincept::screens