mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-11 01:44:58 -06:00
Implement enum support in CachedSettingValue
Enums are stored as strings, that improves configuration file readability and maintainability. String values are obtained via QMetaEnum, and since with Qt 5.5 QMetaEnum::fromType() includes a static_assert, this has to be a safe method.
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#ifndef SEARCHTAB_H
|
||||
#define SEARCHTAB_H
|
||||
|
||||
#include <QVariant> // I don't know why <QMetaType> is not enought for Qt's 4.8.7 moc
|
||||
#include <QWidget>
|
||||
|
||||
#define ENGINE_URL_COLUMN 4
|
||||
@@ -44,6 +43,8 @@ class QHeaderView;
|
||||
class QStandardItemModel;
|
||||
class QVBoxLayout;
|
||||
|
||||
template <typename T> class CachedSettingValue;
|
||||
|
||||
class SearchSortModel;
|
||||
class SearchListDelegate;
|
||||
class SearchWidget;
|
||||
@@ -59,13 +60,13 @@ class SearchTab: public QWidget
|
||||
|
||||
public:
|
||||
|
||||
enum NameFilteringMode
|
||||
enum class NameFilteringMode
|
||||
{
|
||||
Everywhere,
|
||||
OnlyNames
|
||||
};
|
||||
|
||||
Q_ENUMS(NameFilteringMode)
|
||||
Q_ENUM(NameFilteringMode)
|
||||
|
||||
explicit SearchTab(SearchWidget *parent);
|
||||
~SearchTab();
|
||||
@@ -106,6 +107,8 @@ private:
|
||||
static QString statusText(Status st);
|
||||
static QString statusIconName(Status st);
|
||||
|
||||
static CachedSettingValue<NameFilteringMode>& nameFilteringModeSetting();
|
||||
|
||||
Ui::SearchTab *m_ui;
|
||||
QTreeView *m_resultsBrowser;
|
||||
QStandardItemModel *m_searchListModel;
|
||||
|
||||
Reference in New Issue
Block a user