Skip to content

Commit 0a29e02

Browse files
danttiTheAssassin
authored andcommitted
Deploy Qt plugins with default deployStandardQtPlugins() function
1 parent 2826ee5 commit 0a29e02

36 files changed

+70
-114
lines changed

src/deployers/BasicPluginsDeployer.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@ BasicPluginsDeployer::BasicPluginsDeployer(std::string moduleName,
2929
qtDataPath(std::move(qtDataPath)) {}
3030

3131
bool BasicPluginsDeployer::deploy() {
32-
for (const auto &pluginName : qtPluginsToBeDeployed()) {
33-
ldLog() << "Deploying" << pluginName << "plugins" << std::endl;
32+
// currently this is a no-op, but we might add more functionality later on, such as some kinds of default
33+
// attempts to copy data based on the moduleName
34+
return doDeploy();
35+
}
36+
37+
bool BasicPluginsDeployer::deployStandardQtPlugins(const std::vector<std::string>& plugins)
38+
{
39+
for (const auto &pluginName : plugins) {
40+
ldLog() << "Deploying Qt" << pluginName << "plugins" << std::endl;
3441
for (fs::directory_iterator i(qtPluginsPath / pluginName); i != fs::directory_iterator(); ++i) {
3542
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins" / pluginName))
3643
return false;
3744
}
3845
}
39-
40-
return customDeploy();
41-
}
42-
43-
bool BasicPluginsDeployer::customDeploy() {
4446
return true;
4547
}
4648

47-
std::vector<std::string> BasicPluginsDeployer::qtPluginsToBeDeployed() const {
48-
return {};
49+
bool BasicPluginsDeployer::doDeploy() {
50+
return true;
4951
}

src/deployers/BasicPluginsDeployer.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,23 @@ namespace linuxdeploy {
5050

5151
public:
5252
/**
53-
* This method deploys the plugins returned by \sa qtPluginsToBeDeployed()
54-
* and call \sa customDeploy() to finalize the deployment.
53+
* This method might make some deployment preparation and calls \sa doDeploy() to finalize the deployment.
5554
*/
5655
bool deploy() override final;
5756

5857
protected:
5958
/**
60-
* The \sa deploy() method can deploy Qt plugins that follow the default
61-
* name and path scheme, but some modules are special so
62-
* they should write custom deployment code.
59+
* This method does the actual moduleName deployment, where any special case should be handled and
60+
* \sa deployStandardQtPlugins () method should be called to deploy Qt plugins that follow the default
61+
* name and path scheme.
6362
*/
64-
virtual bool customDeploy();
63+
virtual bool doDeploy();
6564

6665
/**
67-
* Returns a list of Qt plugin names that should be deployed and
66+
* Deploys a list of Qt plugin that should be deployed and
6867
* follow the default name and path scheme.
6968
*/
70-
virtual std::vector<std::string> qtPluginsToBeDeployed() const;
69+
bool deployStandardQtPlugins(const std::vector<std::string>& plugins);
7170
};
7271
}
7372
}
+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "BearerPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> BearerPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"bearer"};
9+
bool BearerPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"bearer"});
1511
}

src/deployers/BearerPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}
+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "GamepadPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> GamepadPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"gamepads"};
9+
bool GamepadPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"gamepads"});
1511
}

src/deployers/GamepadPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}
+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "LocationPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> LocationPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"geoservices"};
9+
bool LocationPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"geoservices"});
1511
}

src/deployers/LocationPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "Multimedia5PluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> Multimedia5PluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"mediaservice", "audio"};
9+
bool Multimedia5PluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"mediaservice", "audio"});
1511
}

src/deployers/Multimedia5PluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/Multimedia6PluginsDeployer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ using namespace linuxdeploy::core::log;
1212

1313
namespace fs = std::filesystem;
1414

15-
std::vector<std::string> Multimedia6PluginsDeployer::qtPluginsToBeDeployed() const {
15+
bool Multimedia6PluginsDeployer::doDeploy() {
1616
if (fs::exists(qtPluginsPath / "multimedia")) {
17-
return {"multimedia"};
17+
return deployStandardQtPlugins({"multimedia"});
1818
} else {
1919
ldLog() << LD_WARNING << "Missing Qt 6 multimedia plugins, skipping." << std::endl;
20-
return {};
20+
return true;
2121
}
2222
}

src/deployers/Multimedia6PluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/PlatformPluginsDeployer.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ using namespace linuxdeploy::core::log;
1313

1414
namespace fs = std::filesystem;
1515

16-
bool PlatformPluginsDeployer::customDeploy() {
16+
bool PlatformPluginsDeployer::doDeploy() {
1717
ldLog() << "Deploying platform plugins" << std::endl;
1818

1919
// always deploy default platform
@@ -30,6 +30,10 @@ bool PlatformPluginsDeployer::customDeploy() {
3030
}
3131
}
3232

33+
if (!deployStandardQtPlugins({"platforminputcontexts", "imageformats"})) {
34+
return false;
35+
}
36+
3337
// TODO: platform themes -- https://github.com/probonopd/linuxdeployqt/issues/236
3438

3539
const fs::path platformThemesPath = qtPluginsPath / "platformthemes";
@@ -68,7 +72,3 @@ bool PlatformPluginsDeployer::customDeploy() {
6872

6973
return true;
7074
}
71-
72-
std::vector<std::string> PlatformPluginsDeployer::qtPluginsToBeDeployed() const {
73-
return {"platforminputcontexts", "imageformats"};
74-
}

src/deployers/PlatformPluginsDeployer.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
bool customDeploy() override;
14-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1514
};
1615
}
1716
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "PositioningPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> PositioningPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"position"};
9+
bool PositioningPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"position"});
1511
}

src/deployers/PositioningPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "PrintSupportPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> PrintSupportPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"printsupport"};
9+
bool PrintSupportPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"printsupport"});
1511
}

src/deployers/PrintSupportPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/QmlPluginsDeployer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using namespace linuxdeploy::plugin::qt;
88

99
namespace fs = std::filesystem;
1010

11-
bool QmlPluginsDeployer::customDeploy() {
11+
bool QmlPluginsDeployer::doDeploy() {
1212
try {
1313
deployQml(appDir, qtInstallQmlPath);
1414
} catch (const QmlImportScannerError &) {

src/deployers/QmlPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
bool customDeploy() override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/Qt3DPluginsDeployer.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "Qt3DPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> Qt3DPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"geometryloaders", "sceneparsers"};
9+
bool Qt3DPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"geometryloaders", "sceneparsers"});
1511
}

src/deployers/Qt3DPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/SqlPluginsDeployer.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
// system headers
22
#include <filesystem>
33

4-
// library headers
5-
#include <linuxdeploy/core/log.h>
6-
74
// local headers
85
#include "SqlPluginsDeployer.h"
96

107
using namespace linuxdeploy::plugin::qt;
11-
using namespace linuxdeploy::core::log;
128

13-
std::vector<std::string> SqlPluginsDeployer::qtPluginsToBeDeployed() const {
14-
return {"sqldrivers"};
9+
bool SqlPluginsDeployer::doDeploy() {
10+
return deployStandardQtPlugins({"sqldrivers"});
1511
}

src/deployers/SqlPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
std::vector<std::string> qtPluginsToBeDeployed() const override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/SvgPluginsDeployer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using namespace linuxdeploy::core::log;
1212

1313
namespace fs = std::filesystem;
1414

15-
bool SvgPluginsDeployer::customDeploy() {
15+
bool SvgPluginsDeployer::doDeploy() {
1616
ldLog() << "Deploying svg icon engine" << std::endl;
1717

1818
if (!appDir.deployLibrary(qtPluginsPath / "iconengines/libqsvgicon.so", appDir.path() / "usr/plugins/iconengines/"))

src/deployers/SvgPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
bool customDeploy() override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

src/deployers/TextToSpeechPluginsDeployer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ using namespace linuxdeploy::core::log;
1212

1313
namespace fs = std::filesystem;
1414

15-
bool TextToSpeechPluginsDeployer::customDeploy() {
15+
bool TextToSpeechPluginsDeployer::doDeploy() {
1616
// calling the default code is optional, but it won't hurt for now
1717
if (!BasicPluginsDeployer::deploy())
1818
return false;

src/deployers/TextToSpeechPluginsDeployer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace linuxdeploy {
1010
// we can just use the base class's constructor
1111
using BasicPluginsDeployer::BasicPluginsDeployer;
1212

13-
bool customDeploy() override;
13+
bool doDeploy() override;
1414
};
1515
}
1616
}

0 commit comments

Comments
 (0)