Skip to content

Commit 1f9952d

Browse files
authored
Merge branch 'master' into dz
2 parents fc17981 + e46fcbf commit 1f9952d

File tree

14 files changed

+692
-581
lines changed

14 files changed

+692
-581
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ Thumbs.db
7373
*.exe
7474
.VS
7575
build
76-
test.*
76+
test*
7777
.vscode
7878
.VSCodeCounter

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ set(PROJECT_SOURCES
3636
src/common.h
3737
src/common.cpp
3838
src/menu.cpp
39+
src/global.cpp
3940
${TS_FILES}
4041
${qrc_FILES}
4142
)

OneMarkdown_zh_CN.ts

Lines changed: 546 additions & 534 deletions
Large diffs are not rendered by default.

data/icon/ProMakr.png

3.87 KB
Loading

data/icon/btn_source_code.png

840 Bytes
Loading

data/img.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<file>icon/btn_side_bar_hide.png</file>
77
<file>icon/btn_side_bar_hover.png</file>
88
<file>icon/btn_side_bar_show.png</file>
9+
<file>icon/btn_source_code.png</file>
910
</qresource>
1011
</RCC>

include/global.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#ifndef GLOBAL_H
22
#define GLOBAL_H
33
#include <string>
4+
#include <QString>
45
const int TAB_WIDTH = 4;
5-
6-
// QString CURRENT_FILE="NULL";
6+
extern bool IS_FILE_SAVED;
7+
extern QString CURRENT_FILE;
78
#endif // GLOBAL_H

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# 一个优秀的Markdown编辑器
2+
23
<div align="center">
34
<img src="./data/icon/ProMakr.png">
45
</div>
@@ -15,9 +16,14 @@
1516
</a>
1617
</div>
1718

19+
<div align="center" style="font-size:66px">
20+
<span style="color:#BB2E2E">更快、</span><span style="color:#BB2E2E">更强、</span><span style="color:#BB2E2E">更开源</span>
21+
</div>
22+
1823
## 致谢
1924

2025
[Markdown转HTML](https://github.com/progsource/maddy)
26+
2127
<!--
2228
git config --global http.https://github.com.proxy socks5://127.0.0.1:7890
2329

src/OneMarkdown.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,21 @@ void OneMarkdown::textEdit_textChanged()
4949
{
5050
// disconnect 可以使得编辑textedit内容的时候不陷入死循环
5151
disconnect(ui->textEdit, &QTextEdit::textChanged, this, &OneMarkdown::textEdit_textChanged);
52+
53+
if(IS_FILE_SAVED){
54+
IS_FILE_SAVED = false;
55+
}
5256
QString text = ui->textEdit->toPlainText();
5357
std::string str = text.toStdString();
5458
std::stringstream markdownInput(str);
5559
std::string htmlOutput = parser->Parse(markdownInput);
5660
QString html = QString::fromStdString(htmlOutput);
5761
ui->webEngineView->page()->runJavaScript(QString("add('%1')").arg(html));
62+
5863
connect(ui->textEdit, &QTextEdit::textChanged, this, &OneMarkdown::textEdit_textChanged);
5964
countWords();
6065
qDebug() << "HTML output" << html << endl;
6166
qDebug() << "text output" << text << endl;
62-
qDebug() << "text output" << text.replace('\t', " ") << endl;
6367
// ui->statusBar.
6468
}
6569

@@ -211,13 +215,15 @@ void OneMarkdown::on_btn_outline_clicked()
211215

212216
void OneMarkdown::on_btn_outline_toggled(bool checked)
213217
{
214-
if(!checked) return;
218+
if (!checked)
219+
return;
215220
qDebug() << "btn_outline_toggled" << endl;
216221
}
217222

218223
void OneMarkdown::on_btn_file_list_toggled(bool checked)
219224
{
220-
if(!checked) return;
225+
if (!checked)
226+
return;
221227
qDebug() << "btn_file_list_toggled" << endl;
222228
}
223229

src/OneMarkdown.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <QTimer>
1919
#include "common.h"
2020
#include <QPropertyAnimation>
21+
#include <QMessageBox>
2122
#pragma execution_character_set("utf-8")
2223
QT_BEGIN_NAMESPACE
2324

@@ -81,12 +82,21 @@ private slots:
8182

8283
void on_action_58_triggered();
8384

85+
void on_action_new_window_triggered();
86+
87+
void on_action_open_recent_file_triggered();
88+
89+
void on_action_save_file_triggered();
90+
91+
void on_action_save_as_triggered();
92+
93+
8494
private:
8595
int WORD_NUM = 0;
8696
int CHAR_NUM = 0;
8797
int LINE_NUM = 0;
8898
bool isSideClosed = false;
89-
QList<int> SidePos={10000,40000};
99+
QList<int> SidePos = {10000, 40000};
90100
int size = 0;
91101
int counter = 0;
92102
int start = 0;

0 commit comments

Comments
 (0)