remove view::init

This commit is contained in:
Marco Martin 2013-08-08 20:23:53 +02:00
parent 5d4f1b381f
commit f979e1bbcb
5 changed files with 18 additions and 30 deletions

View File

@ -234,7 +234,6 @@ void DesktopCorona::checkViews()
for (int i = m_views.count(); i < m_desktopWidget->screenCount(); ++i) {
View *view = new View(this);
QSurfaceFormat format;
view->init();
view->show();
m_views << view;
@ -262,7 +261,6 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
if (isScreen >= 0) {
m_panelViews[containment] = new PanelView(this);
m_panelViews[containment]->init();
m_panelViews[containment]->setContainment(containment);
m_panelViews[containment]->show();
} else {

View File

@ -58,6 +58,16 @@ PanelView::PanelView(DesktopCorona *corona, QWindow *parent)
this, &PanelView::positionPanel);
connect(this, &View::containmentChanged,
this, &PanelView::restore);
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
qmlRegisterType<QScreen>();
engine()->rootContext()->setContextProperty("panel", this);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml")));
positionPanel();
}
PanelView::~PanelView()
@ -95,19 +105,6 @@ KConfigGroup PanelView::config() const
}
}
void PanelView::init()
{
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
qmlRegisterType<QScreen>();
engine()->rootContext()->setContextProperty("panel", this);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml")));
positionPanel();
}
Qt::Alignment PanelView::alignment() const
{
return m_alignment;

View File

@ -43,8 +43,6 @@ public:
virtual KConfigGroup config() const;
virtual void init();
Qt::Alignment alignment() const;
void setAlignment(Qt::Alignment alignment);

View File

@ -42,6 +42,14 @@ View::View(Plasma::Corona *corona, QWindow *parent)
connect(screen(), &QScreen::virtualGeometryChanged,
this, &View::screenGeometryChanged);
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Desktop.qml")));
}
View::~View()
@ -63,16 +71,6 @@ KConfigGroup View::config() const
return KConfigGroup(&views, QString::number(containment()->screen()));
}
void View::init()
{
if (!m_corona->package().isValid()) {
qWarning() << "Invalid home screen package";
}
setResizeMode(View::SizeRootObjectToView);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Desktop.qml")));
}
void View::setContainment(Plasma::Containment *cont)
{
Plasma::Types::Location oldLoc = (Plasma::Types::Location)location();

View File

@ -41,9 +41,6 @@ public:
virtual KConfigGroup config() const;
//FIXME: not super nice, but we have to be sure qml assignment is done after window flags
virtual void init();
void setContainment(Plasma::Containment *cont);
Plasma::Containment *containment() const;