Make the search widget functional
This commit is contained in:
		
					parent
					
						
							
								f4842f7eb9
							
						
					
				
			
			
				commit
				
					
						45016bd3a2
					
				
			
		
					 3 changed files with 71 additions and 1 deletions
				
			
		| 
						 | 
					@ -2,6 +2,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(danbooru_client_SRCS
 | 
					set(danbooru_client_SRCS
 | 
				
			||||||
    danbooruconnectwidget.cpp
 | 
					    danbooruconnectwidget.cpp
 | 
				
			||||||
 | 
					    danboorusearchwidget.cpp
 | 
				
			||||||
    model/danboorupostdelegate.cpp
 | 
					    model/danboorupostdelegate.cpp
 | 
				
			||||||
    model/danboorupostmodel.cpp
 | 
					    model/danboorupostmodel.cpp
 | 
				
			||||||
    model/danboorupoolmodel.cpp
 | 
					    model/danboorupoolmodel.cpp
 | 
				
			||||||
| 
						 | 
					@ -17,7 +18,8 @@ include_directories(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ki18n_wrap_ui(danbooru_client_SRCS
 | 
					ki18n_wrap_ui(danbooru_client_SRCS
 | 
				
			||||||
              ui/generalpage.ui
 | 
					              ui/generalpage.ui
 | 
				
			||||||
              ui/danbooruconnectwidget.ui)
 | 
					              ui/danbooruconnectwidget.ui
 | 
				
			||||||
 | 
					              ui/searchwidget.ui)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kconfig_add_kcfg_files(danbooru_client_SRCS danboorusettings.kcfgc)
 | 
					kconfig_add_kcfg_files(danbooru_client_SRCS danboorusettings.kcfgc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,4 +17,41 @@
 | 
				
			||||||
 * along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
 | 
					 * along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "danboorusearchwidget.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QPushButton>
 | 
				
			||||||
 | 
					#include <QLineEdit>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Danbooru {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DanbooruSearchWidget::DanbooruSearchWidget(QWidget* parent): QWidget(parent)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    setupUi(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    connect(searchButton, &QPushButton::clicked, this, &DanbooruSearchWidget::accept);
 | 
				
			||||||
 | 
					    connect(tagLineEdit, &QLineEdit::returnPressed, this, &DanbooruSearchWidget::accept);
 | 
				
			||||||
 | 
					    connect(closeButton, &QPushButton::clicked, [this]() { Q_EMIT(rejected()); });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DanbooruSearchWidget::~DanbooruSearchWidget()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QStringList DanbooruSearchWidget::selectedTags() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return m_tags;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DanbooruSearchWidget::accept() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(tagLineEdit->text().isEmpty()) {
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_tags = tagLineEdit->text().split(",");
 | 
				
			||||||
 | 
					    Q_EMIT(accepted());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // namespace Danbooru
 | 
				
			||||||
| 
						 | 
					@ -17,4 +17,35 @@
 | 
				
			||||||
 * along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
 | 
					 * along with Danbooru Client. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef DANBOORU_SEARCHWIDGET_H
 | 
				
			||||||
 | 
					#define DANBOORU_SEARCHWIDGET_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "ui_searchwidget.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Danbooru {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    class DanbooruSearchWidget: public QWidget, Ui::SearchWidget {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Q_OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public:
 | 
				
			||||||
 | 
					        explicit DanbooruSearchWidget(QWidget *parent = 0);
 | 
				
			||||||
 | 
					        ~DanbooruSearchWidget();
 | 
				
			||||||
 | 
					        QStringList selectedTags() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private:
 | 
				
			||||||
 | 
					        QStringList m_tags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Q_SLOTS:
 | 
				
			||||||
 | 
					        void accept();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Q_SIGNALS:
 | 
				
			||||||
 | 
					        void accepted();
 | 
				
			||||||
 | 
					        void rejected();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // namespace Danbooru
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue