修复file:\协议打不开问题,修改log路径
This commit is contained in:
parent
43e319cff1
commit
7b73991d11
|
@ -9,3 +9,4 @@ install.sh 可以生成 desktop,并发送到系统开始菜单。
|
||||||
多文档编辑器:http://www.qter.org/portal.php?mod=view&aid=10
|
多文档编辑器:http://www.qter.org/portal.php?mod=view&aid=10
|
||||||
编译、运行输出:https://github.com/m-iDev-0792/HJ-Editor
|
编译、运行输出:https://github.com/m-iDev-0792/HJ-Editor
|
||||||
行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html
|
行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html
|
||||||
|
语法高亮:http://www.cnblogs.com/lenxvp/p/5475931.html
|
|
@ -91,7 +91,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
log += "\n";
|
log += "\n";
|
||||||
|
|
||||||
// 写log
|
// 写log
|
||||||
QFile file("log.txt");
|
QString fp = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/" + qApp->organizationName() + "/" + qApp->applicationName() + "_log.txt";
|
||||||
|
QFile file(fp);
|
||||||
if (file.open(QFile::WriteOnly | QIODevice::Append)) {
|
if (file.open(QFile::WriteOnly | QIODevice::Append)) {
|
||||||
file.write(log.toUtf8());
|
file.write(log.toUtf8());
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -180,15 +181,15 @@ void MainWindow::on_action_aboutQt_triggered()
|
||||||
|
|
||||||
void MainWindow::on_action_about_triggered()
|
void MainWindow::on_action_about_triggered()
|
||||||
{
|
{
|
||||||
QMessageBox aboutMB(QMessageBox::NoIcon, "关于", "海天鹰编辑器 1.12\n\n一款基于 Qt 的文本编辑程序。\n作者:海天鹰\nE-mail: sonichy@163.com\n主页:https://github.com/sonichy\n参考文献:\n多文档编辑器:http://www.qter.org/?page_id=161\nQMdiArea基本用法:http://www.mamicode.com/info-detail-1607476.html\n保存文本:http://blog.csdn.net/neicole/article/details/7330234\n语法高亮:http://www.cnblogs.com/lenxvp/p/5475931.html\n拖放打开文件:http://blog.csdn.net/rl529014/article/details/53057577\n行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html");
|
QMessageBox MB(QMessageBox::NoIcon, "关于", "海天鹰编辑器 1.13\n\n一款基于 Qt 的文本编辑程序。\n作者:海天鹰\nE-mail: sonichy@163.com\n主页:https://github.com/sonichy\n参考文献:\n多文档编辑器:http://www.qter.org/?page_id=161\nQMdiArea基本用法:http://www.mamicode.com/info-detail-1607476.html\n保存文本:http://blog.csdn.net/neicole/article/details/7330234\n语法高亮:http://www.cnblogs.com/lenxvp/p/5475931.html\n拖放打开文件:http://blog.csdn.net/rl529014/article/details/53057577\n行号:http://doc.qt.io/qt-5/qtwidgets-widgets-codeeditor-example.html");
|
||||||
aboutMB.setIconPixmap(QPixmap(":/HTYEdit.png"));
|
MB.setIconPixmap(QPixmap(":/HTYEdit.png"));
|
||||||
aboutMB.setWindowIcon(QIcon(":/HTYEdit.png"));
|
MB.setWindowIcon(QIcon(":/HTYEdit.png"));
|
||||||
aboutMB.exec();
|
MB.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_changelog_triggered()
|
void MainWindow::on_action_changelog_triggered()
|
||||||
{
|
{
|
||||||
QString s = "1.12\n2021-01\n修复img去属性,增加删除标签、删除换行。\n\n1.11\n2019-12\n优化排版,增加选中多行Tab缩进。\n\n1.10\n2019-08\n增加:字符数统计。\nHTML排版,增加选中文本分行插入td、tr、p、h1~h6的工具。\n\n1.9\n2019-04\n便签右键菜单增加打开文件路径。\n换行自动缩进。\n快捷键 Ctrl+/ 注释、取消注释选中行。\n保存窗口大小,保存字体设置,设置是否显示输出窗口。\n\n1.8\n2018-11\n使用系统主题图标代替Qt内置图标。\n\n1.7\n2018-10\n支持拖放打开多个文件。\n增加打开文件log。\n打开方式文件路径兼容深度文管和其他文管。\n\n1.6\n2018-09\n标签右键增加只读菜单。\n优化括号补全。\n\n1.5\n2018-08\n增加行号\n增加java文件编译命令\n\n1.4\n2018-07\n设置QTextEdit的Tab跳过的空格数为4个空格\n\n1.3\n2018-06\n增加调试窗口。\n\n1.2\n2018-05\n增加c、cpp的OpenGL编译命令。\n2018-05\n解决右键打开方式无法打开文件问题。\n增加运行python。\n2018-04\n增加打印功能。\n\n1.1\n2017-10\n增加获取文本编码(使用 file --mime-encoding 命令返回),但是没有解决乱码问题。\n排版实验。\n用文本框代替消息框显示更新日志。\n2017-07\n增加拖放打开文件。\n2017-06\n增加语法高亮。\n提取打开文件的相对路径,使Markdown预览能够载入相对路径图片。\n\n1.0\n2017-03\n支持命令行打开文件和打开方式打开文件。\n查找窗口填入选中文本。\n2017-02\n根据文件扩展名选择语法高亮方案。\nJS语法高亮实验成功!\nHTML语法高亮实验成功!\n增加设置字体。\n设置状态栏左右边距。\n2017-01\n实现全部替换。\n设置循环查找。\n增加查找替换窗体和功能。\n根据文件扩展名决定是否使用默认程序打开,如htm。\n优化保存、另存为和文本修动标题标记逻辑。\n增加撤销,重做,子窗标题文本改动标识。\n增加子窗体类,实现Ctrl+滚轮缩放和保存打开文件的路径。\n增加使用默认程序预览文件。\n把上一个打开或保存的路径设置为打开或保存对话框的默认路径和文件名。\n增加放大、缩小。\n增加文本光标变化信号,光标所在行列显示在状态栏第二栏。\n状态栏分为2栏\n修复没有子窗口时预览引起的崩溃。\n增加预览功能。\n保存成功。\n修改字体颜色,背景色成功。\n新建文件成功,打开文件载入成功。\n选用QMdiArea作为主控件,增加窗口标签、平铺、层叠菜单。 \n制作主要菜单。";
|
QString s = "1.13\n2025-03\n修复file:\\协议打不开问题。\n修改log路径。\n\n1.12\n2021-01\n修复img去属性,增加删除标签、删除换行。\n\n1.11\n2019-12\n优化排版,增加选中多行Tab缩进。\n\n1.10\n2019-08\n增加:字符数统计。\nHTML排版,增加选中文本分行插入td、tr、p、h1~h6的工具。\n\n1.9\n2019-04\n便签右键菜单增加打开文件路径。\n换行自动缩进。\n快捷键 Ctrl+/ 注释、取消注释选中行。\n保存窗口大小,保存字体设置,设置是否显示输出窗口。\n\n1.8\n2018-11\n使用系统主题图标代替Qt内置图标。\n\n1.7\n2018-10\n支持拖放打开多个文件。\n增加打开文件log。\n打开方式文件路径兼容深度文管和其他文管。\n\n1.6\n2018-09\n标签右键增加只读菜单。\n优化括号补全。\n\n1.5\n2018-08\n增加行号\n增加java文件编译命令\n\n1.4\n2018-07\n设置QTextEdit的Tab跳过的空格数为4个空格\n\n1.3\n2018-06\n增加调试窗口。\n\n1.2\n2018-05\n增加c、cpp的OpenGL编译命令。\n2018-05\n解决右键打开方式无法打开文件问题。\n增加运行python。\n2018-04\n增加打印功能。\n\n1.1\n2017-10\n增加获取文本编码(使用 file --mime-encoding 命令返回),但是没有解决乱码问题。\n排版实验。\n用文本框代替消息框显示更新日志。\n2017-07\n增加拖放打开文件。\n2017-06\n增加语法高亮。\n提取打开文件的相对路径,使Markdown预览能够载入相对路径图片。\n\n1.0\n2017-03\n支持命令行打开文件和打开方式打开文件。\n查找窗口填入选中文本。\n2017-02\n根据文件扩展名选择语法高亮方案。\nJS语法高亮实验成功!\nHTML语法高亮实验成功!\n增加设置字体。\n设置状态栏左右边距。\n2017-01\n实现全部替换。\n设置循环查找。\n增加查找替换窗体和功能。\n根据文件扩展名决定是否使用默认程序打开,如htm。\n优化保存、另存为和文本修动标题标记逻辑。\n增加撤销,重做,子窗标题文本改动标识。\n增加子窗体类,实现Ctrl+滚轮缩放和保存打开文件的路径。\n增加使用默认程序预览文件。\n把上一个打开或保存的路径设置为打开或保存对话框的默认路径和文件名。\n增加放大、缩小。\n增加文本光标变化信号,光标所在行列显示在状态栏第二栏。\n状态栏分为2栏\n修复没有子窗口时预览引起的崩溃。\n增加预览功能。\n保存成功。\n修改字体颜色,背景色成功。\n新建文件成功,打开文件载入成功。\n选用QMdiArea作为主控件,增加窗口标签、平铺、层叠菜单。 \n制作主要菜单。";
|
||||||
QDialog *dialog = new QDialog;
|
QDialog *dialog = new QDialog;
|
||||||
dialog->setWindowTitle("更新历史");
|
dialog->setWindowTitle("更新历史");
|
||||||
dialog->setFixedSize(400, 300);
|
dialog->setFixedSize(400, 300);
|
||||||
|
@ -271,6 +272,10 @@ void MainWindow::on_action_open_triggered()
|
||||||
void MainWindow::open(QString fileName)
|
void MainWindow::open(QString fileName)
|
||||||
{
|
{
|
||||||
path = fileName;
|
path = fileName;
|
||||||
|
if (path.startsWith("file://")) {
|
||||||
|
QUrl url(path);
|
||||||
|
path = url.toLocalFile();
|
||||||
|
}
|
||||||
MdiChild *child = new MdiChild(this);
|
MdiChild *child = new MdiChild(this);
|
||||||
connect(child, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChange()));
|
connect(child, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChange()));
|
||||||
QMdiSubWindow *window = ui->mdiArea->addSubWindow(child);
|
QMdiSubWindow *window = ui->mdiArea->addSubWindow(child);
|
||||||
|
@ -285,9 +290,8 @@ void MainWindow::open(QString fileName)
|
||||||
connect(action_openpath, &QAction::triggered, [=](){
|
connect(action_openpath, &QAction::triggered, [=](){
|
||||||
QDesktopServices::openUrl(QFileInfo(child->path).absolutePath());
|
QDesktopServices::openUrl(QFileInfo(child->path).absolutePath());
|
||||||
});
|
});
|
||||||
if (child->loadFile(fileName)) {
|
if (child->loadFile(path)) {
|
||||||
path = fileName;
|
LS1->setText("打开 " + path);
|
||||||
LS1->setText("打开 " + fileName);
|
|
||||||
cursorPositionChange();
|
cursorPositionChange();
|
||||||
//SyntaxHighlight();
|
//SyntaxHighlight();
|
||||||
updateCommand();
|
updateCommand();
|
||||||
|
|
|
@ -83,9 +83,9 @@ bool MdiChild::save()
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
if (file.open(QFile::WriteOnly)) {
|
if (file.open(QFile::WriteOnly)) {
|
||||||
QTextStream ts(&file);
|
QTextStream TS(&file);
|
||||||
QString s = toPlainText();
|
QString s = toPlainText();
|
||||||
ts << s;
|
TS << s;
|
||||||
//ui->mdiArea->currentSubWindow()->setWindowTitle(QFileInfo(filename).fileName());
|
//ui->mdiArea->currentSubWindow()->setWindowTitle(QFileInfo(filename).fileName());
|
||||||
//LS1->setText("保存 "+filename);
|
//LS1->setText("保存 "+filename);
|
||||||
setWindowTitle(QFileInfo(path).fileName() + "[*]");
|
setWindowTitle(QFileInfo(path).fileName() + "[*]");
|
||||||
|
|
Loading…
Reference in New Issue