mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
initial commit for VNote
VNote is a Vim-Like Note for Markdown. Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
commit
811172ef8a
23
VNote.pro
Normal file
23
VNote.pro
Normal file
@ -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
main.cpp
Normal file
11
main.cpp
Normal file
@ -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
resources/welcome.html
Normal file
14
resources/welcome.html
Normal file
@ -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:tamlokveer@gmail.com">tamlokveer@gmail.com</a> if you have any questions.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
6
vdirectorytree.cpp
Normal file
6
vdirectorytree.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <QtGui>
|
||||||
|
#include "vdirectorytree.h"
|
||||||
|
|
||||||
|
VDirectoryTree::VDirectoryTree(QWidget *parent) : QTreeWidget(parent)
|
||||||
|
{
|
||||||
|
}
|
19
vdirectorytree.h
Normal file
19
vdirectorytree.h
Normal file
@ -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
vmainwindow.cpp
Normal file
64
vmainwindow.cpp
Normal file
@ -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
vmainwindow.h
Normal file
32
vmainwindow.h
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user