diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index b60714df..7898d191 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -405,7 +405,8 @@ int main(int argc, char *argv[]) e.reason(), QMessageBox::Ok); } - // qDebug()<<"Load font"<setupUi(this); + ui->cbFallbackFont2->setEnabled(false); + ui->cbFallbackFont3->setEnabled(false); connect(ui->chkFallbackFont2, &QCheckBox::stateChanged, this, &EditorFontWidget::onFallbackFontsCheckStateChanged); connect(ui->chkFallbackFont3, &QCheckBox::stateChanged, diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index d5acbfb3..8dc06e09 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -30,7 +30,7 @@ namespace QSynedit { -Document::Document(const QFont& font, const QFont& nonAsciiFont, QObject *parent): +Document::Document(const QFont& font, QObject *parent): QObject(parent), mFontMetrics(font), mTabSize(4), @@ -669,8 +669,8 @@ void Document::loadFromFile(const QString& filename, const QByteArray& encoding, } else if (line.endsWith("\n")){ line.remove(line.length()-1,1); } - // if (isBinaryContent(line)) - // throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename)); + if (isBinaryContent(line)) + throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename)); if (allAscii) { allAscii = isTextAllAscii(line); } diff --git a/libs/qsynedit/qsynedit/document.h b/libs/qsynedit/qsynedit/document.h index 4945b7d6..5b8cf014 100644 --- a/libs/qsynedit/qsynedit/document.h +++ b/libs/qsynedit/qsynedit/document.h @@ -210,7 +210,7 @@ class Document : public QObject { Q_OBJECT public: - explicit Document(const QFont& font, const QFont& nonAsciiFont, QObject* parent=nullptr); + explicit Document(const QFont& font, QObject* parent=nullptr); Document(const Document&)=delete; Document& operator=(const Document&)=delete; diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index 93d80c37..71e50cca 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -58,7 +58,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), mPainting = false; mFontDummy = QFont("monospace",14); mFontDummy.setStyleStrategy(QFont::PreferAntialias); - mDocument = std::make_shared(mFontDummy, mFontDummy, this); + mDocument = std::make_shared(mFontDummy, this); //fPlugins := TList.Create; mMouseMoved = false; mMouseOrigin = QPoint(0,0); diff --git a/libs/redpanda_qt_utils/qt_utils/utils.cpp b/libs/redpanda_qt_utils/qt_utils/utils.cpp index 12839677..261d5b19 100644 --- a/libs/redpanda_qt_utils/qt_utils/utils.cpp +++ b/libs/redpanda_qt_utils/qt_utils/utils.cpp @@ -724,15 +724,15 @@ QStringList absolutePaths(const QString &dirPath, const QStringList &relativePat return list; } -// bool isBinaryContent(const QByteArray &text) -// { -// for (char c:text) { -// if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') { -// return true; -// } -// } -// return false; -// } +bool isBinaryContent(const QByteArray &text) +{ + for (char c:text) { + if (c==0) { + return true; + } + } + return false; +} void clearQPlainTextEditFormat(QTextEdit *editor) {