From 054a99b690bc1c1b4ceff4c37793f9fdb2ae9eee Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 28 Oct 2022 16:34:26 +0800 Subject: [PATCH] msvc compatibility --- NEWS.md | 1 + RedPandaIDE/RedPandaIDE.pro | 5 +++++ RedPandaIDE/mainwindow.h | 2 +- RedPandaIDE/widgets/aboutdialog.cpp | 4 ++++ libs/qsynedit/qsynedit/TextBuffer.cpp | 2 +- libs/qsynedit/qsynedit/TextBuffer.h | 4 ++-- tools/astyle/astyle.pro | 4 ++++ tools/consolepauser/consolepauser.pro | 4 ++++ tools/redpanda-win-git-askpass/redpanda-win-git-askpass.pro | 4 ++++ 9 files changed, 26 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index a7cfe6c5..0679e1f5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,7 @@ Red Panda C++ Version 2.1 - enhancement: add "goto block start"/"goto block end" in "Code" menu - add fmtlib to the gcc compiler's lib distributed with RedPanda IDE windows version - add default autolink for fmtlib in Windows + - reduce size of the executable of win-git-askpass tool Red Panda C++ Version 2.0 diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 01fb946e..c99aa3c9 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -68,6 +68,11 @@ gcc | clang { LIBS += $$OUT_PWD/../libs/qsynedit/$${OBJ_OUT_PWD}libqsynedit.a \ $$OUT_PWD/../libs/redpanda_qt_utils/$${OBJ_OUT_PWD}libredpanda_qt_utils.a } +msvc { +LIBS += $$OUT_PWD/../libs/qsynedit/$${OBJ_OUT_PWD}qsynedit.lib \ + $$OUT_PWD/../libs/redpanda_qt_utils/$${OBJ_OUT_PWD}redpanda_qt_utils.lib +LIBS += advapi32.lib user32.lib +} SOURCES += \ HighlighterManager.cpp \ diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index f0a62c9a..3a98a749 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -67,7 +67,7 @@ class CPUDialog; class QPlainTextEdit; class SearchDialog; class Project; -class ProjectModelNode; +struct ProjectModelNode; class ProjectUnit; class ColorSchemeItem; class VisitHistoryManager; diff --git a/RedPandaIDE/widgets/aboutdialog.cpp b/RedPandaIDE/widgets/aboutdialog.cpp index 0da1b9e1..86ebb55b 100644 --- a/RedPandaIDE/widgets/aboutdialog.cpp +++ b/RedPandaIDE/widgets/aboutdialog.cpp @@ -35,6 +35,10 @@ AboutDialog::AboutDialog(QWidget *parent) : .arg(QString("GCC %1.%2") .arg(__GNUC__) .arg(__GNUC_MINOR__))); +#elif defined(_MSC_VER) + ui->lblQt->setText(ui->lblQt->text() + .arg(qVersion()) + .arg(tr("Microsoft Visual C++"))); #else ui->lblQt->setText(ui->lblQt->text() .arg(qVersion()) diff --git a/libs/qsynedit/qsynedit/TextBuffer.cpp b/libs/qsynedit/qsynedit/TextBuffer.cpp index 011c4a41..fb97aa01 100644 --- a/libs/qsynedit/qsynedit/TextBuffer.cpp +++ b/libs/qsynedit/qsynedit/TextBuffer.cpp @@ -688,7 +688,7 @@ void Document::saveToFile(QFile &file, const QByteArray& encoding, if (allAscii) { realEncoding = ENCODING_ASCII; } else if (encoding == ENCODING_AUTO_DETECT) { - if (codec->name() == "System") { + if (codec->name().compare("System",Qt::CaseInsensitive)) { realEncoding = pCharsetInfoManager->getDefaultSystemEncoding(); } else { realEncoding = codec->name(); diff --git a/libs/qsynedit/qsynedit/TextBuffer.h b/libs/qsynedit/qsynedit/TextBuffer.h index c33aa024..8262de4b 100644 --- a/libs/qsynedit/qsynedit/TextBuffer.h +++ b/libs/qsynedit/qsynedit/TextBuffer.h @@ -250,8 +250,8 @@ protected: QVector mItems; int mMaxUndoActions; int mMaxMemoryUsage; - size_t mNextChangeNumber; - size_t mInitialChangeNumber; + unsigned int mNextChangeNumber; + unsigned int mInitialChangeNumber; bool mInsideRedo; }; diff --git a/tools/astyle/astyle.pro b/tools/astyle/astyle.pro index 81569346..5f64b506 100644 --- a/tools/astyle/astyle.pro +++ b/tools/astyle/astyle.pro @@ -7,6 +7,10 @@ isEmpty(APP_NAME) { CONFIG += c++11 console CONFIG -= app_bundle +msvc { +CONFIG += windows +} + # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 diff --git a/tools/consolepauser/consolepauser.pro b/tools/consolepauser/consolepauser.pro index 6fcf7b56..db228e0e 100644 --- a/tools/consolepauser/consolepauser.pro +++ b/tools/consolepauser/consolepauser.pro @@ -3,6 +3,10 @@ QT -= gui CONFIG += c++11 console CONFIG -= app_bundle +msvc { + CONFIG += windows +} + isEmpty(APP_NAME) { APP_NAME = RedPandaCPP } diff --git a/tools/redpanda-win-git-askpass/redpanda-win-git-askpass.pro b/tools/redpanda-win-git-askpass/redpanda-win-git-askpass.pro index 93f1b055..6faf23b8 100644 --- a/tools/redpanda-win-git-askpass/redpanda-win-git-askpass.pro +++ b/tools/redpanda-win-git-askpass/redpanda-win-git-askpass.pro @@ -3,6 +3,10 @@ CONFIG -= qt CONFIG += c++11 CONFIG -= app_bundle +msvc { + LIBS += advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib +} + DEFINES -= UNICODE isEmpty(APP_NAME) {