소스 검색

initial commit for VNote

VNote is a Vim-Like Note for Markdown.

Signed-off-by: Le Tan <[email protected]>
Le Tan 9 년 전
커밋
811172ef8a
8개의 변경된 파일174개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      VNote.pro
  2. 11 0
      main.cpp
  3. 14 0
      resources/welcome.html
  4. 6 0
      vdirectorytree.cpp
  5. 19 0
      vdirectorytree.h
  6. 64 0
      vmainwindow.cpp
  7. 32 0
      vmainwindow.h
  8. 5 0
      vnote.qrc

+ 23 - 0
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

+ 11 - 0
main.cpp

@@ -0,0 +1,11 @@
+#include "vmainwindow.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    VMainWindow w;
+    w.show();
+
+    return a.exec();
+}

+ 14 - 0
resources/welcome.html

@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>Welcome VNote</title>
+</head>
+<body id="preview">
+    <h1>Welcome to VNote</h1>
+    <h2>A Vim-Like Note for Markdown</h2>
+    <p>Under development by Le Tan.
+Please contact <a href="mailto:[email protected]">[email protected]</a> if you have any questions.
+    </p>
+</body>
+</html>

+ 6 - 0
vdirectorytree.cpp

@@ -0,0 +1,6 @@
+#include <QtGui>
+#include "vdirectorytree.h"
+
+VDirectoryTree::VDirectoryTree(QWidget *parent) : QTreeWidget(parent)
+{
+}

+ 19 - 0
vdirectorytree.h

@@ -0,0 +1,19 @@
+#ifndef VDIRECTORYTREE_H
+#define VDIRECTORYTREE_H
+
+#include <QTreeWidget>
+
+class VDirectoryTree : public QTreeWidget
+{
+    Q_OBJECT
+public:
+    explicit VDirectoryTree(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+private:
+};
+
+#endif // VDIRECTORYTREE_H

+ 64 - 0
vmainwindow.cpp

@@ -0,0 +1,64 @@
+#include <QtGui>
+#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);
+}

+ 32 - 0
vmainwindow.h

@@ -0,0 +1,32 @@
+#ifndef VMAINWINDOW_H
+#define VMAINWINDOW_H
+
+#include <QMainWindow>
+
+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

+ 5 - 0
vnote.qrc

@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>resources/welcome.html</file>
+</qresource>
+</RCC>