Compare commits
3 Commits
c4d74bb22b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dab0f14d34 | |||
| 03ccf03808 | |||
| cdeb1205ef |
@@ -7,7 +7,7 @@ CONFIG += c++17
|
|||||||
win32:VERSION = 3.0.0.0 # major.minor.patch.build
|
win32:VERSION = 3.0.0.0 # major.minor.patch.build
|
||||||
else:VERSION = 3.0.0 # major.minor.patch
|
else:VERSION = 3.0.0 # major.minor.patch
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}-rc2\\\"\"
|
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||||
DEFINES += APP_NAME=\"\\\"WorkPad\\\"\"
|
DEFINES += APP_NAME=\"\\\"WorkPad\\\"\"
|
||||||
|
|
||||||
# remove possible other optimization flags
|
# remove possible other optimization flags
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
margin: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-body .octicon {
|
.markdown-body .octicon {
|
||||||
|
|||||||
@@ -27,15 +27,14 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(ui->actionAdd, &QAction::triggered, this, &MainWindow::createNote);
|
connect(ui->actionAdd, &QAction::triggered, this, &MainWindow::createNote);
|
||||||
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::save);
|
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::save);
|
||||||
connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::showSettingsBox);
|
connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::showSettingsBox);
|
||||||
connect(ui->contentEdit, &QPlainTextEdit::textChanged, this, &MainWindow::markdownContentChanged);
|
|
||||||
connect(ui->plainTextEdit, &QPlainTextEdit::textChanged, this, &MainWindow::plainContentChanged);
|
connect(ui->plainTextEdit, &QPlainTextEdit::textChanged, this, &MainWindow::plainContentChanged);
|
||||||
connect(ui->treeWidget, &QTreeWidget::itemSelectionChanged, this, &MainWindow::selectionChanged);
|
connect(ui->treeWidget, &QTreeWidget::itemSelectionChanged, this, &MainWindow::selectionChanged);
|
||||||
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &MainWindow::prepareMenu);
|
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &MainWindow::prepareMenu);
|
||||||
connect(this, &MainWindow::updateViewers, this, &MainWindow::viewReady);
|
connect(this, &MainWindow::updateViewers, this, &MainWindow::viewReady);
|
||||||
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
ui->contentEdit->setFont(fixedFont);
|
|
||||||
ui->plainTextEdit->setFont(fixedFont);
|
ui->plainTextEdit->setFont(fixedFont);
|
||||||
ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
ui->renderingProgressBar->setVisible(false);
|
||||||
this->savemng = new SaveManager();
|
this->savemng = new SaveManager();
|
||||||
this->cfgmng = new ConfigManager();
|
this->cfgmng = new ConfigManager();
|
||||||
updateListView();
|
updateListView();
|
||||||
@@ -131,19 +130,14 @@ void MainWindow::selectionChanged()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui->plainTextEdit->blockSignals(true);
|
ui->plainTextEdit->blockSignals(true);
|
||||||
ui->contentEdit->blockSignals(true);
|
|
||||||
|
|
||||||
this->setWindowTitle(n->getTitle() + " - WorkPad");
|
this->setWindowTitle(n->getTitle() + " - WorkPad");
|
||||||
|
|
||||||
ui->titleLabel->setText(n->getTitle());
|
|
||||||
ui->plainTextEdit->setDisabled(false);
|
ui->plainTextEdit->setDisabled(false);
|
||||||
ui->contentEdit->setDisabled(false);
|
|
||||||
ui->plainTextEdit->setPlainText(n->getContent());
|
ui->plainTextEdit->setPlainText(n->getContent());
|
||||||
ui->contentEdit->setPlainText(n->getContent());
|
|
||||||
updateHTMLView();
|
updateHTMLView();
|
||||||
|
|
||||||
ui->plainTextEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->contentEdit->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -390,29 +384,28 @@ void MainWindow::exportNote()
|
|||||||
|
|
||||||
void MainWindow::viewReady(QString html)
|
void MainWindow::viewReady(QString html)
|
||||||
{
|
{
|
||||||
|
if (queue->count() == 0)
|
||||||
|
{
|
||||||
|
ui->renderingProgressBar->setVisible(false);
|
||||||
|
}
|
||||||
ui->webEngineViewer->setHtml(html);
|
ui->webEngineViewer->setHtml(html);
|
||||||
ui->webEngineEditor->setHtml(html);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::markdownContentChanged()
|
void MainWindow::markdownContentChanged()
|
||||||
{
|
{
|
||||||
timer->stop();
|
timer->stop();
|
||||||
ui->plainTextEdit->blockSignals(true);
|
ui->plainTextEdit->blockSignals(true);
|
||||||
ui->contentEdit->blockSignals(true);
|
|
||||||
if (ui->treeWidget->selectedItems().length() == 1)
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
{
|
{
|
||||||
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
||||||
Note *n = savemng->getNoteByUUID(uuid);
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
if (n != nullptr) {
|
if (n != nullptr) {
|
||||||
|
QString content = ui->plainTextEdit->toPlainText();
|
||||||
QString content = ui->contentEdit->toPlainText();
|
|
||||||
ui->plainTextEdit->setPlainText(content);
|
|
||||||
n->setContent(content);
|
n->setContent(content);
|
||||||
updateHTMLView();
|
updateHTMLView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->plainTextEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->contentEdit->blockSignals(false);
|
|
||||||
ui->actionSave->setDisabled(false);
|
ui->actionSave->setDisabled(false);
|
||||||
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
||||||
{
|
{
|
||||||
@@ -424,20 +417,17 @@ void MainWindow::plainContentChanged()
|
|||||||
{
|
{
|
||||||
timer->stop();
|
timer->stop();
|
||||||
ui->plainTextEdit->blockSignals(true);
|
ui->plainTextEdit->blockSignals(true);
|
||||||
ui->contentEdit->blockSignals(true);
|
|
||||||
if (ui->treeWidget->selectedItems().length() == 1)
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
{
|
{
|
||||||
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
||||||
Note *n = savemng->getNoteByUUID(uuid);
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
if (n != nullptr) {
|
if (n != nullptr) {
|
||||||
QString content = ui->plainTextEdit->toPlainText();
|
QString content = ui->plainTextEdit->toPlainText();
|
||||||
ui->contentEdit->setPlainText(content);
|
|
||||||
n->setContent(content);
|
n->setContent(content);
|
||||||
updateHTMLView();
|
updateHTMLView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->plainTextEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->contentEdit->blockSignals(false);
|
|
||||||
ui->actionSave->setDisabled(false);
|
ui->actionSave->setDisabled(false);
|
||||||
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
||||||
{
|
{
|
||||||
@@ -469,6 +459,7 @@ void MainWindow::updateListView()
|
|||||||
void MainWindow::updateHTMLView()
|
void MainWindow::updateHTMLView()
|
||||||
{
|
{
|
||||||
queueMutex->lock();
|
queueMutex->lock();
|
||||||
|
ui->renderingProgressBar->setVisible(true);
|
||||||
if (queue->count() > 4) {
|
if (queue->count() > 4) {
|
||||||
queue->pop_front();
|
queue->pop_front();
|
||||||
}
|
}
|
||||||
@@ -478,18 +469,12 @@ void MainWindow::updateHTMLView()
|
|||||||
|
|
||||||
void MainWindow::clearAndDisableFields()
|
void MainWindow::clearAndDisableFields()
|
||||||
{
|
{
|
||||||
ui->contentEdit->blockSignals(true);
|
|
||||||
ui->plainTextEdit->blockSignals(true);
|
ui->plainTextEdit->blockSignals(true);
|
||||||
|
|
||||||
|
|
||||||
ui->contentEdit->setDisabled(true);
|
|
||||||
ui->plainTextEdit->setDisabled(true);
|
ui->plainTextEdit->setDisabled(true);
|
||||||
ui->plainTextEdit->clear();
|
ui->plainTextEdit->clear();
|
||||||
ui->contentEdit->clear();
|
|
||||||
ui->titleLabel->setText("");
|
|
||||||
this->setWindowTitle("WorkPad");
|
this->setWindowTitle("WorkPad");
|
||||||
|
|
||||||
ui->contentEdit->blockSignals(false);
|
|
||||||
ui->plainTextEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,66 +25,6 @@
|
|||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeWidget" name="treeWidget">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>250</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="animated">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Workspace</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Orientation::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="titleLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>14</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="tabPosition">
|
|
||||||
<enum>QTabWidget::TabPosition::South</enum>
|
|
||||||
</property>
|
|
||||||
<property name="tabShape">
|
|
||||||
<enum>QTabWidget::TabShape::Rounded</enum>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab_3">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Plain text</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -93,66 +33,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Markdown editor</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QPlainTextEdit" name="contentEdit">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<kerning>false</kerning>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QPlainTextEdit::LineWrapMode::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWebEngineView" name="webEngineEditor" native="true">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>400</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Markdown viewer</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWebEngineView" name="webEngineViewer" native="true"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -191,6 +71,96 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>84</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::DockWidgetFeature::DockWidgetFloatable|QDockWidget::DockWidgetFeature::DockWidgetMovable</set>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>2</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QWebEngineView" name="webEngineViewer" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="renderingProgressBar">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>120</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::DockWidgetFeature::NoDockWidgetFeatures</set>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>1</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_3">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="animated">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Workspace</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<action name="actionAdd">
|
<action name="actionAdd">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|||||||
Reference in New Issue
Block a user