diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 9fa92c3e..9870d5cf 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -9,6 +9,14 @@ isEmpty(APP_NAME) { APP_NAME = RedPandaCPP } +isEmpty(PREFIX) { + PREFIX = /usr/local +} + +DEFINES += PREFIX=\\\"$${PREFIX}\\\" +DEFINES += APP_NAME=\\\"$${APP_NAME}\\\" +DEFINES += REDPANDA_CPP_VERSION=\\\"beta.0.12.6\\\" + gcc { QMAKE_CXXFLAGS_RELEASE += -Werror=return-type QMAKE_CXXFLAGS_DEBUG += -Werror=return-type @@ -199,7 +207,6 @@ HEADERS += \ thememanager.h \ todoparser.h \ toolsmanager.h \ - version.h \ widgets/aboutdialog.h \ widgets/bookmarkmodel.h \ widgets/classbrowser.h \ @@ -343,10 +350,6 @@ linux: { TRANSLATIONS += \ RedPandaIDE_zh_CN.ts -isEmpty(PREFIX) { - PREFIX = /usr/local -} - # Default rules for deployment. qnx: target.path = $${PREFIX}/bin else: unix:!android: target.path = $${PREFIX}/bin diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 058eabe0..70c65357 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -250,14 +250,14 @@ void CompilerManager::run(const QString &filename, const QString &arguments, con if (consoleFlag!=0) { if (redirectInput) { newArguments = QString(" -e \"%1\" %2 \"%3\" \"%4\" %5") - .arg(includeTrailingPathDelimiter(pSettings->dirs().appDir())+"consolepauser") + .arg(includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"consolepauser") .arg(consoleFlag) .arg(redirectInputFilename) .arg(localizePath(filename)) .arg(arguments); } else { newArguments = QString(" -e \"%1\" %2 \"%3\" %4") - .arg(includeTrailingPathDelimiter(pSettings->dirs().appDir())+"consolepauser") + .arg(includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"consolepauser") .arg(consoleFlag) .arg(localizePath(filename)).arg(arguments); } diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index dec2fd61..8c2bd060 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -20,7 +20,6 @@ #include "../systemconsts.h" #include "../platform.h" #include "../editor.h" -#include "../version.h" #include @@ -125,7 +124,7 @@ void ProjectCompiler::newMakeFile(QFile& file) void ProjectCompiler::writeMakeHeader(QFile &file) { writeln(file,"# Project: " + mProject->name()); - writeln(file,QString("# Makefile created by Red Panda C++ ") + DEVCPP_VERSION); + writeln(file,QString("# Makefile created by Red Panda C++ ") + REDPANDA_CPP_VERSION); writeln(file); if (mOnlyCheckSyntax) { writeln(file,"# This Makefile is written for syntax check!"); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 54e5761b..c8d4f962 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -36,7 +36,6 @@ #include "widgets/lightfusionstyle.h" #include "problems/problemcasevalidator.h" #include "widgets/ojproblempropertywidget.h" -#include "version.h" #include "iconsmanager.h" #include @@ -698,22 +697,22 @@ void MainWindow::updateAppTitle() str = e->filename(); if (mDebugger->executing()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Debugging"),appName,DEVCPP_VERSION)); + .arg(str,tr("Debugging"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Debugging"),appName)); } else if (mCompilerManager->running()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Running"),appName,DEVCPP_VERSION)); + .arg(str,tr("Running"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Running"),appName)); } else if (mCompilerManager->compiling()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Compiling"),appName,DEVCPP_VERSION)); + .arg(str,tr("Compiling"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Compiling"),appName)); } else { this->setWindowTitle(QString("%1 - %2 %3") - .arg(str,appName,DEVCPP_VERSION)); + .arg(str,appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - %2") .arg(str,appName)); } @@ -730,24 +729,24 @@ void MainWindow::updateAppTitle() if (mDebugger->executing()) { setWindowTitle(QString("%1 - %2 [%3] - %4 %5") .arg(str,str2, - tr("Debugging"),appName,DEVCPP_VERSION)); + tr("Debugging"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Debugging"),appName)); } else if (mCompilerManager->running()) { setWindowTitle(QString("%1 - %2 [%3] - %4 %5") .arg(str,str2, - tr("Running"),appName,DEVCPP_VERSION)); + tr("Running"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Running"),appName)); } else if (mCompilerManager->compiling()) { setWindowTitle(QString("%1 - %2 [%3] - %4 %5") .arg(str,str2, - tr("Compiling"),appName,DEVCPP_VERSION)); + tr("Compiling"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Compiling"),appName)); } else { setWindowTitle(QString("%1 - %2 %3") - .arg(str,appName,DEVCPP_VERSION)); + .arg(str,appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - %2") .arg(str,appName)); } @@ -759,27 +758,27 @@ void MainWindow::updateAppTitle() str = mProject->name(); if (mDebugger->executing()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Debugging"),appName,DEVCPP_VERSION)); + .arg(str,tr("Debugging"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Debugging"),appName)); } else if (mCompilerManager->running()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Running"),appName,DEVCPP_VERSION)); + .arg(str,tr("Running"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Running"),appName)); } else if (mCompilerManager->compiling()) { setWindowTitle(QString("%1 - [%2] - %3 %4") - .arg(str,tr("Compiling"),appName,DEVCPP_VERSION)); + .arg(str,tr("Compiling"),appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - [%2] - %3") .arg(str,tr("Compiling"),appName)); } else { this->setWindowTitle(QString("%1 - %2 %3") - .arg(str,appName,DEVCPP_VERSION)); + .arg(str,appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1 - %2") .arg(str,appName)); } } else { - setWindowTitle(QString("%1 %2").arg(appName,DEVCPP_VERSION)); + setWindowTitle(QString("%1 %2").arg(appName,REDPANDA_CPP_VERSION)); app->setApplicationName(QString("%1").arg(appName)); } } @@ -2042,7 +2041,7 @@ void MainWindow::updateTools() file.close(); if (item->pauseAfterExit) { executeFile( - includeTrailingPathDelimiter(pSettings->dirs().appDir())+"ConsolePauser.exe", + includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"ConsolePauser.exe", " 1 \""+localizePath(file.fileName())+"\" ", workDir, file.fileName()); } else { @@ -2055,7 +2054,7 @@ void MainWindow::updateTools() } else { if (item->pauseAfterExit) { executeFile( - includeTrailingPathDelimiter(pSettings->dirs().appDir())+"ConsolePauser.exe", + includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"ConsolePauser.exe", " 1 \""+program+"\" "+params, workDir, ""); } else { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index b935de86..2be48262 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -172,18 +172,27 @@ QString Settings::Dirs::appDir() const return QApplication::instance()->applicationDirPath(); } -QString Settings::Dirs::appLibDir() const +QString Settings::Dirs::appResourceDir() const { #ifdef Q_OS_WIN return appDir(); #elif defined(Q_OS_LINUX) - return QFileInfo(includeTrailingPathDelimiter(appDir())+"../lib").absolutePath(); + return includeTrailingPathDelimiter(PREFIX)+"share/"+APP_NAME; +#endif +} + +QString Settings::Dirs::appLibexecDir() const +{ +#ifdef Q_OS_WIN + return appDir(); +#elif defined(Q_OS_LINUX) + return includeTrailingPathDelimiter(PREFIX)+"libexec/"+APP_NAME; #endif } QString Settings::Dirs::templateDir() const { - return includeTrailingPathDelimiter(appLibDir()) + "templates"; + return includeTrailingPathDelimiter(appResourceDir()) + "templates"; } QString Settings::Dirs::projectDir() const @@ -2834,7 +2843,7 @@ void Settings::Environment::doLoad() mTerminalPath = stringValue("terminal_path","/usr/bin/konsole"); if (mTerminalPath.isEmpty()) mTerminalPath = stringValue("terminal_path","/usr/bin/x-terminal-emulator"); - mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appDir())+"astyle"; + mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"astyle"; #endif } diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index c0a2931f..b38f2004 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -106,7 +106,8 @@ public: }; explicit Dirs(Settings * settings); QString appDir() const; - QString appLibDir() const; + QString appResourceDir() const; + QString appLibexecDir() const; QString templateDir() const; QString projectDir() const; QString data(DataType dataType = DataType::None) const; diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 0659d8fe..e321ddb8 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -37,7 +37,6 @@ #include "editorlist.h" #include "editor.h" #include "project.h" -#include "version.h" #include "compiler/executablerunner.h" #ifdef Q_OS_WIN #include @@ -797,7 +796,7 @@ QString parseMacros(const QString &s) result.replace("", localizePath(QDir::currentPath())); result.replace("", localizePath(pSettings->dirs().executable())); - result.replace("", DEVCPP_VERSION); + result.replace("", REDPANDA_CPP_VERSION); result.replace("", localizePath(pSettings->dirs().appDir())); QDate today = QDate::currentDate(); QDateTime now = QDateTime::currentDateTime(); diff --git a/RedPandaIDE/version.h b/RedPandaIDE/version.h.in similarity index 91% rename from RedPandaIDE/version.h rename to RedPandaIDE/version.h.in index 8229e550..c44ed6f5 100644 --- a/RedPandaIDE/version.h +++ b/RedPandaIDE/version.h.in @@ -19,6 +19,7 @@ #include -#define DEVCPP_VERSION "beta.0.12.6" +#define PREFIX "$${PREFIX}" +#define RED_PANDA_CPP_VERSION "$${PREFIX}" #endif // VERSION_H diff --git a/RedPandaIDE/widgets/aboutdialog.cpp b/RedPandaIDE/widgets/aboutdialog.cpp index c1f29b35..19c9cc5a 100644 --- a/RedPandaIDE/widgets/aboutdialog.cpp +++ b/RedPandaIDE/widgets/aboutdialog.cpp @@ -17,15 +17,13 @@ #include "aboutdialog.h" #include "ui_aboutdialog.h" #include "../systemconsts.h" -#include "../version.h" - AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AboutDialog) { ui->setupUi(this); - ui->lblTitle->setText(ui->lblTitle->text() + tr("Version: ") + DEVCPP_VERSION); + ui->lblTitle->setText(ui->lblTitle->text() + tr("Version: ") + REDPANDA_CPP_VERSION); #ifdef __GNUC__ ui->lblQt->setText(ui->lblQt->text() diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index 2de7fa96..549091a7 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -17,7 +17,7 @@ linux: { resources.files += linux/templates INSTALLS += resources - docs.path = $${PREFIX}/share/docs/$${APP_NAME} + docs.path = $${PREFIX}/share/doc/$${APP_NAME} docs.files += README.md docs.files += NEWS.md docs.files += LICENSE @@ -25,6 +25,6 @@ linux: { pixmaps.path = $${PREFIX}/share/pixmaps pixmaps.files += linux/redpandaide.png - + INSTALLS += pixmaps } diff --git a/consolepauser/consolepauser.pro b/consolepauser/consolepauser.pro index 31679d60..dcc5fecc 100644 --- a/consolepauser/consolepauser.pro +++ b/consolepauser/consolepauser.pro @@ -31,6 +31,6 @@ isEmpty(PREFIX) { } # Default rules for deployment. -qnx: target.path = /tmp/$${PREFIX}/libexec/$${APP_NAME} -else: unix:!android: target.path = /usr/$${PREFIX}/libexec/$${APP_NAME} +qnx: target.path = $${PREFIX}/libexec/$${APP_NAME} +else: unix:!android: target.path = $${PREFIX}/libexec/$${APP_NAME} !isEmpty(target.path): INSTALLS += target diff --git a/linux/install.sh b/linux/install.sh index da2a2d39..7324152d 100755 --- a/linux/install.sh +++ b/linux/install.sh @@ -1,6 +1,6 @@ #!/bin/sh echo Copying desktop files... -sudo cp -f redpandaide.desktop /usr/share/applications +sudo cp -f /opt/RedPandaIDE/redpandaide.desktop /usr/share/applications echo Done!