Bundle more file in resources

make deployment easier; like katepart or okularpart the ideal
is that just the .so is enough to work

This is just the start, will need to bundle more parts.
At the moment even many keys don't work if you just bundle the part.
This commit is contained in:
Christoph Cullmann
2024-06-05 22:18:19 +00:00
committed by Kurt Hindenburg
parent b94f2c5cde
commit 02e4fbec97
12 changed files with 59 additions and 66 deletions

View File

@@ -137,7 +137,6 @@ option(ENABLE_PLUGIN_SSHMANAGER "Build the SSHManager plugin" ON)
option(ENABLE_PLUGIN_QUICKCOMMANDS "Build the Quick Commands plugin" ON)
add_subdirectory( src )
add_subdirectory( data )
add_subdirectory( desktop )
if (HAVE_DBUS)

View File

@@ -1,7 +0,0 @@
add_subdirectory( color-schemes )
add_subdirectory( keyboard-layouts )
add_subdirectory( layouts )
install( FILES konsole.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR})
install(FILES konsolerc DESTINATION ${KDE_INSTALL_CONFDIR})

View File

@@ -1,18 +0,0 @@
# Note some color schemes are deliberately not installed
# at present
install( FILES
BlackOnLightYellow.colorscheme
BlackOnRandomLight.colorscheme
BlackOnWhite.colorscheme
BlueOnBlack.colorscheme
Breeze.colorscheme
GreenOnBlack.colorscheme
WhiteOnBlack.colorscheme
Linux.colorscheme
DarkPastels.colorscheme
RedOnBlack.colorscheme
Solarized.colorscheme
SolarizedLight.colorscheme
DESTINATION
${KDE_INSTALL_DATADIR}/konsole )

28
data/data.qrc Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/kconfig">
<file>konsolerc</file>
</qresource>
<qresource prefix="/konsole">
<file>konsole.knsrc</file>
<file>color-schemes/BlackOnLightYellow.colorscheme</file>
<file>color-schemes/BlackOnRandomLight.colorscheme</file>
<file>color-schemes/BlackOnWhite.colorscheme</file>
<file>color-schemes/BlueOnBlack.colorscheme</file>
<file>color-schemes/Breeze.colorscheme</file>
<file>color-schemes/GreenOnBlack.colorscheme</file>
<file>color-schemes/WhiteOnBlack.colorscheme</file>
<file>color-schemes/Linux.colorscheme</file>
<file>color-schemes/DarkPastels.colorscheme</file>
<file>color-schemes/RedOnBlack.colorscheme</file>
<file>color-schemes/Solarized.colorscheme</file>
<file>color-schemes/SolarizedLight.colorscheme</file>
<file>keyboard-layouts/default.keytab</file>
<file>keyboard-layouts/linux.keytab</file>
<file>keyboard-layouts/macos.keytab</file>
<file>keyboard-layouts/solaris.keytab</file>
<file>layouts/1x2-terminals.json</file>
<file>layouts/2x1-terminals.json</file>
<file>layouts/2x2-terminals.json</file>
</qresource>
</RCC>

View File

@@ -1,7 +0,0 @@
install( FILES
default.keytab
linux.keytab
macos.keytab
solaris.keytab
DESTINATION
${KDE_INSTALL_DATADIR}/konsole )

View File

@@ -1,6 +0,0 @@
install (FILES
1x2-terminals.json
2x1-terminals.json
2x2-terminals.json
DESTINATION
${KDE_INSTALL_DATADIR}/konsole)

View File

@@ -8,18 +8,13 @@ target_link_libraries(konsole_globalaccel PRIVATE
KF6::Service
)
set(konsole_show_menubar_SRCS konsole_show_menubar.cpp)
qt_add_resources(konsole_show_menubar_SRCS ../desktop/konsole.qrc)
add_executable(konsole_show_menubar ${konsole_show_menubar_SRCS})
add_executable(konsole_show_menubar konsole_show_menubar.cpp ../data/data.qrc ../desktop/konsole.qrc)
target_link_libraries(konsole_show_menubar
KF6::XmlGui
KF6::CoreAddons
)
install(FILES konsole.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(PROGRAMS konsole_add_hamburgermenu_to_toolbar.sh DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR})
install(TARGETS konsole_globalaccel konsole_show_menubar DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin)

View File

@@ -235,7 +235,11 @@ set(konsoleprivate_SRCS ${windowadaptors_SRCS}
widgets/ViewContainer.cpp
widgets/ViewSplitter.cpp
widgets/KonsolePrintManager.cpp
${dbus_xml_srcs})
${dbus_xml_srcs}
../data/data.qrc
../desktop/konsole.qrc)
kconfig_add_kcfg_files(konsoleprivate_SRCS settings/KonsoleSettings.kcfgc)
@@ -265,9 +269,6 @@ ki18n_wrap_ui(konsoleprivate_SRCS
widgets/RenameTabWidget.ui
)
# add the resource files for the ui files
qt_add_resources( konsoleprivate_SRCS ../desktop/konsole.qrc)
add_library(konsoleprivate ${konsoleprivate_SRCS})
generate_export_header(konsoleprivate BASE_NAME konsoleprivate)

View File

@@ -12,7 +12,6 @@
// Qt
#include <QFile>
#include <QFileDialog>
#include <QStandardPaths>
#include <QStringList>
#include <QTabBar>
@@ -179,7 +178,7 @@ void ViewManager::setupActions()
action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
action->setText(i18nc("@action:inmenu", "Load a new tab with layout 2x2 terminals"));
connect(action, &QAction::triggered, this, [this]() {
this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/2x2-terminals.json")));
this->loadLayout(QStringLiteral(":/konsole/layouts/2x2-terminals.json"));
});
collection->addAction(QStringLiteral("load-terminals-layout-2x2"), action);
splitViewActions->addAction(action);
@@ -188,7 +187,7 @@ void ViewManager::setupActions()
action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
action->setText(i18nc("@action:inmenu", "Load a new tab with layout 2x1 terminals"));
connect(action, &QAction::triggered, this, [this]() {
this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/2x1-terminals.json")));
this->loadLayout(QStringLiteral(":/konsole/layouts/2x1-terminals.json"));
});
collection->addAction(QStringLiteral("load-terminals-layout-2x1"), action);
splitViewActions->addAction(action);
@@ -197,7 +196,7 @@ void ViewManager::setupActions()
action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
action->setText(i18nc("@action:inmenu", "Load a new tab with layout 1x2 terminals"));
connect(action, &QAction::triggered, this, [this]() {
this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/1x2-terminals.json")));
this->loadLayout(QStringLiteral(":/konsole/layouts/1x2-terminals.json"));
});
collection->addAction(QStringLiteral("load-terminals-layout-1x2"), action);
splitViewActions->addAction(action);

View File

@@ -103,11 +103,11 @@ QString ColorSchemeManager::colorSchemeNameFromPath(const QString &path)
QStringList ColorSchemeManager::listColorSchemes()
{
QStringList colorschemes;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory);
colorschemes.reserve(dirs.size());
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory);
dirs.append(QStringLiteral(":/konsole/color-schemes")); // fallback to bundled ones
for (const QString &dir : dirs) {
QStringList colorschemes;
for (const QString &dir : std::as_const(dirs)) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.colorscheme"));
for (const QString &file : fileNames) {
colorschemes.append(dir + QLatin1Char('/') + file);

View File

@@ -72,23 +72,32 @@ bool KeyboardTranslatorManager::isTranslatorDeletable(const QString &name) const
bool KeyboardTranslatorManager::isTranslatorResettable(const QString &name) const
{
const QStringList &paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab"));
return (paths.count() > 1);
auto foundFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")).count();
if (QFile::exists(QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab"))) {
++foundFiles;
}
return (foundFiles > 1);
}
const QString KeyboardTranslatorManager::findTranslatorPath(const QString &name) const
{
return QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab"));
auto file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab"));
// fallback to bundled ones
if (file.isEmpty() && QFile::exists(QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab"))) {
file = QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab");
}
return file;
}
void KeyboardTranslatorManager::findTranslators()
{
QStringList list;
const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory);
list.reserve(dirs.size());
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory);
dirs.append(QStringLiteral(":/konsole/keyboard-layouts")); // fallback to bundled ones
for (const QString &dir : dirs) {
QStringList list;
for (const QString &dir : std::as_const(dirs)) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.keytab"));
for (const QString &file : fileNames) {
list.append(dir + QLatin1Char('/') + file);

View File

@@ -944,7 +944,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
connect(getNewButton, &KNSWidgets::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes);
getNewButton->setText(i18n("Get New..."));
getNewButton->setConfigFile(QStringLiteral("konsole.knsrc"));
getNewButton->setConfigFile(QStringLiteral(":/konsole/konsole.knsrc"));
_appearanceUi->colorSchemesBtnLayout->addWidget(getNewButton);
_appearanceUi->enableBidiRenderingButton->setChecked(profile->bidiRenderingEnabled());