Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquetc committed Aug 2, 2021
2 parents cd72c94 + 15fad59 commit f968e95
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 75 deletions.
Binary file removed AntidoteIcone.png
Binary file not shown.
2 changes: 1 addition & 1 deletion NEWS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Description:
- "Writing games: forbid Ctrl+Z"

Version: 1.9.27
Date: 2021-08-01
Date: 2021-08-02
Type: stable
Description:
- "Minimap: new minimap scrollbar"
Expand Down
2 changes: 1 addition & 1 deletion eu.skribisto.skribisto.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</screenshot>
</screenshots>
<releases>
<release type="stable" version="1.9.27" date="2021-08-01T00:00:00Z">
<release type="stable" version="1.9.27" date="2021-08-02T00:00:00Z">
<description>
<ul>
<li>Minimap: new minimap scrollbar</li>
Expand Down
4 changes: 3 additions & 1 deletion package/flatpak/eu.skribisto.skribisto.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"--socket=fallback-x11",
"--socket=wayland",
"--filesystem=home",
"--device=dri"
"--device=dri",
"--own-name=com.druide.antidote.*",
"--talk-name=org.freedesktop.Flatpak"
],
"separate-locales": false,
"modules": [
Expand Down
2 changes: 2 additions & 0 deletions package/flatpak/eu.skribisto.skribisto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ finish-args:
- --socket=wayland
- --filesystem=home
- --device=dri
- --own-name=com.druide.antidote.*
- --talk-name=org.freedesktop.Flatpak
separate-locales: false
modules:

Expand Down
4 changes: 3 additions & 1 deletion package/flatpak/local/eu.skribisto.skribisto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ finish-args:
- --share=network
- --socket=fallback-x11
- --socket=wayland
- --filesystem=host
- --filesystem=home
- --device=dri
- --own-name=com.druide.antidote.*
- --talk-name=org.freedesktop.Flatpak
separate-locales: false
modules:

Expand Down
24 changes: 20 additions & 4 deletions src/app/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,32 @@ int main(int argc, char *argv[])
if (returnCode == -1)
{
QProcess *proc = new QProcess();
proc->start(QCoreApplication::applicationFilePath(), app.arguments());

if (QFile("/app/manifest.json").exists()) { // means it's in Flatpak
QStringList allArguments;
allArguments << "--host" << "flatpak" << "run" << "eu.skribisto.skribisto";
proc->start("flatpak-spawn", allArguments);
}
else {
proc->start(QCoreApplication::applicationFilePath(), QStringList());
}
}

// restart with Fist step opened and at plugin page:
if (returnCode == -2)
{
QStringList args = app.arguments();
args << "--firstStepsAtPluginPage";
QProcess *proc = new QProcess();
proc->start(QCoreApplication::applicationFilePath(), args);

if (QFile("/app/manifest.json").exists()) { // means it's in Flatpak
QStringList allArguments;
allArguments << "--host" << "flatpak" << "run" << "eu.skribisto.skribisto" << "--firstStepsAtPluginPage";
proc->start("flatpak-spawn", allArguments);
}
else {
QStringList args;
args << "--firstStepsAtPluginPage";
proc->start(QCoreApplication::applicationFilePath(), args);
}
}

return returnCode;
Expand Down
145 changes: 80 additions & 65 deletions src/plugins/antidotePageToolbox/AdaptateurAntidote.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -c AdaptateurAntidote -a AdaptateurAntidote API_DBus.xml
* Command line was: qdbusxml2cpp -c AdaptateurAntidote -a AdaptateurAntidote
*API_DBus.xml
*
* qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd.
*
Expand All @@ -16,8 +17,8 @@
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
template<class T>class QList;
template<class Key, class Value>class QMap;
class QString;
class QStringList;
class QVariant;
Expand All @@ -26,76 +27,90 @@ QT_END_NAMESPACE
/*
* Adaptor class for interface com.druide.antidote.dbus.api
*/
class AdaptateurAntidote: public QDBusAbstractAdaptor
{
class AdaptateurAntidote : public QDBusAbstractAdaptor {
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.druide.antidote.dbus.api")
Q_CLASSINFO("D-Bus Interface", "com.druide.antidote.dbus.api")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"com.druide.antidote.dbus.api\">\n"
" <method name=\"ActiveDocument\"/>\n"
" <method name=\"CorrigeDansTexteur\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"laChaine\"/>\n"
" <arg direction=\"in\" type=\"b\" name=\"automatique\"/>\n"
" </method>\n"
" <method name=\"DonneBloc\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneDebutSelection\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneFinDocument\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneFinSelection\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonnePositionFinBoite\">\n"
" <arg direction=\"in\" type=\"i\" name=\"unePos\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneRetourDeCharriot\">\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneTitreDocument\">\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"PermetsRetourDeCharriot\">\n"
" <arg direction=\"out\" type=\"b\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"RetourneAuTexteur\"/>\n"
" <method name=\"RompsLienCorrecteur\"/>\n"
" <method name=\"RompsLienTexteur\"/>\n"
" <method name=\"SelectionneIntervalle\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" </method>\n"
" </interface>\n"
"")
" <interface name=\"com.druide.antidote.dbus.api\">\n"
" <method name=\"ActiveDocument\"/>\n"
" <method name=\"CorrigeDansTexteur\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"laChaine\"/>\n"
" <arg direction=\"in\" type=\"b\" name=\"automatique\"/>\n"
" </method>\n"
" <method name=\"DonneBloc\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneDebutSelection\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneFinDocument\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneFinSelection\">\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonnePositionFinBoite\">\n"
" <arg direction=\"in\" type=\"i\" name=\"unePos\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneRetourDeCharriot\">\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"DonneTitreDocument\">\n"
" <arg direction=\"out\" type=\"s\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"PermetsRetourDeCharriot\">\n"
" <arg direction=\"out\" type=\"b\" name=\"_ret\"/>\n"
" </method>\n"
" <method name=\"RetourneAuTexteur\"/>\n"
" <method name=\"RompsLienCorrecteur\"/>\n"
" <method name=\"RompsLienTexteur\"/>\n"
" <method name=\"SelectionneIntervalle\">\n"
" <arg direction=\"in\" type=\"i\" name=\"leDebut\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"laFin\"/>\n"
" </method>\n"
" </interface>\n"
"")

public:

AdaptateurAntidote(QObject *parent);
virtual ~AdaptateurAntidote();

public: // PROPERTIES
public Q_SLOTS: // METHODS
public:

// PROPERTIES

public Q_SLOTS:

// METHODS
void ActiveDocument();
void CorrigeDansTexteur(int leDebut, int laFin, const QString &laChaine, bool automatique);
QString DonneBloc(int leDebut, int laFin);
int DonneDebutSelection();
int DonneFinDocument();
int DonneFinSelection();
int DonnePositionFinBoite(int unePos);
void CorrigeDansTexteur(int leDebut,
int laFin,
const QString& laChaine,
bool automatique);
QString DonneBloc(int leDebut,
int laFin);
int DonneDebutSelection();
int DonneFinDocument();
int DonneFinSelection();
int DonnePositionFinBoite(int unePos);
QString DonneRetourDeCharriot();
QString DonneTitreDocument();
bool PermetsRetourDeCharriot();
void RetourneAuTexteur();
void RompsLienCorrecteur();
void RompsLienTexteur();
void SelectionneIntervalle(int leDebut, int laFin);
Q_SIGNALS: // SIGNALS
bool PermetsRetourDeCharriot();
void RetourneAuTexteur();
void RompsLienCorrecteur();
void RompsLienTexteur();
void SelectionneIntervalle(int leDebut,
int laFin);

Q_SIGNALS:

// SIGNALS
};

#endif
#endif // ifndef ADAPTATEURANTIDOTE_H
28 changes: 26 additions & 2 deletions src/plugins/antidotePageToolbox/ImplementationAntidote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

ImplementationAntidote::ImplementationAntidote(QObject *parent)
: QObject(parent), m_textDoc(nullptr), m_language(Context),
m_connexionDBus(QDBusConnection::sessionBus()), m_adaptateur(nullptr)
m_connexionDBus(QDBusConnection::sessionBus()),
m_adaptateur(nullptr)
{
m_textTopMargin = 2;
m_textIndent = 2;
Expand Down Expand Up @@ -266,7 +267,30 @@ void ImplementationAntidote::launchAntidote(TypeOuvrage ouvrage)
break;
}

QProcess::startDetached(cheminCompletVersAntidote, arguments);
QFile antidoteFile(cheminCompletVersAntidote);

if (antidoteFile.exists()) {
qDebug() << "Found" << cheminCompletVersAntidote;

if (!QProcess::startDetached(cheminCompletVersAntidote, arguments)) {
qCritical() << "Antidote wouldn't start";
}
}
else if (QFile("/app/manifest.json").exists()) { // means it's in Flatpak
qDebug() << "Found /app/manifest.json --> Flatpak !";

QProcess *proc = new QProcess();
QStringList allArguments;
allArguments << "--host" << cheminCompletVersAntidote << arguments;
proc->start("flatpak-spawn", allArguments);

if (!proc->waitForStarted(2000)) {
qCritical() << "Antidote wouldn't start";
}
}
else {
qCritical() << "Antidote wouldn't find the executable at" << cheminCompletVersAntidote;
}
}

// -------------------------------------------------------------------------
Expand Down

0 comments on commit f968e95

Please sign in to comment.