[kcmdeco] Move KDecorationPreviewOptions into the Model
We need to have it around and not in the Preview widget to be able to update the options when the buttons change.
This commit is contained in:
parent
aab6037c4a
commit
3ea18be574
4 changed files with 7 additions and 4 deletions
|
@ -58,6 +58,7 @@ DecorationModel::DecorationModel(KSharedConfigPtr config, QObject* parent)
|
|||
, m_customButtons(false)
|
||||
, m_leftButtons(QString())
|
||||
, m_rightButtons(QString())
|
||||
, m_options(new KDecorationPreviewOptions)
|
||||
{
|
||||
QHash<int, QByteArray> roleNames;
|
||||
roleNames[Qt::DisplayRole] = "display";
|
||||
|
@ -314,6 +315,8 @@ void DecorationModel::changeButtons(const KWin::DecorationButtons *buttons)
|
|||
m_customButtons = buttons->customPositions();
|
||||
m_leftButtons = buttons->leftButtons();
|
||||
m_rightButtons = buttons->rightButtons();
|
||||
m_options->setCustomTitleButtonsEnabled(m_customButtons);
|
||||
m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons);
|
||||
}
|
||||
|
||||
void DecorationModel::setButtons(bool custom, const QString& left, const QString& right)
|
||||
|
@ -321,6 +324,8 @@ void DecorationModel::setButtons(bool custom, const QString& left, const QString
|
|||
m_customButtons = custom;
|
||||
m_leftButtons = left;
|
||||
m_rightButtons = right;
|
||||
m_options->setCustomTitleButtonsEnabled(m_customButtons);
|
||||
m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons);
|
||||
}
|
||||
|
||||
QModelIndex DecorationModel::indexOfLibrary(const QString& libraryName) const
|
||||
|
|
|
@ -29,6 +29,7 @@ class QWidget;
|
|||
class KDesktopFile;
|
||||
class KDecorationPlugins;
|
||||
class KDecorationPreview;
|
||||
class KDecorationPreviewOptions;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -129,6 +130,7 @@ private:
|
|||
QString m_leftButtons;
|
||||
QString m_rightButtons;
|
||||
KSharedConfigPtr m_config;
|
||||
QScopedPointer<KDecorationPreviewOptions> m_options;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -204,8 +204,6 @@ void PreviewItem::updateDecoration(KDecorationPreviewBridge *bridge)
|
|||
KDecorationPreview::KDecorationPreview(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
options = new KDecorationPreviewOptions;
|
||||
|
||||
bridge[Active] = new KDecorationPreviewBridge(this, true);
|
||||
bridge[Inactive] = new KDecorationPreviewBridge(this, false);
|
||||
|
||||
|
@ -220,7 +218,6 @@ KDecorationPreview::~KDecorationPreview()
|
|||
delete deco[i];
|
||||
delete bridge[i];
|
||||
}
|
||||
delete options;
|
||||
}
|
||||
|
||||
void KDecorationPreview::disablePreview()
|
||||
|
|
|
@ -90,7 +90,6 @@ public:
|
|||
QRegion unobscuredRegion(bool, const QRegion&) const;
|
||||
QRect windowGeometry(bool) const;
|
||||
private:
|
||||
KDecorationPreviewOptions* options;
|
||||
KDecorationPreviewBridge* bridge[NumWindows];
|
||||
KDecoration* deco[NumWindows];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue