00001 #ifndef RECORDTABLESCREEN_H_ 00002 #define RECORDTABLESCREEN_H_ 00003 00004 #include <QWidget> 00005 #include <QListView> 00006 #include <QToolButton> 00007 #include <QHBoxLayout> 00008 #include <QVBoxLayout> 00009 #include <QToolBar> 00010 #include <QStringList> 00011 00012 class recordtabledata; 00013 class recordtablemodel; 00014 00015 class recordtablescreen : public QWidget 00016 { 00017 Q_OBJECT 00018 00019 public: 00020 recordtablescreen(QWidget *parent=0); 00021 virtual ~recordtablescreen(); 00022 00023 QString get_currentdir(void); 00024 QString get_currentfile(void); 00025 QString get_fullfilename_of_currentitem(void); 00026 00027 void save(void); 00028 00029 void set_tabledata(recordtabledata *); 00030 00031 int get_first_selection_pos(void); 00032 void set_selection_to_pos(int pos); 00033 00034 bool is_selected_set_to_top(void); 00035 bool is_selected_set_to_bottom(void); 00036 00037 private slots: 00038 00039 // Реакия на сдвиг засветки клавишами или мышкой, 00040 // самодельный слот, активизируется в on_knowtree_clicked() 00041 void select(const QModelIndex &index); 00042 00043 // Обновление панели инструментов 00044 void tools_update(void); 00045 00046 // Открытие контекстного меню 00047 void on_customContextMenuRequested(const QPoint &pos); 00048 00049 // Вызов действий из контекстного меню для открытия окна с вводом новой записи 00050 void add_new_toend_context(void); 00051 void add_new_before_context(void); 00052 void add_new_after_context(void); 00053 00054 // Вызов действий из контекстного меню для редактирования инфополей записи 00055 void edit_field_context(void); 00056 00057 // Вызов действий из контекстного меню для удаления конечной записи 00058 void delete_context(void); 00059 00060 // Вызов действий для копирования записей в буфер обмена с удалением 00061 void cut(void); 00062 00063 // Вызов действий для копирования записей в буфер обмена 00064 void copy(void); 00065 00066 // Вызов действий для вставки записей из буфера 00067 void paste(void); 00068 00069 void moveup(void); 00070 void movedn(void); 00071 00072 void findinbase_open(void); 00073 00074 private: 00075 QToolBar *tools_line; 00076 QToolBar *find_line; 00077 00078 QListView *recordview; 00079 recordtablemodel *recordmodel; // Класс, расширенный от QAbstractListModel 00080 00081 QHBoxLayout *recordtable_tools_layout; 00082 QVBoxLayout *recordtablescreen_layout; 00083 00084 QAction *action_add_new_toend; 00085 QAction *action_add_new_before; 00086 QAction *action_add_new_after; 00087 QAction *action_edit_field; 00088 QAction *action_delete; 00089 QAction *action_cut; 00090 QAction *action_copy; 00091 QAction *action_paste; 00092 QAction *action_moveup; 00093 QAction *action_movedn; 00094 QAction *action_findinbase; 00095 00096 void setup_ui(void); 00097 void setup_signals(void); 00098 void setup_actions(void); 00099 void assembly(void); 00100 00101 QString recordview_currentdir; 00102 QString recordview_currentfile; 00103 00104 void disable_all_actions(void); 00105 00106 void add_new_record(int mode); 00107 void add_new(int mode, 00108 QString name, 00109 QString author, 00110 QString url, 00111 QString tags, 00112 QString text); 00113 00114 void edit_field(int pos, 00115 QString name, 00116 QString author, 00117 QString url, 00118 QString tags); 00119 00120 void delete_records(void); 00121 }; 00122 00123 #endif /* RECORDTABLESCREEN_H_ */