commit 811172ef8a83100355392191bd4d6516d3b56c24 Author: Le Tan Date: Sat Oct 1 15:33:02 2016 +0800 initial commit for VNote VNote is a Vim-Like Note for Markdown. Signed-off-by: Le Tan diff --git a/VNote.pro b/VNote.pro new file mode 100644 index 00000000..0bd30c5e --- /dev/null +++ b/VNote.pro @@ -0,0 +1,23 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-10-01T11:03:59 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = VNote +TEMPLATE = app + + +SOURCES += main.cpp\ + vmainwindow.cpp \ + vdirectorytree.cpp + +HEADERS += vmainwindow.h \ + vdirectorytree.h + +RESOURCES += \ + vnote.qrc diff --git a/main.cpp b/main.cpp new file mode 100644 index 00000000..60bc48e8 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "vmainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + VMainWindow w; + w.show(); + + return a.exec(); +} diff --git a/resources/welcome.html b/resources/welcome.html new file mode 100644 index 00000000..ea85947f --- /dev/null +++ b/resources/welcome.html @@ -0,0 +1,14 @@ + + + + + Welcome VNote + + +

Welcome to VNote

+

A Vim-Like Note for Markdown

+

Under development by Le Tan. +Please contact tamlokveer@gmail.com if you have any questions. +

+ + diff --git a/vdirectorytree.cpp b/vdirectorytree.cpp new file mode 100644 index 00000000..7c9996d1 --- /dev/null +++ b/vdirectorytree.cpp @@ -0,0 +1,6 @@ +#include +#include "vdirectorytree.h" + +VDirectoryTree::VDirectoryTree(QWidget *parent) : QTreeWidget(parent) +{ +} diff --git a/vdirectorytree.h b/vdirectorytree.h new file mode 100644 index 00000000..3c2d62d3 --- /dev/null +++ b/vdirectorytree.h @@ -0,0 +1,19 @@ +#ifndef VDIRECTORYTREE_H +#define VDIRECTORYTREE_H + +#include + +class VDirectoryTree : public QTreeWidget +{ + Q_OBJECT +public: + explicit VDirectoryTree(QWidget *parent = 0); + +signals: + +public slots: + +private: +}; + +#endif // VDIRECTORYTREE_H diff --git a/vmainwindow.cpp b/vmainwindow.cpp new file mode 100644 index 00000000..83044d41 --- /dev/null +++ b/vmainwindow.cpp @@ -0,0 +1,64 @@ +#include +#include "vmainwindow.h" +#include "vdirectorytree.h" + +VMainWindow::VMainWindow(QWidget *parent) + : QMainWindow(parent) +{ + setupUI(); +} + +VMainWindow::~VMainWindow() +{ + +} + +void VMainWindow::setupUI() +{ + // Notebook directory browser tree + notebookLabel = new QLabel(tr("&Notebook")); + notebookComboBox = new QComboBox(); + notebookLabel->setBuddy(notebookComboBox); + directoryTree = new VDirectoryTree(); + + QHBoxLayout *nbTopLayout = new QHBoxLayout; + notebookComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + nbTopLayout->setAlignment(Qt::AlignLeft); + nbTopLayout->addWidget(notebookLabel); + nbTopLayout->addWidget(notebookComboBox); + + QVBoxLayout *nbLayout = new QVBoxLayout; + nbLayout->addLayout(nbTopLayout); + nbLayout->addWidget(directoryTree); + QWidget *nbContainer = new QWidget(); + nbContainer->setLayout(nbLayout); + nbContainer->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); + + // File list widget + fileListWidget = new QListWidget(); + fileListWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); + + // Editor tab widget + editorTabWidget = new QTabWidget(); + editorTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + QFile welcomeFile(":/resources/welcome.html"); + QString welcomeText("Welcome to VNote!"); + if (welcomeFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + welcomeText = QString(welcomeFile.readAll()); + welcomeFile.close(); + } + QTextBrowser *welcomePage = new QTextBrowser(); + welcomePage->setHtml(welcomeText); + editorTabWidget->addTab(welcomePage, tr("Welcome to VNote")); + + // Main Splitter + mainSplitter = new QSplitter(); + mainSplitter->addWidget(nbContainer); + mainSplitter->addWidget(fileListWidget); + mainSplitter->addWidget(editorTabWidget); + mainSplitter->setStretchFactor(0, 1); + mainSplitter->setStretchFactor(1, 1); + mainSplitter->setStretchFactor(2, 10); + + setCentralWidget(mainSplitter); +} diff --git a/vmainwindow.h b/vmainwindow.h new file mode 100644 index 00000000..758c16d4 --- /dev/null +++ b/vmainwindow.h @@ -0,0 +1,32 @@ +#ifndef VMAINWINDOW_H +#define VMAINWINDOW_H + +#include + +class QLabel; +class QComboBox; +class VDirectoryTree; +class QSplitter; +class QListWidget; +class QTabWidget; + +class VMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + VMainWindow(QWidget *parent = 0); + ~VMainWindow(); + +private: + void setupUI(); + + QLabel *notebookLabel; + QComboBox *notebookComboBox; + VDirectoryTree *directoryTree; + QListWidget *fileListWidget; + QTabWidget *editorTabWidget; + QSplitter *mainSplitter; +}; + +#endif // VMAINWINDOW_H diff --git a/vnote.qrc b/vnote.qrc new file mode 100644 index 00000000..37ea16b5 --- /dev/null +++ b/vnote.qrc @@ -0,0 +1,5 @@ + + + resources/welcome.html + +