mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00

Add menu action importNoteAct to import notes from files. Currently only HTML and Markdown files are supported. Importing other files (such as txt) may not work correctly. Signed-off-by: Le Tan <tamlokveer@gmail.com>
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
#ifndef VMAINWINDOW_H
|
|
#define VMAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
|
|
class QLabel;
|
|
class QComboBox;
|
|
class VDirectoryTree;
|
|
class QSplitter;
|
|
class QListWidget;
|
|
class QTabWidget;
|
|
class QToolBar;
|
|
class VNote;
|
|
class VFileList;
|
|
class VTabWidget;
|
|
class QAction;
|
|
class QPushButton;
|
|
class VNotebook;
|
|
|
|
class VMainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
VMainWindow(QWidget *parent = 0);
|
|
~VMainWindow();
|
|
|
|
private slots:
|
|
// Change current notebook index and update the directory tree
|
|
void setCurNotebookIndex(int index);
|
|
// Create a notebook
|
|
void onNewNotebookBtnClicked();
|
|
void onDeleteNotebookBtnClicked();
|
|
void updateNotebookComboBox(const QVector<VNotebook> ¬ebooks);
|
|
void importNoteFromFile();
|
|
|
|
signals:
|
|
void curNotebookIndexChanged(const QString &path);
|
|
|
|
private:
|
|
void setupUI();
|
|
void initActions();
|
|
void initToolBar();
|
|
void initMenuBar();
|
|
bool isConflictWithExistingNotebooks(const QString &name, const QString &path);
|
|
|
|
QLabel *notebookLabel;
|
|
QLabel *directoryLabel;
|
|
QComboBox *notebookComboBox;
|
|
QPushButton *newNotebookBtn;
|
|
QPushButton *deleteNotebookBtn;
|
|
QPushButton *notebookInfoBtn;
|
|
VDirectoryTree *directoryTree;
|
|
VFileList *fileList;
|
|
VTabWidget *tabs;
|
|
QSplitter *mainSplitter;
|
|
VNote *vnote;
|
|
|
|
// Actions
|
|
QAction *editNoteAct;
|
|
QAction *saveNoteAct;
|
|
QAction *readNoteAct;
|
|
QAction *importNoteAct;
|
|
};
|
|
|
|
#endif // VMAINWINDOW_H
|