browserchooser 0.0.2
A simple browser chooser.
Loading...
Searching...
No Matches
selectorwidget.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <QtCore/QList>
5#include <QtCore/QMap>
6
7#include <QtWidgets/QCheckBox>
8#include <QtWidgets/QGridLayout>
9#include <QtWidgets/QLabel>
10#include <QtWidgets/QRadioButton>
11
12#include "browseroption.h"
13#include "draggablepopup.h"
14
15class QToolButton;
16class BrowserChooser;
17
21
22public:
28 explicit SelectorWidget(BrowserChooser *chooser, QWidget *parent = nullptr);
29
30private Q_SLOTS:
31 void onButtonClicked(int browserIndex);
32 void onRememberCheckBoxToggled(bool checked);
33 void onShowGuestCheckBoxToggled(bool checked);
34 void onHideBrowsersWithoutProfilesCheckBoxToggled(bool checked);
35
36protected:
37 void closeEvent(QCloseEvent *event) override;
38 void keyPressEvent(QKeyEvent *event) override;
39
40private:
41 void setupWindow();
42 QWidget *createBrowserEntry(const BrowserOption &option,
43 int index,
44 bool inSection = false,
45 bool browserNameOnly = false);
46 QString findIconPath(const QString &iconName);
47 QString getBaseDomain(const QString &domain);
48
49 static constexpr int kBrowsersPerRow = 5;
50 static constexpr int kIconSize = 48;
51 static constexpr int kEntryWidth = 100;
52
53 BrowserChooser *chooser_;
54 QLabel *urlLabel_ = nullptr;
55 QCheckBox *rememberCheckBox_ = nullptr;
56 QCheckBox *showGuestCheckBox_ = nullptr;
57 QCheckBox *hideBrowsersWithoutProfilesCheckBox_ = nullptr;
58 QWidget *guestSectionWidget_ = nullptr;
59 QWidget *otherSectionWidget_ = nullptr;
60 QRadioButton *exactDomainRadio_ = nullptr;
61 QRadioButton *wildcardDomainRadio_ = nullptr;
62 QWidget *radioContainer_ = nullptr;
63 QString domain_;
64 QString baseDomain_;
65 QString urlToOpen_;
66 QToolButton *firstButton_ = nullptr;
67 QMap<int, QString> tooltipByIndex_;
68};
Definition browserchooser.h:14
Definition browseroption.h:12
DraggablePopup(QWidget *parent=nullptr)
Definition draggablepopup.cpp:11
SelectorWidget(BrowserChooser *chooser, QWidget *parent=nullptr)
Definition selectorwidget.cpp:68
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
virtual bool event(QEvent *event) override