Hydra 0.20
|
00001 00002 /* 00003 * Copyright (c) 2010 Aleksander B. Demko 00004 * This source code is distributed under the MIT license. 00005 * See the accompanying file LICENSE.MIT.txt for details. 00006 */ 00007 00008 #ifndef __INCLUDED_HYDRADESKTOP_SEARCHVIEW_H__ 00009 #define __INCLUDED_HYDRADESKTOP_SEARCHVIEW_H__ 00010 00011 #include <QLineEdit> 00012 #include <QHBoxLayout> 00013 00014 #include <hydra/Query.h> 00015 #include <desktop/View.h> 00016 00017 namespace desktop 00018 { 00019 class SearchView; 00020 class SearchSelectView; 00021 } 00022 00023 /** 00024 * A view that presents a tag search box to the user, with four VCR 00025 * controls for advancing based on that search. 00026 * 00027 * @author Aleksander Demko 00028 */ 00029 class desktop::SearchView : public desktop::View 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 SearchView(FileList *_filelist); 00035 00036 protected slots: 00037 void onClear(void); 00038 void onFirst(void); 00039 void onPrev(void); 00040 void onNext(void); 00041 void onLast(void); 00042 00043 protected: 00044 void initGui(void); 00045 bool verifyQuery(void); 00046 void search(int starti, int delta); 00047 00048 protected: 00049 QLineEdit *dm_query; 00050 00051 QString dm_last_query; 00052 std::tr1::shared_ptr<hydra::Token> dm_last_tok; // null if the last query isnt valid 00053 00054 QHBoxLayout *dm_buttonbox; 00055 }; 00056 00057 /** 00058 * Adds a "selected-by-tags" option to SearchView. 00059 * 00060 * @author Aleksander Demko 00061 */ 00062 class desktop::SearchSelectView : public desktop::SearchView 00063 { 00064 Q_OBJECT 00065 00066 public: 00067 SearchSelectView(FileList *_filelist); 00068 00069 protected slots: 00070 void onHighlight(void); 00071 00072 protected: 00073 void initGui(void); 00074 00075 }; 00076 00077 #endif 00078