/* Marcion
Copyright (C) 2009-2013 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; either version 2 of the License, or
(at your option) any later version.
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
#ifndef BOOKWITHVERSES_H
#define BOOKWITHVERSES_H
#include "ui_bookwithverses.h"
#include "mdocumentbase.h"
#include "messages.h"
#include "settings.h"
#include "ctranslit.h"
#include "textbrowserext.h"
#include "msimulitem.h"
#include "libbase.h"
/*class BookRow
{
public:
BookRow(QString const & verse,
QString const & text,
QString const & note):_verse(verse),_text(text),_note(note){}
~BookRow(){}
QString const _verse,_text,_note;
};*/
class CSimulTreeItem : public QTreeWidgetItem
{
public:
CSimulTreeItem(bool is_book,QString const & title,int id,int text_format,int script);
bool _is_book;
QString _title;
int _id,_text_format,_script;
};
typedef QList<MTextLineItem> BookStore;
class CBookWithVerses : public QWidget, public MDocumentBase, private Ui::CBookWithVerses {
Q_OBJECT
Q_DISABLE_COPY(CBookWithVerses)
public:
enum Script{
Latin=1,Greek=2,Coptic=3,Hebrew=4
};
enum Mode{Book,Chapter};
enum TextFormat{Native=1,Beta=2,LatTr=3};
explicit CBookWithVerses(QString const & name,
Script script,
TextFormat textFormat,
int key,
Mode mode,
CMessages * const messages,
QString const & show_text=QString(),
QWidget *parent = 0);
void showBook(int book,int chapter);
void findVerse(int chapter, int verse);
void findChapter(int chapter, int verse=-1);
void cursorOnTop();
private slots:
void on_btShowPanel_clicked();
void on_btCopyExt2_clicked();
void on_btCopyExt_clicked();
void on_cbTable_toggled(bool checked);
void on_btShow_clicked();
void on_spnVerse_valueChanged(int );
void on_spnChapter_valueChanged(int );
void on_brBook_contentChanged(bool, bool, bool*);
//void on_brBook_highlightActivated(bool*);
//void on_brBook_highlightDeactivated(bool*);
void on_btBookMode_clicked(bool checked);
void on_tbSimul_toggled(bool checked);
void on_tbSimulAdd_clicked(bool checked);
void on_tbSimulRefreshLib_clicked();
void on_tbSimulHide_clicked();
void on_tbSimulToList_clicked();
void slot_simulAction(int);
void on_tbSimulUp_clicked();
void on_tbSimulDown_clicked();
void on_tbrSimulText_customContextMenuRequested(const QPoint & );
void on_tbSimulAction_clicked(bool checked);
/*void on_tbSimulFontPlus_clicked();
void on_tbSimulFontMinus_clicked();*/
void on_tbSimulPrev_clicked();
void on_tbSimulNext_clicked();
void on_treeSimulLibrary_customContextMenuRequested(const QPoint &);
void on_tblSimulTexts_customContextMenuRequested(const QPoint &);
private:
int key;
Mode mode;
CMessages * const messages;
Script script;
TextFormat textFormat;
BookStore store;
MButtonMenu popupSimul;
QAction *a_prev,*a_next,*a_lead,*a_wrap,*a_dict, *a_crum,*a_lsj,*a_searchlib,*a_copy,*a_copyall,*a_decf,*a_incf,*a_normf;
QMenu popupSimulC,popupSimulL;
QAction *ac_move,*ac_refresh,*al_remove,*al_rmall;
int _font_offset;
void displayStore();
QString get_query(int, int) const;
bool read_chapters(int book);
void convertTextItem(MTextLineItem & text_item,TextFormat text_format,Script script);
bool isSimulActivated() const;
void refresh_simul();
void setSimulHeaderLabels();
protected:
void keyPressEvent(QKeyEvent * event);
};
#endif // BOOKWITHVERSES_H