From 89b95ba10acf9cf6ae7d1e50c1338b78b251a5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=89=E5=AE=87=E6=B8=85=E9=9F=B3?= <2422523675@qq.com> Date: Sat, 25 Feb 2023 17:44:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreTest/configtest.cpp | 2 + CoreTest/configtest.h | 32 +++++----- CoreTest/main.cpp | 2 + QtNovelDesc.pro | 1 + QtNovelDesc.pro.user | 91 +++++++++++++++++++++++++++-- Testpad/main.cpp | 10 ++-- WordsIDE/SourceEditView.cpp | 4 +- WordsIDE/sourcecodeeditor.cpp | 4 +- WordsIDE/storyboardsourceedit.cpp | 4 +- WordsIDE/storychainsourceeditor.cpp | 6 +- WordsIDE/storyunitsourceedit.cpp | 4 +- WordsIDE/storyvolumesourceedit.cpp | 4 +- libConfig/xmlconfig.cpp | 2 +- 13 files changed, 129 insertions(+), 37 deletions(-) diff --git a/CoreTest/configtest.cpp b/CoreTest/configtest.cpp index 2248e6e..2cf7f1e 100644 --- a/CoreTest/configtest.cpp +++ b/CoreTest/configtest.cpp @@ -1,6 +1,8 @@ #include "configtest.h" #include + using namespace Config; +using namespace TestCase; ConfigTest::ConfigTest(Configration *test_ins) : xml(test_ins) diff --git a/CoreTest/configtest.h b/CoreTest/configtest.h index b16699f..06b6c7c 100644 --- a/CoreTest/configtest.h +++ b/CoreTest/configtest.h @@ -4,21 +4,25 @@ #include #include -class ConfigTest : public QObject -{ - Q_OBJECT -public: - ConfigTest(Config::Configration *test_ins); +namespace TestCase { -private: - Config::Configration *xml; + class ConfigTest : public QObject + { + Q_OBJECT + public: + ConfigTest(Config::Configration *test_ins); + + private: + Config::Configration *xml; + + private slots: + void testReload(); + void testException(); + void testConfig(); + void testList(); + void testMap(); + }; +} -private slots: - void testReload(); - void testException(); - void testConfig(); - void testList(); - void testMap(); -}; #endif // CONFIGTEST_H diff --git a/CoreTest/main.cpp b/CoreTest/main.cpp index c14bd98..144586c 100644 --- a/CoreTest/main.cpp +++ b/CoreTest/main.cpp @@ -3,6 +3,8 @@ #include "xmlconfig.h" +using namespace TestCase; + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); diff --git a/QtNovelDesc.pro b/QtNovelDesc.pro index 10626ee..7a09148 100644 --- a/QtNovelDesc.pro +++ b/QtNovelDesc.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS += \ + CoreTest \ DesParser \ Testpad \ WordsIDE \ diff --git a/QtNovelDesc.pro.user b/QtNovelDesc.pro.user index dac8779..141edb4 100644 --- a/QtNovelDesc.pro.user +++ b/QtNovelDesc.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -67,7 +67,14 @@ true true - + + Checked + Checked + Checked + Checked + Checked + Checked + 0 true @@ -85,6 +92,9 @@ true + + true + @@ -96,7 +106,7 @@ qt.qt5.51211.win64_msvc2017_64_kit 0 0 - 2 + 3 0 D:\Projects\Cpp\build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug @@ -449,7 +459,80 @@ true D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/WordsIDE - 3 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + + 25 + + 1 + true + false + true + + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:D:/Projects/Cpp/QtNovelDesc/CoreTest/CoreTest.pro + D:/Projects/Cpp/QtNovelDesc/CoreTest/CoreTest.pro + false + true + true + false + true + D:/Projects/Cpp/build-QtNovelDesc-Desktop_Qt_5_12_11_MSVC2017_64bit-Debug/CoreTest + + 4 diff --git a/Testpad/main.cpp b/Testpad/main.cpp index 7f846f8..2e59d5d 100644 --- a/Testpad/main.cpp +++ b/Testpad/main.cpp @@ -10,11 +10,11 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); - try { - throw new std::exception(); - } catch (std::exception *) { - qDebug() << "catched"; - } + QFile x("./test.dd"); + qDebug() << x.open(QIODevice::WriteOnly); + qDebug() << x.exists(); + qDebug() << x.open(QIODevice::WriteOnly); + qDebug() << x.exists(); return a.exec(); } diff --git a/WordsIDE/SourceEditView.cpp b/WordsIDE/SourceEditView.cpp index 915ec28..d797ab4 100644 --- a/WordsIDE/SourceEditView.cpp +++ b/WordsIDE/SourceEditView.cpp @@ -138,7 +138,7 @@ void FormattedTextEdit::textContentReset(const QString &value) edit_square->setPlainText(value); } -namespace __temp { +namespace __impl_temp { class TextEditConfigration : public QWidget { public: @@ -192,7 +192,7 @@ QList TextContentEditFactory::configs() const QWidget *TextContentEditFactory::getNewPanel(Config::Configration *config) { - return new __temp::TextEditConfigration(config); + return new __impl_temp::TextEditConfigration(config); } QString TextContentEditFactory::extensionName() const diff --git a/WordsIDE/sourcecodeeditor.cpp b/WordsIDE/sourcecodeeditor.cpp index f87f7fc..1af4de6 100644 --- a/WordsIDE/sourcecodeeditor.cpp +++ b/WordsIDE/sourcecodeeditor.cpp @@ -113,7 +113,7 @@ QList SourceCodeEditorFactory::configs() const return QList() << Core::Scale::Project << Core::Scale::Global; } -namespace __temp { +namespace __impl_temp { class XMarksConfig : public QWidget { public: @@ -148,7 +148,7 @@ namespace __temp { QWidget *SourceCodeEditorFactory::getNewPanel(Config::Configration *config) { - return new __temp::XMarksConfig(config); + return new __impl_temp::XMarksConfig(config); } QString SourceCodeEditorFactory::extensionName() const diff --git a/WordsIDE/storyboardsourceedit.cpp b/WordsIDE/storyboardsourceedit.cpp index b17ae4f..87bbf2c 100644 --- a/WordsIDE/storyboardsourceedit.cpp +++ b/WordsIDE/storyboardsourceedit.cpp @@ -103,7 +103,7 @@ QList StoryBoardSourceEditFactory::configs() const return QList() << Scale::Project << Scale::Global; } -namespace __temp { +namespace __impl_temp { class BoardConfigration : public QWidget { public: @@ -139,7 +139,7 @@ namespace __temp { } QWidget *StoryBoardSourceEditFactory::getNewPanel(Config::Configration *config) { - return new __temp::BoardConfigration(config); + return new __impl_temp::BoardConfigration(config); } QString StoryBoardSourceEditFactory::extensionName() const diff --git a/WordsIDE/storychainsourceeditor.cpp b/WordsIDE/storychainsourceeditor.cpp index 98c77b9..5df52ca 100644 --- a/WordsIDE/storychainsourceeditor.cpp +++ b/WordsIDE/storychainsourceeditor.cpp @@ -105,7 +105,7 @@ void StoryChainSourceEdit::jumpTo(const QList &path) this->textView()->setFocus(); } -namespace __temp { +namespace __impl_temp { class ChainSrcConfig : public QWidget { public: @@ -128,7 +128,7 @@ QList Components::StoryChainSourceEditFactory::configs() const } -namespace __temp { +namespace __impl_temp { class ChainConfigration : public QWidget { public: @@ -164,7 +164,7 @@ namespace __temp { } QWidget *Components::StoryChainSourceEditFactory::getNewPanel(Config::Configration *config) { - return new __temp::ChainConfigration(config); + return new __impl_temp::ChainConfigration(config); } QString StoryChainSourceEditFactory::extensionName() const diff --git a/WordsIDE/storyunitsourceedit.cpp b/WordsIDE/storyunitsourceedit.cpp index 1abd2dc..3cc558d 100644 --- a/WordsIDE/storyunitsourceedit.cpp +++ b/WordsIDE/storyunitsourceedit.cpp @@ -229,7 +229,7 @@ QList StoryUnitSourceEditFactory::configs() const return QList() << Scale::Project << Scale::Global; } -namespace __temp { +namespace __impl_temp { class UnitConfigration : public QWidget { public: @@ -265,7 +265,7 @@ namespace __temp { } QWidget *StoryUnitSourceEditFactory::getNewPanel(Config::Configration *config) { - return new __temp::UnitConfigration(config); + return new __impl_temp::UnitConfigration(config); } QString StoryUnitSourceEditFactory::extensionName() const diff --git a/WordsIDE/storyvolumesourceedit.cpp b/WordsIDE/storyvolumesourceedit.cpp index 04589e3..e0358aa 100644 --- a/WordsIDE/storyvolumesourceedit.cpp +++ b/WordsIDE/storyvolumesourceedit.cpp @@ -92,7 +92,7 @@ QList StoryVolumeSourceEditFactory::configs() const return QList() << Scale::Project << Scale::Global; } -namespace __temp { +namespace __impl_temp { class VolumeConfigration : public QWidget { public: @@ -128,7 +128,7 @@ namespace __temp { } QWidget *StoryVolumeSourceEditFactory::getNewPanel(Config::Configration *config) { - return new __temp::VolumeConfigration(config); + return new __impl_temp::VolumeConfigration(config); } QString StoryVolumeSourceEditFactory::extensionName() const diff --git a/libConfig/xmlconfig.cpp b/libConfig/xmlconfig.cpp index 19c5032..8a6d5ed 100644 --- a/libConfig/xmlconfig.cpp +++ b/libConfig/xmlconfig.cpp @@ -55,7 +55,7 @@ void XMLConfig::loadFile(const QString &path) throw new Impl_ParseException("解析错误", QString("指定路径:%1,配置文件无法打开").arg(path)); QString err_str; int err_row, err_col; - if(doc_ins.setContent(&config, false, &err_str, &err_row, &err_col)) + if(!doc_ins.setContent(&config, false, &err_str, &err_row, &err_col)) throw new Impl_ParseException("解析错误", QString("指定配置文件:%1,row:%2,col:%3,格式错误。").arg(err_col).arg(err_row).arg(err_col)); }