Commit 2c649f9e authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau

Merge branch '5.5'

parents fa12e851 d06877ce
......@@ -104,6 +104,7 @@ public:
/** Sets a @p w widget that will be shown when there are no opened documents.
* This method takes the ownership of @p w.
* Pass @c nullptr for @p w for a blank background (default).
*/
void setBackgroundCentralWidget(QWidget* w);
......
......@@ -284,10 +284,14 @@ void MainWindowPrivate::showRightDock(bool b)
void MainWindowPrivate::setBackgroundCentralWidget(QWidget* w)
{
delete bgCentralWidget;
auto* l = static_cast<QVBoxLayout*>(centralWidget->layout());
l->addWidget(w, 2);
bgCentralWidget=w;
setBackgroundVisible(area->views().isEmpty());
bgCentralWidget = w;
if (bgCentralWidget) {
auto* l = static_cast<QVBoxLayout*>(centralWidget->layout());
l->addWidget(bgCentralWidget, 2);
setBackgroundVisible(area->views().isEmpty());
}
}
void MainWindowPrivate::setBackgroundVisible(bool v)
......
......@@ -23,7 +23,6 @@ Name[uk]=Шаблони програм (SDK)
Name[x-test]=xxApplication Templates (SDK)xx
Name[zh_CN]=应用程序模板 (SDK)
ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=KDE App Template
TargetDir=kdevappwizard/templates
Uncompress=never
......@@ -23,7 +23,6 @@ Name[uk]=Шаблони файлів (SDK)
Name[x-test]=xxFile Templates (SDK)xx
Name[zh_CN]=文件模板 (SDK)
ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=KDevelop File Template
TargetDir=kdevfiletemplates/templates
Uncompress=never
......@@ -23,7 +23,6 @@ Name[uk]=Документація з програмного інтерфейсу
Name[x-test]=xxAPI Documentation (QtHelp)xx
Name[zh_CN]=API 文档 (QtHelp)
ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=QCH Documentation Files
TargetDir=kdevelop-qthelp
Uncompress=archive
......@@ -33,7 +33,7 @@ K_PLUGIN_FACTORY_WITH_JSON(KDevWelcomePagePluginFactory, "kdevwelcomepage.json",
using namespace KDevelop;
namespace {
WelcomePageWidget* createWelcomePageWidget(QWidget* parent)
WelcomePageWidget* createWelcomePageWidget()
{
// don't attempt to load any QML if CPU doesn't have SSE2 support (cf. bug 381999)
// Note: Clang 4.0 moved the definition of __cpu_model (used by __builtin_cpu_supporst) into compiler-rt lib it seems -- let's just disable this feature on this compiler
......@@ -44,16 +44,25 @@ WelcomePageWidget* createWelcomePageWidget(QWidget* parent)
}
#endif
return new WelcomePageWidget({}, parent);
return new WelcomePageWidget({});
}
}
KDevWelcomePagePlugin::KDevWelcomePagePlugin( QObject* parent, const QVariantList& )
: IPlugin(QStringLiteral("kdevwelcomepage"), parent )
{
m_welcomePageWidget = createWelcomePageWidget();
if (m_welcomePageWidget) {
auto mainWindow = qobject_cast<Sublime::MainWindow*>(ICore::self()->uiController()->activeMainWindow());
mainWindow->setBackgroundCentralWidget(m_welcomePageWidget);
}
}
void KDevWelcomePagePlugin::unload()
{
auto mainWindow = qobject_cast<Sublime::MainWindow*>(ICore::self()->uiController()->activeMainWindow());
if (auto welcomePageWidget = createWelcomePageWidget(mainWindow)) {
mainWindow->setBackgroundCentralWidget(welcomePageWidget);
if (mainWindow && m_welcomePageWidget) {
mainWindow->setBackgroundCentralWidget(nullptr);
}
}
......
......@@ -21,12 +21,20 @@
#define KDEVPLATFORM_PLUGIN_KDEVWELCOMEPAGEPLUGIN_H
#include <interfaces/iplugin.h>
// Qt
#include <QPointer>
class KDevWelcomePagePlugin : public KDevelop::IPlugin
{
Q_OBJECT
public:
KDevWelcomePagePlugin( QObject* parent, const QList<QVariant>& );
public:
void unload() override;
private:
QPointer<QWidget> m_welcomePageWidget;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment