/* Marcion
Copyright (C) 2009 - 2011 Milan Konvicka
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program */
#ifndef LIBRARYSEARCH_H
#define LIBRARYSEARCH_H
#include "ui_librarysearch.h"
#include <QMenu>
#include <QProcess>
#include "ctranslit.h"
#include "messages.h"
#include "settings.h"
#include "searchcriteria2.h"
#include "libsearchresult.h"
#include "librarywidget.h"
#include "libsearchbase.h"
#include "mlibsearchtitle.h"
#define SPEC_INDEX_COUNT 2
class CLibrarySearch : public QWidget, public CLibSearchBase, private Ui::CLibrarySearch {
Q_OBJECT
Q_DISABLE_COPY(CLibrarySearch)
public:
friend class MainWnd;
explicit CLibrarySearch(CMessages * const messages,
CLibraryWidget * const libw,
MLibSearchTitle & title,
QWidget *parent = 0);
void searchCoptic(QString const & text);
QWidget & dialog(){return c_d;}
void event_Query();
void event_Refresh();
void event_stateChanged();
private slots:
void on_txtSwInput_returnPressed();
void on_btSwPar_clicked();
void on_btSwPhrase_clicked();
void on_btSwQuest_clicked();
void on_btSwAst_clicked();
void on_btSwNear_clicked();
void on_btSwNot_clicked();
void on_btSwOr_clicked();
void on_btSwAnd_clicked();
void on_btAction_clicked();
void on_treeColl_itemChanged(QTreeWidgetItem* item, int column);
void on_treeColl_customContextMenuRequested(QPoint pos);
void on_tabColl_currentChanged(int index);
void on_btRmNW_clicked();
void on_inputText_query();
//void on_cmbLang_currentIndexChanged(int index);
void on_btEdit_clicked();
void on_cmbScriptLang_currentIndexChanged(int index);
void indexChangedSlot(bool);
void settings_fontChanged(CTranslit::Script, QFont);
void slot_requestTitle(int);
//void slot_searchInLibrary(QString);
private:
CMessages * const messages;
CLibraryWidget * const libw;
MLibSearchTitle & title;
void init();
bool is_initialized;
QString where_collection(char *,QString &,QString &) const;
void collectCheckedHtmlLibItems(QList<QTreeWidgetItem*> &,QTreeWidgetItem*);
QList<QTreeWidgetItem> coll;
CSearchCriteria2 c_d;
void query();
void queryHtml();
void readBooks(QTreeWidgetItem *);
void removeBooks(QTreeWidgetItem *);
void checkAllBooks(QTreeWidgetItem *);
//QString makeLinks(QString const &) const;
QTreeWidget * htmlTree(){return treeHtmlLib;}
QMenu pmenu;
QAction * a_readbooks,*a_hidebooks;
bool disable_itch,bt_action;
};
#endif // LIBRARYSEARCH_H