game_list: move SearchField to game_list_p.h and fix untranslated text

I have tested and made sure the text is translatable, but this would require a translation update to take effect.
This commit is contained in:
zhupengfei 2018-07-23 18:43:34 +08:00
parent 87872aa369
commit 11da018ea6
No known key found for this signature in database
GPG key ID: 85B82A3E62174206
3 changed files with 54 additions and 39 deletions

View file

@ -12,6 +12,7 @@
class GameListWorker;
class GameListDir;
class GameListSearchField;
class GMainWindow;
class QFileSystemWatcher;
class QHBoxLayout;
@ -41,37 +42,6 @@ public:
COLUMN_COUNT, // Number of columns
};
class SearchField : public QWidget {
public:
explicit SearchField(GameList* parent = nullptr);
void setFilterResult(int visible, int total);
void clear();
void setFocus();
int visible;
int total;
private:
class KeyReleaseEater : public QObject {
public:
explicit KeyReleaseEater(GameList* gamelist);
private:
GameList* gamelist = nullptr;
QString edit_filter_text_old;
protected:
bool eventFilter(QObject* obj, QEvent* event) override;
};
QHBoxLayout* layout_filter = nullptr;
QTreeView* tree_view = nullptr;
QLabel* label_filter = nullptr;
QLineEdit* edit_filter = nullptr;
QLabel* label_filter_result = nullptr;
QToolButton* button_filter_close = nullptr;
};
explicit GameList(GMainWindow* parent = nullptr);
~GameList() override;
@ -121,7 +91,7 @@ private:
void AddCustomDirPopup(QMenu& context_menu, QModelIndex selected);
void AddPermDirPopup(QMenu& context_menu, QModelIndex selected);
SearchField* search_field;
GameListSearchField* search_field;
GMainWindow* main_window = nullptr;
QVBoxLayout* layout = nullptr;
QTreeView* tree_view = nullptr;
@ -129,6 +99,8 @@ private:
GameListWorker* current_worker = nullptr;
QFileSystemWatcher* watcher = nullptr;
std::unordered_map<std::string, std::pair<QString, QString>> compatibility_list;
friend class GameListSearchField;
};
Q_DECLARE_METATYPE(GameListOpenTarget);