basic linux compatibily

This commit is contained in:
Roy Qu 2021-12-24 23:18:20 +08:00
parent 960c239bea
commit 7f4840a299
16 changed files with 97 additions and 58 deletions

View File

@ -54,7 +54,6 @@ SOURCES += \
settingsdialog/editormiscwidget.cpp \ settingsdialog/editormiscwidget.cpp \
settingsdialog/editorsnippetwidget.cpp \ settingsdialog/editorsnippetwidget.cpp \
settingsdialog/editortooltipswidget.cpp \ settingsdialog/editortooltipswidget.cpp \
settingsdialog/environmentfileassociationwidget.cpp \
settingsdialog/environmentfolderswidget.cpp \ settingsdialog/environmentfolderswidget.cpp \
settingsdialog/environmentperformancewidget.cpp \ settingsdialog/environmentperformancewidget.cpp \
settingsdialog/environmentshortcutwidget.cpp \ settingsdialog/environmentshortcutwidget.cpp \
@ -69,7 +68,6 @@ SOURCES += \
settingsdialog/projectmakefilewidget.cpp \ settingsdialog/projectmakefilewidget.cpp \
settingsdialog/projectoutputwidget.cpp \ settingsdialog/projectoutputwidget.cpp \
settingsdialog/projectprecompilewidget.cpp \ settingsdialog/projectprecompilewidget.cpp \
settingsdialog/projectversioninfowidget.cpp \
settingsdialog/toolsgeneralwidget.cpp \ settingsdialog/toolsgeneralwidget.cpp \
shortcutmanager.cpp \ shortcutmanager.cpp \
symbolusagemanager.cpp \ symbolusagemanager.cpp \
@ -179,7 +177,6 @@ HEADERS += \
settingsdialog/editormiscwidget.h \ settingsdialog/editormiscwidget.h \
settingsdialog/editorsnippetwidget.h \ settingsdialog/editorsnippetwidget.h \
settingsdialog/editortooltipswidget.h \ settingsdialog/editortooltipswidget.h \
settingsdialog/environmentfileassociationwidget.h \
settingsdialog/environmentfolderswidget.h \ settingsdialog/environmentfolderswidget.h \
settingsdialog/environmentperformancewidget.h \ settingsdialog/environmentperformancewidget.h \
settingsdialog/environmentshortcutwidget.h \ settingsdialog/environmentshortcutwidget.h \
@ -194,7 +191,6 @@ HEADERS += \
settingsdialog/projectmakefilewidget.h \ settingsdialog/projectmakefilewidget.h \
settingsdialog/projectoutputwidget.h \ settingsdialog/projectoutputwidget.h \
settingsdialog/projectprecompilewidget.h \ settingsdialog/projectprecompilewidget.h \
settingsdialog/projectversioninfowidget.h \
settingsdialog/toolsgeneralwidget.h \ settingsdialog/toolsgeneralwidget.h \
shortcutmanager.h \ shortcutmanager.h \
symbolusagemanager.h \ symbolusagemanager.h \
@ -274,7 +270,6 @@ FORMS += \
settingsdialog/editormiscwidget.ui \ settingsdialog/editormiscwidget.ui \
settingsdialog/editorsnippetwidget.ui \ settingsdialog/editorsnippetwidget.ui \
settingsdialog/editortooltipswidget.ui \ settingsdialog/editortooltipswidget.ui \
settingsdialog/environmentfileassociationwidget.ui \
settingsdialog/environmentfolderswidget.ui \ settingsdialog/environmentfolderswidget.ui \
settingsdialog/environmentperformancewidget.ui \ settingsdialog/environmentperformancewidget.ui \
settingsdialog/environmentshortcutwidget.ui \ settingsdialog/environmentshortcutwidget.ui \
@ -289,7 +284,6 @@ FORMS += \
settingsdialog/projectmakefilewidget.ui \ settingsdialog/projectmakefilewidget.ui \
settingsdialog/projectoutputwidget.ui \ settingsdialog/projectoutputwidget.ui \
settingsdialog/projectprecompilewidget.ui \ settingsdialog/projectprecompilewidget.ui \
settingsdialog/projectversioninfowidget.ui \
settingsdialog/toolsgeneralwidget.ui \ settingsdialog/toolsgeneralwidget.ui \
widgets/aboutdialog.ui \ widgets/aboutdialog.ui \
widgets/cpudialog.ui \ widgets/cpudialog.ui \
@ -312,6 +306,18 @@ FORMS += \
widgets/searchdialog.ui \ widgets/searchdialog.ui \
widgets/signalmessagedialog.ui widgets/signalmessagedialog.ui
win32: FORMS += \
settingsdialog/projectversioninfowidget.ui \
settingsdialog/environmentfileassociationwidget.ui
win32: HEADERS += \
settingsdialog/projectversioninfowidget.h \
settingsdialog/environmentfileassociationwidget.h
win32: SOURCES += \
settingsdialog/environmentfileassociationwidget.cpp \
settingsdialog/projectversioninfowidget.cpp
TRANSLATIONS += \ TRANSLATIONS += \
RedPandaIDE_zh_CN.ts RedPandaIDE_zh_CN.ts

View File

@ -1,10 +1,13 @@
#include "executablerunner.h" #include "executablerunner.h"
#include <windows.h>
#include <QDebug> #include <QDebug>
#include "compilermanager.h" #include "compilermanager.h"
#include "../settings.h" #include "../settings.h"
#include "../systemconsts.h" #include "../systemconsts.h"
#ifdef Q_OS_WIN
#include <windows.h>
#endif
ExecutableRunner::ExecutableRunner(const QString &filename, const QString &arguments, const QString &workDir ExecutableRunner::ExecutableRunner(const QString &filename, const QString &arguments, const QString &workDir
,QObject* parent): ,QObject* parent):
@ -76,6 +79,12 @@ void ExecutableRunner::run()
} }
env.insert("PATH",path); env.insert("PATH",path);
mProcess->setProcessEnvironment(env); mProcess->setProcessEnvironment(env);
connect(
mProcess.get(), &QProcess::errorOccurred,
[&errorOccurred](){
errorOccurred= true;
});
#ifdef Q_OS_WIN
mProcess->setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){ mProcess->setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){
if (mStartConsole) { if (mStartConsole) {
args->flags |= CREATE_NEW_CONSOLE; args->flags |= CREATE_NEW_CONSOLE;
@ -85,20 +94,6 @@ void ExecutableRunner::run()
args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES; args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES;
} }
}); });
connect(
mProcess.get(), &QProcess::errorOccurred,
[&errorOccurred](){
errorOccurred= true;
});
// if (!redirectInput()) {
// process.closeWriteChannel();
// }
mProcess->start();
mProcess->waitForStarted(5000);
if (mProcess->state()==QProcess::Running && redirectInput()) {
mProcess->write(readFileToByteArray(redirectInputFilename()));
mProcess->closeWriteChannel();
}
HANDLE hSharedMemory=INVALID_HANDLE_VALUE; HANDLE hSharedMemory=INVALID_HANDLE_VALUE;
int BUF_SIZE=1024; int BUF_SIZE=1024;
char* pBuf=nullptr; char* pBuf=nullptr;
@ -123,55 +118,55 @@ void ExecutableRunner::run()
} }
} }
} }
#endif
// if (!redirectInput()) {
// process.closeWriteChannel();
// }
mProcess->start();
mProcess->waitForStarted(5000);
if (mProcess->state()==QProcess::Running && redirectInput()) {
mProcess->write(readFileToByteArray(redirectInputFilename()));
mProcess->closeWriteChannel();
}
while (true) { while (true) {
mProcess->waitForFinished(1000); mProcess->waitForFinished(1000);
if (mProcess->state()!=QProcess::Running) { if (mProcess->state()!=QProcess::Running) {
break; break;
} }
if (mStop) { if (mStop) {
qDebug()<<"??1";
mProcess->closeReadChannel(QProcess::StandardOutput); mProcess->closeReadChannel(QProcess::StandardOutput);
mProcess->closeReadChannel(QProcess::StandardError); mProcess->closeReadChannel(QProcess::StandardError);
mProcess->closeWriteChannel(); mProcess->closeWriteChannel();
qDebug()<<"??2";
#ifdef Q_OS_WIN
qDebug()<<"??3";
mProcess->terminate(); mProcess->terminate();
qDebug()<<"??4";
if (mProcess->waitForFinished(1000)) { if (mProcess->waitForFinished(1000)) {
break; break;
} }
#else
process->terminate();
if (process->waitForFinished(1000)) {
break;
}
#endif
for (int i=0;i<10;i++) { for (int i=0;i<10;i++) {
qDebug()<<"??5";
mProcess->kill(); mProcess->kill();
qDebug()<<"??6";
if (mProcess->waitForFinished(500)) { if (mProcess->waitForFinished(500)) {
break; break;
} }
} }
break; break;
} }
#ifdef Q_OS_WIN
if (mStartConsole && !mPausing && pBuf) { if (mStartConsole && !mPausing && pBuf) {
if (strncmp(pBuf,"FINISHED",sizeof("FINISHED"))==0) { if (strncmp(pBuf,"FINISHED",sizeof("FINISHED"))==0) {
setPausing(true); setPausing(true);
emit pausingForFinish(); emit pausingForFinish();
} }
} }
#endif
if (errorOccurred) if (errorOccurred)
break; break;
} }
#ifdef Q_OS_WIN
if (pBuf) if (pBuf)
UnmapViewOfFile(pBuf); UnmapViewOfFile(pBuf);
if (hSharedMemory!=INVALID_HANDLE_VALUE) if (hSharedMemory!=INVALID_HANDLE_VALUE)
CloseHandle(hSharedMemory); CloseHandle(hSharedMemory);
#endif
if (errorOccurred) { if (errorOccurred) {
//qDebug()<<"process error:"<<process.error(); //qDebug()<<"process error:"<<process.error();
switch (mProcess->error()) { switch (mProcess->error()) {

View File

@ -17,8 +17,11 @@
#include "platform.h" #include "platform.h"
#include "parser/parserutils.h" #include "parser/parserutils.h"
#include "editorlist.h" #include "editorlist.h"
#ifdef Q_WIN_OS
#include <windows.h> #include <windows.h>
#endif
#ifdef Q_WIN_OS
class WindowLogoutEventFilter : public QAbstractNativeEventFilter { class WindowLogoutEventFilter : public QAbstractNativeEventFilter {
// QAbstractNativeEventFilter interface // QAbstractNativeEventFilter interface
@ -46,6 +49,7 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/
} }
return false; return false;
} }
#endif
QString getSettingFilename(const QString& filepath = QString()) { QString getSettingFilename(const QString& filepath = QString()) {
QString filename; QString filename;
@ -154,8 +158,10 @@ int main(int argc, char *argv[])
} }
} }
mainWindow.show(); mainWindow.show();
#ifdef Q_WIN_OS
WindowLogoutEventFilter filter; WindowLogoutEventFilter filter;
app.installNativeEventFilter(&filter); app.installNativeEventFilter(&filter);
#endif
int retCode = app.exec(); int retCode = app.exec();
QString configDir = pSettings->dirs().config(); QString configDir = pSettings->dirs().config();
// save settings // save settings

View File

@ -1,4 +1,3 @@
#include <windows.h>
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "editorlist.h" #include "editorlist.h"
@ -52,6 +51,11 @@
#include <widgets/searchdialog.h> #include <widgets/searchdialog.h>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
static int findTabIndex(QTabWidget* tabWidget , QWidget* w) { static int findTabIndex(QTabWidget* tabWidget , QWidget* w) {
for (int i=0;i<tabWidget->count();i++) { for (int i=0;i<tabWidget->count();i++) {
if (w==tabWidget->widget(i)) if (w==tabWidget->widget(i))
@ -867,6 +871,11 @@ QPlainTextEdit *MainWindow::txtLocals()
return ui->txtLocals; return ui->txtLocals;
} }
QMenuBar *MainWindow::menuBar() const
{
return ui->menubar;
}
void MainWindow::updateStatusbarForLineCol() void MainWindow::updateStatusbarForLineCol()
{ {
Editor* e = mEditorList->getEditor(); Editor* e = mEditorList->getEditor();
@ -2684,10 +2693,12 @@ void MainWindow::openShell(const QString &folder, const QString &shellCommand)
QProcess process; QProcess process;
process.setWorkingDirectory(folder); process.setWorkingDirectory(folder);
process.setProgram(shellCommand); process.setProgram(shellCommand);
#ifdef Q_OS_WIN
process.setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments * args){ process.setCreateProcessArgumentsModifier([](QProcess::CreateProcessArguments * args){
args->flags |= CREATE_NEW_CONSOLE; args->flags |= CREATE_NEW_CONSOLE;
args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES; // args->startupInfo->dwFlags &= ~STARTF_USESTDHANDLES; //
}); });
#endif
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString path = env.value("PATH"); QString path = env.value("PATH");
QStringList pathAdded; QStringList pathAdded;
@ -5456,12 +5467,6 @@ void MainWindow::applyCurrentProblemCaseChanges()
} }
} }
Ui::MainWindow *MainWindow::mainWidget() const
{
return ui;
}
void MainWindow::on_btnReplace_clicked() void MainWindow::on_btnReplace_clicked()
{ {
//select all items by default //select all items by default

View File

@ -121,7 +121,7 @@ public:
QPlainTextEdit* txtLocals(); QPlainTextEdit* txtLocals();
Ui::MainWindow* mainWidget() const; QMenuBar* menuBar() const;
CPUDialog *cpuDialog() const; CPUDialog *cpuDialog() const;

View File

@ -4,20 +4,25 @@
#include <QMap> #include <QMap>
#include <QSet> #include <QSet>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#else
#include <langinfo.h>
#endif #endif
CharsetInfoManager* pCharsetInfoManager; CharsetInfoManager* pCharsetInfoManager;
QByteArray CharsetInfoManager::getDefaultSystemEncoding() QByteArray CharsetInfoManager::getDefaultSystemEncoding()
{ {
#ifdef Q_OS_WIN
DWORD acp = GetACP(); DWORD acp = GetACP();
PCharsetInfo info = findCharsetByCodepage(acp); PCharsetInfo info = findCharsetByCodepage(acp);
if (info) { if (info) {
return info->name; return info->name;
} }
return "unknown"; return "unknown";
#else
return QByteArray(nl_langinfo(CODESET));
#endif
} }
PCharsetInfo CharsetInfoManager::findCharsetByCodepage(int codepage) PCharsetInfo CharsetInfoManager::findCharsetByCodepage(int codepage)

View File

@ -2036,8 +2036,8 @@ bool ProjectModel::canDropMimeData(const QMimeData * data, Qt::DropAction action
QByteArray encoded = data->data(format); QByteArray encoded = data->data(format);
QDataStream stream(&encoded, QIODevice::ReadOnly); QDataStream stream(&encoded, QIODevice::ReadOnly);
while (!stream.atEnd()) { while (!stream.atEnd()) {
int r, c; qint32 r, c;
intptr_t v; quintptr v;
stream >> r >> c >> v; stream >> r >> c >> v;
FolderNode* droppedPointer= (FolderNode*)(v); FolderNode* droppedPointer= (FolderNode*)(v);
PFolderNode droppedNode = mProject->pointerToNode(droppedPointer); PFolderNode droppedNode = mProject->pointerToNode(droppedPointer);
@ -2076,8 +2076,8 @@ bool ProjectModel::dropMimeData(const QMimeData *data, Qt::DropAction action, in
QVector<int> rows,cols; QVector<int> rows,cols;
QVector<intptr_t> pointers; QVector<intptr_t> pointers;
while (!stream.atEnd()) { while (!stream.atEnd()) {
int r, c; qint32 r, c;
intptr_t v; quintptr v;
stream >> r >> c >> v; stream >> r >> c >> v;
rows.append(r); rows.append(r);
cols.append(c); cols.append(c);
@ -2124,7 +2124,7 @@ QMimeData *ProjectModel::mimeData(const QModelIndexList &indexes) const
QModelIndexList::ConstIterator it = indexes.begin(); QModelIndexList::ConstIterator it = indexes.begin();
QList<QUrl> urls; QList<QUrl> urls;
for (; it != indexes.end(); ++it) { for (; it != indexes.end(); ++it) {
stream << (*it).row() << (*it).column() << (intptr_t)((*it).internalPointer()); stream << (qint32)((*it).row()) << (qint32)((*it).column()) << (quintptr)((*it).internalPointer());
FolderNode* p = static_cast<FolderNode*>((*it).internalPointer()); FolderNode* p = static_cast<FolderNode*>((*it).internalPointer());
if (p && p->unitIndex>=0) { if (p && p->unitIndex>=0) {
urls.append(QUrl::fromLocalFile(mProject->units()[p->unitIndex]->fileName())); urls.append(QUrl::fromLocalFile(mProject->units()[p->unitIndex]->fileName()));

View File

@ -45,7 +45,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
mFontDummy = QFont("Consolas",12); mFontDummy = QFont("Consolas",12);
#elif Q_OS_LINUX #elif defined(Q_OS_LINUX)
mFontDummy = QFont("terminal",14); mFontDummy = QFont("terminal",14);
#else #else
#error "Not supported!" #error "Not supported!"

View File

@ -2469,7 +2469,7 @@ void Settings::CompilerSets::saveSets()
} }
mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS); mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS);
mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex); mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex);
mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_COUNT,mList.size()); mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_COUNT,(int)mList.size());
mSettings->mSettings.endGroup(); mSettings->mSettings.endGroup();
} }

View File

@ -69,5 +69,4 @@ protected:
void doLoad() override; void doLoad() override;
void doSave() override; void doSave() override;
}; };
#endif // ENVIRONMENTFILEASSOCIATIONWIDGET_H #endif // ENVIRONMENTFILEASSOCIATIONWIDGET_H

View File

@ -1,7 +1,7 @@
#include "environmentshortcutwidget.h" #include "environmentshortcutwidget.h"
#include "ui_environmentshortcutwidget.h" #include "ui_environmentshortcutwidget.h"
#include "../mainwindow.h" #include "../mainwindow.h"
#include "../ui_mainwindow.h" #include <QMenuBar>
EnvironmentShortcutWidget::EnvironmentShortcutWidget(const QString& name, const QString& group, QWidget *parent) : EnvironmentShortcutWidget::EnvironmentShortcutWidget(const QString& name, const QString& group, QWidget *parent) :
SettingsWidget(name,group,parent), SettingsWidget(name,group,parent),
@ -42,7 +42,7 @@ void EnvironmentShortcutModel::reload()
beginResetModel(); beginResetModel();
mShortcuts.clear(); mShortcuts.clear();
QList<QAction*> actions = pMainWindow->findChildren<QAction*>(QString(),Qt::FindDirectChildrenOnly); QList<QAction*> actions = pMainWindow->findChildren<QAction*>(QString(),Qt::FindDirectChildrenOnly);
QList<QMenu*> menus = pMainWindow->mainWidget()->menubar->findChildren<QMenu*>(); QList<QMenu*> menus = pMainWindow->menuBar()->findChildren<QMenu*>();
foreach( const QMenu* menu, menus) { foreach( const QMenu* menu, menus) {
if (menu->title().isEmpty()) if (menu->title().isEmpty())
continue; continue;

View File

@ -16,7 +16,6 @@
#include "editormiscwidget.h" #include "editormiscwidget.h"
#include "environmentappearencewidget.h" #include "environmentappearencewidget.h"
#include "environmentshortcutwidget.h" #include "environmentshortcutwidget.h"
#include "environmentfileassociationwidget.h"
#include "environmentfolderswidget.h" #include "environmentfolderswidget.h"
#include "environmentperformancewidget.h" #include "environmentperformancewidget.h"
#include "executorgeneralwidget.h" #include "executorgeneralwidget.h"
@ -31,9 +30,12 @@
#include "projectprecompilewidget.h" #include "projectprecompilewidget.h"
#include "projectoutputwidget.h" #include "projectoutputwidget.h"
#include "projectmakefilewidget.h" #include "projectmakefilewidget.h"
#include "projectversioninfowidget.h"
#include "projectdllhostwidget.h" #include "projectdllhostwidget.h"
#include "toolsgeneralwidget.h" #include "toolsgeneralwidget.h"
#ifdef Q_OS_WIN
#include "environmentfileassociationwidget.h"
#include "projectversioninfowidget.h"
#endif
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <QModelIndex> #include <QModelIndex>
@ -113,9 +115,11 @@ PSettingsDialog SettingsDialog::optionDialog()
widget->init(); widget->init();
dialog->addWidget(widget); dialog->addWidget(widget);
#ifdef Q_OS_WIN
widget = new EnvironmentFileAssociationWidget(tr("File Association"),tr("Environment")); widget = new EnvironmentFileAssociationWidget(tr("File Association"),tr("Environment"));
widget->init(); widget->init();
dialog->addWidget(widget); dialog->addWidget(widget);
#endif
widget = new EnvironmentShortcutWidget(tr("Shortcuts"),tr("Environment")); widget = new EnvironmentShortcutWidget(tr("Shortcuts"),tr("Environment"));
widget->init(); widget->init();
@ -254,9 +258,11 @@ PSettingsDialog SettingsDialog::projectOptionDialog()
widget->init(); widget->init();
dialog->addWidget(widget); dialog->addWidget(widget);
#ifdef Q_OS_WIN
widget = new ProjectVersionInfoWidget(tr("Version info"),tr("Project")); widget = new ProjectVersionInfoWidget(tr("Version info"),tr("Project"));
widget->init(); widget->init();
dialog->addWidget(widget); dialog->addWidget(widget);
#endif
dialog->selectFirstWidget(); dialog->selectFirstWidget();

View File

@ -20,6 +20,7 @@
#define GDB_PROGRAM "gdb" #define GDB_PROGRAM "gdb"
#define GDB32_PROGRAM "gdb32" #define GDB32_PROGRAM "gdb32"
#define MAKE_PROGRAM "make" #define MAKE_PROGRAM "make"
#define WINDRES_PROGRAM ""
#define GPROF_PROGRAM "gprof" #define GPROF_PROGRAM "gprof"
#define CLEAN_PROGRAM "rm -rf" #define CLEAN_PROGRAM "rm -rf"
#define CPP_PROGRAM "cpp" #define CPP_PROGRAM "cpp"

View File

@ -11,7 +11,9 @@
#include <QTextCodec> #include <QTextCodec>
#include <QtGlobal> #include <QtGlobal>
#include <QDebug> #include <QDebug>
#ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#endif
#include <QStyleFactory> #include <QStyleFactory>
#include <QDateTime> #include <QDateTime>
#include <QColor> #include <QColor>
@ -95,6 +97,7 @@ static bool gIsGreenEdition = true;
static bool gIsGreenEditionInited = false; static bool gIsGreenEditionInited = false;
bool isGreenEdition() bool isGreenEdition()
{ {
#ifdef Q_OS_WIN
if (!gIsGreenEditionInited) { if (!gIsGreenEditionInited) {
QString keyString = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\RedPanda-C++"); QString keyString = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\RedPanda-C++");
QString value; QString value;
@ -114,6 +117,9 @@ bool isGreenEdition()
gIsGreenEditionInited = true; gIsGreenEditionInited = true;
} }
return gIsGreenEdition; return gIsGreenEdition;
#else
return false;
#endif
} }
QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const QStringList& arguments, QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const QStringList& arguments,
@ -280,6 +286,7 @@ void splitStringArguments(const QString &arguments, QStringList &argumentList)
bool programHasConsole(const QString &filename) bool programHasConsole(const QString &filename)
{ {
#ifdef Q_OS_WIN
bool result = false; bool result = false;
HANDLE handle = CreateFile(filename.toStdWString().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); HANDLE handle = CreateFile(filename.toStdWString().c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (handle != INVALID_HANDLE_VALUE) { if (handle != INVALID_HANDLE_VALUE) {
@ -299,6 +306,9 @@ bool programHasConsole(const QString &filename)
} }
CloseHandle(handle); CloseHandle(handle);
return result; return result;
#else
return true;
#endif
} }
QStringList textToLines(const QString &text) QStringList textToLines(const QString &text)
@ -890,6 +900,8 @@ bool haveGoodContrast(const QColor& c1, const QColor &c2) {
return std::abs(lightness1 - lightness2)>=120; return std::abs(lightness1 - lightness2)>=120;
} }
#ifdef Q_OS_WIN
bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value) { bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value) {
DWORD dataSize; DWORD dataSize;
LONG result; LONG result;
@ -914,6 +926,7 @@ bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QSt
delete [] buffer; delete [] buffer;
return true; return true;
} }
#endif
QList<QByteArray> splitByteArrayToLines(const QByteArray &content) QList<QByteArray> splitByteArrayToLines(const QByteArray &content)
{ {

View File

@ -199,7 +199,10 @@ QString fromByteArray(const QByteArray& s);
int getNewFileNumber(); int getNewFileNumber();
#ifdef Q_OS_WIN
bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value); bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value);
#endif
class CppParser; class CppParser;
void resetCppParser(std::shared_ptr<CppParser> parser); void resetCppParser(std::shared_ptr<CppParser> parser);

View File

@ -226,7 +226,7 @@
<customwidget> <customwidget>
<class>SynEdit</class> <class>SynEdit</class>
<extends>QFrame</extends> <extends>QFrame</extends>
<header location="global">qsynedit/Synedit.h</header> <header location="global">qsynedit/SynEdit.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>