From fc5607a9172da9a508279fe7a35543315b10748c Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 10 Feb 2021 21:54:35 +1000 Subject: Fixes for Haiku diff --git a/SimulIDE.pro b/SimulIDE.pro index a4b382f..ead046c 100644 --- a/SimulIDE.pro +++ b/SimulIDE.pro @@ -25,6 +25,10 @@ TEMPLATE = app TARGET = simulide +haiku { + TARGET = SimulIDE +} + QT += svg QT += xml QT += script @@ -189,6 +193,11 @@ linux { QMAKE_LIBS += -lelf QMAKE_LFLAGS += -no-pie } +haiku { + OS = Haiku + QMAKE_LIBS += -lelf -lnetwork -lbsd + QMAKE_LFLAGS += -no-pie +} macx { OS = MacOs INCLUDEPATH += \ @@ -231,6 +240,17 @@ win32 | linux { $(COPY_DIR) ../resources/icons $$TARGET_PREFIX/share ; \ $(MOVE) ../resources/translations/*.qm $$TARGET_PREFIX/share/simulide/translations ; } +haiku { + DESTDIR = $$TARGET_PREFIX + mkpath( $$TARGET_PREFIX ) + copy2dest.commands = \ + $(MKDIR) $$TARGET_PREFIX/data ; \ + $(MKDIR) $$TARGET_PREFIX/examples ; \ + $(MKDIR) $$TARGET_PREFIX/translations ; \ + $(COPY_DIR) ../resources/data $$TARGET_PREFIX ; \ + $(COPY_DIR) ../resources/examples $$TARGET_PREFIX ; \ + $(MOVE) ../resources/translations/*.qm $$TARGET_PREFIX/translations ; +} macx { QMAKE_CC = gcc-10 QMAKE_CXX = g++-10 diff --git a/src/gui/componentselector/componentselector.cpp b/src/gui/componentselector/componentselector.cpp index f2dd1d9..64f6066 100644 --- a/src/gui/componentselector/componentselector.cpp +++ b/src/gui/componentselector/componentselector.cpp @@ -141,7 +141,11 @@ void ComponentSelector::loadXml( const QString &setFile ) if( element.hasAttribute("icon") ) { QDir compSetDir( qApp->applicationDirPath() ); +#ifdef Q_OS_HAIKU + compSetDir.cd( "./data/images" ); +#else compSetDir.cd( "../share/simulide/data/images" ); +#endif icon = compSetDir.absoluteFilePath( element.attribute("icon") ); } QString name = element.attribute( "name" ); diff --git a/src/gui/editorwidget/codeeditor.cpp b/src/gui/editorwidget/codeeditor.cpp index 828cc33..b32c7ff 100644 --- a/src/gui/editorwidget/codeeditor.cpp +++ b/src/gui/editorwidget/codeeditor.cpp @@ -80,8 +80,11 @@ CodeEditor::CodeEditor( QWidget* parent, OutPanelText* outPane ) m_properties = false; m_help = ""; - +#ifdef Q_OS_HAIKU + m_font.setFamily("Noto Sans Mono"); +#else m_font.setFamily("Monospace"); +#endif m_font.setFixedPitch( true ); m_font.setPixelSize( m_fontSize ); setFont( m_font ); diff --git a/src/gui/editorwidget/inodebugger.cpp b/src/gui/editorwidget/inodebugger.cpp index 46700d7..1752749 100644 --- a/src/gui/editorwidget/inodebugger.cpp +++ b/src/gui/editorwidget/inodebugger.cpp @@ -34,8 +34,12 @@ InoDebugger::InoDebugger( QObject* parent, OutPanelText* outPane, QString filePa Q_UNUSED( InoDebugger_properties ); setObjectName( "Arduino Compiler/Debugger" ); - - m_compilerPath = ""; + +#ifdef Q_OS_HAIKU + m_compilerPath = "/system/apps/Arduino/"; +#else + m_compilerPath = ""; +#endif m_compSetting = "arduino_Path"; readSettings(); @@ -150,7 +154,11 @@ int InoDebugger::compile() /// , then debugger will hang! QString cBuildPath = buildPath; QString preferencesPath = SIMUAPI_AppPath::self()->availableDataFilePath("codeeditor/preferences.txt"); +#ifdef Q_OS_HAIKU + QString command = m_compilerPath +"arduino.sh"; +#else QString command = m_compilerPath +"arduino"; +#endif #ifndef Q_OS_UNIX command += "_debug"; @@ -167,7 +175,11 @@ int InoDebugger::compile() command += " -v --board arduino:avr:"+boardName+" --pref build.path=" + cBuildPath; if( !preferencesPath.isEmpty() ) command += " --preferences-file " + preferencesPath; +#ifdef Q_OS_HAIKU + command += " --pref preproc.save_build_files=true --verify " + ProcInoFile; +#else command += " --preserve-temp-files --verify " + ProcInoFile; +#endif m_firmware = ""; m_outPane->appendText( command ); @@ -204,6 +216,10 @@ int InoDebugger::compile() else { m_firmware = buildPath + "/"+ m_fileName + ".ino.hex"; +#ifdef Q_OS_HAIKU + QString cmd = "cp " + cBuildPath + "/*.hex " + m_firmware; + system(cmd.toUtf8().data()); +#endif error = 0; } QApplication::restoreOverrideCursor(); diff --git a/src/main.cpp b/src/main.cpp index 523e084..fe4df10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,11 @@ QString langFile( QString locale ) { +#ifdef Q_OS_HAIKU + QString langF = "./translations/simulide_"+locale+".qm"; +#else QString langF = "../share/simulide/translations/simulide_"+locale+".qm"; +#endif QFile file( langF ); if( !file.exists() ) langF = ""; @@ -59,7 +63,11 @@ int main(int argc, char *argv[]) //QApplication::setGraphicsSystem( "raster" );//native, raster, opengl QApplication app( argc, argv ); +#ifdef Q_OS_HAIKU + QSettings settings( QStandardPaths::standardLocations( QStandardPaths::AppConfigLocation).first()+"/simulide.ini", QSettings::IniFormat, 0l ); +#else QSettings settings( QStandardPaths::standardLocations( QStandardPaths::DataLocation).first()+"/simulide.ini", QSettings::IniFormat, 0l ); +#endif QString locale = QLocale::system().name(); if( settings.contains( "language" ) ) locale = settings.value( "language" ).toString(); @@ -70,7 +78,11 @@ int main(int argc, char *argv[]) locale = QLocale::system().name().split("_").first(); langF = langFile( locale ); } +#ifdef Q_OS_HAIKU + if( langF == "" ) langF = "./translations/simulide_en.qm"; +#else if( langF == "" ) langF = "../share/simulide/translations/simulide_en.qm"; +#endif QTranslator translator; translator.load( langF ); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 911fba1..3d98626 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,7 +33,11 @@ MainWindow* MainWindow::m_pSelf = 0l; MainWindow::MainWindow() : QMainWindow() +#ifdef Q_OS_HAIKU + , m_settings( QStandardPaths::standardLocations( QStandardPaths::AppConfigLocation).first()+"/simulide.ini", QSettings::IniFormat, this ) +#else , m_settings( QStandardPaths::standardLocations( QStandardPaths::DataLocation).first()+"/simulide.ini", QSettings::IniFormat, this ) +#endif { setWindowIcon( QIcon(":/simulide.png") ); m_pSelf = this; diff --git a/src/simuapi_apppath.cpp b/src/simuapi_apppath.cpp index 8fcd2fe..c0315a8 100644 --- a/src/simuapi_apppath.cpp +++ b/src/simuapi_apppath.cpp @@ -31,6 +31,17 @@ SIMUAPI_AppPath *SIMUAPI_AppPath::self() return m_pSelf; } +#ifdef Q_OS_HAIKU +SIMUAPI_AppPath::SIMUAPI_AppPath() + : m_ROExamFolder( qApp->applicationDirPath() ) + , m_RODataFolder( qApp->applicationDirPath() ) + , m_RWDataFolder( QStandardPaths::writableLocation( QStandardPaths::AppConfigLocation )) +{ + m_ROExamFolder.cd( "./examples" ); + m_RODataFolder.cd( "./data" ); + m_RWDataFolder.cd( "data" ); +} +#else SIMUAPI_AppPath::SIMUAPI_AppPath() : m_ROExamFolder( qApp->applicationDirPath() ) , m_RODataFolder( qApp->applicationDirPath() ) @@ -40,6 +51,7 @@ SIMUAPI_AppPath::SIMUAPI_AppPath() m_RODataFolder.cd( "../share/simulide/data" ); m_RWDataFolder.cd( "data" ); } +#endif QDir SIMUAPI_AppPath::RWDataFolder() const { -- 2.30.0 From 410e9e21f148093174d749b46bc3009d01952f58 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 10 Feb 2021 21:54:53 +1000 Subject: Add haiku svg icons diff --git a/src/application.qrc b/src/application.qrc index 87a60ce..9b20c62 100644 --- a/src/application.qrc +++ b/src/application.qrc @@ -4,64 +4,64 @@ ../src/icons/simulide.png ../src/icons/components/null-0.png - ../src/icons/mainwindow/new.png - ../src/icons/mainwindow/open.png - ../src/icons/mainwindow/save.png - ../src/icons/mainwindow/saveas.png - ../src/icons/mainwindow/help.png - ../src/icons/mainwindow/about.png - - ../src/icons/mainwindow/new.png - ../src/icons/mainwindow/open.png - ../src/icons/mainwindow/save.png - ../src/icons/mainwindow/saveas.png - - ../src/icons/mainwindow/cut.png - ../src/icons/mainwindow/copy.png - ../src/icons/mainwindow/paste.png - - ../src/icons/mainwindow/cdup.png - ../src/icons/mainwindow/rotateCCW.png - ../src/icons/mainwindow/rotateCW.png - ../src/icons/mainwindow/find.png - - ../src/icons/mainwindow/verify.png - ../src/icons/mainwindow/verify.png - - ../src/icons/mainwindow/finish.png - ../src/icons/mainwindow/step.png - ../src/icons/mainwindow/stepover.png - ../src/icons/mainwindow/play.png - ../src/icons/mainwindow/runtobk.png - ../src/icons/mainwindow/pause.png - ../src/icons/mainwindow/reset.png - ../src/icons/mainwindow/stop.png - - ../src/icons/mainwindow/poweroff.png - ../src/icons/mainwindow/poweron.png - ../src/icons/mainwindow/powerdeb.png - ../src/icons/mainwindow/pausesim.png - - ../src/icons/mainwindow/remove.png - ../src/icons/mainwindow/properties.png - ../src/icons/mainwindow/rotateCW.png - ../src/icons/mainwindow/rotateCCW.png - ../src/icons/mainwindow/rotate180.png - ../src/icons/mainwindow/hflip.png - ../src/icons/mainwindow/vflip.png - ../src/icons/mainwindow/load.png - ../src/icons/mainwindow/lastfiles.png - ../src/icons/mainwindow/reload.png - ../src/icons/mainwindow/terminal.png - ../src/icons/mainwindow/closeterminal.png - ../src/icons/mainwindow/saveimage.png - - ../src/icons/mainwindow/rename.png + ../src/icons/mainwindow/new.svg + ../src/icons/mainwindow/open.svg + ../src/icons/mainwindow/save.svg + ../src/icons/mainwindow/saveas.svg + ../src/icons/mainwindow/help.svg + ../src/icons/mainwindow/about.svg + + ../src/icons/mainwindow/new.svg + ../src/icons/mainwindow/open.svg + ../src/icons/mainwindow/save.svg + ../src/icons/mainwindow/saveas.svg + + ../src/icons/mainwindow/cut.svg + ../src/icons/mainwindow/copy.svg + ../src/icons/mainwindow/paste.svg + + ../src/icons/mainwindow/cdup.svg + ../src/icons/mainwindow/undo.svg + ../src/icons/mainwindow/redo.svg + ../src/icons/mainwindow/find.svg + + ../src/icons/mainwindow/verify.svg + ../src/icons/mainwindow/verify.svg + + ../src/icons/mainwindow/finish.svg + ../src/icons/mainwindow/step.svg + ../src/icons/mainwindow/stepover.svg + ../src/icons/mainwindow/play.svg + ../src/icons/mainwindow/runtobk.svg + ../src/icons/mainwindow/pause.svg + ../src/icons/mainwindow/reset.svg + ../src/icons/mainwindow/stop.svg + + ../src/icons/mainwindow/poweroff.svg + ../src/icons/mainwindow/poweron.svg + ../src/icons/mainwindow/powerdeb.svg + ../src/icons/mainwindow/pausesim.svg + + ../src/icons/mainwindow/remove.svg + ../src/icons/mainwindow/properties.svg + ../src/icons/mainwindow/rotateCW.svg + ../src/icons/mainwindow/rotateCCW.svg + ../src/icons/mainwindow/rotate180.svg + ../src/icons/mainwindow/hflip.svg + ../src/icons/mainwindow/vflip.svg + ../src/icons/mainwindow/load.svg + ../src/icons/mainwindow/lastfiles.svg + ../src/icons/mainwindow/reload.svg + ../src/icons/mainwindow/terminal.svg + ../src/icons/mainwindow/closeterminal.svg + ../src/icons/mainwindow/saveimage.svg + + ../src/icons/mainwindow/rename.svg ../src/icons/mainwindow/invert.png ../src/icons/mainwindow/unuse.png - ../src/icons/mainwindow/breakpoint.png - ../src/icons/mainwindow/nobreakpoint.png + ../src/icons/mainwindow/breakpoint.svg + ../src/icons/mainwindow/nobreakpoint.svg ../src/icons/components/led.png ../src/icons/components/diode.png -- 2.30.0