11#pragma once
22
3- #include < QFrame>
43#include < QString>
54#include < QStringList>
65#include < QList>
76#include < functional>
87#include < utility>
98
9+ #include " include/ui/widget/TrayPopupFrame.hpp"
10+
1011class QLabel ;
11- class QLineEdit ;
12- class QListWidget ;
1312class QListWidgetItem ;
1413class QPushButton ;
1514class QTimer ;
@@ -26,7 +25,7 @@ class QTimer;
2625// Behaviour: a rounded card with a debounced search box on top over a compact, paginated
2726// list. A single click (or Enter) selects; it closes when it loses focus (like a menu) and
2827// also has an explicit Close button.
29- class TrayProfileSelector : public QFrame {
28+ class TrayProfileSelector : public TrayPopupFrame {
3029 Q_OBJECT
3130public:
3231 enum Mode { Server, Routing };
@@ -45,14 +44,11 @@ class TrayProfileSelector : public QFrame {
4544
4645 TrayProfileSelector (Mode mode, Callbacks cb, QWidget *parent = nullptr );
4746
48- // Show the panel anchored near globalPos (kept fully on the containing screen) and
49- // focus the search box. Resets navigation/search to the top level first.
50- void popupAt (const QPoint &globalPos);
51-
5247protected:
5348 bool event (QEvent *e) override ; // close when the panel loses activation
54- void keyPressEvent (QKeyEvent *e) override ; // Esc closes
5549 bool eventFilter (QObject *obj, QEvent *e) override ; // list/search key handling
50+ void preparePopup () override ;
51+ void afterShow () override ;
5652
5753private:
5854 void rebuild (); // repopulate for the current view/query/page
@@ -80,12 +76,10 @@ class TrayProfileSelector : public QFrame {
8076 QList<std::pair<int , QString>> m_routeCache;
8177 QStringList m_routeCacheLower;
8278
83- QLineEdit *m_search = nullptr ;
8479 QTimer *m_debounce = nullptr ;
8580 QPushButton *m_backBtn = nullptr ;
8681 QLabel *m_title = nullptr ;
8782 QPushButton *m_stopBtn = nullptr ;
88- QListWidget *m_list = nullptr ;
8983 QPushButton *m_prevBtn = nullptr ;
9084 QLabel *m_pageLabel = nullptr ;
9185 QPushButton *m_nextBtn = nullptr ;
0 commit comments