Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/declarative-plugin/previewsettings.cpp
Show All 14 Lines | |||||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU General Public License | 17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | #include "previewsettings.h" | 20 | #include "previewsettings.h" | ||
21 | #include "previewbridge.h" | 21 | #include "previewbridge.h" | ||
22 | #include "buttonsmodel.h" | 22 | #include "buttonsmodel.h" | ||
23 | #include "previewclient.h" | ||||
23 | 24 | | |||
24 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
25 | 26 | | |||
26 | #include <QFontDatabase> | 27 | #include <QFontDatabase> | ||
27 | 28 | | |||
28 | namespace KDecoration2 | 29 | namespace KDecoration2 | ||
29 | { | 30 | { | ||
30 | 31 | | |||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Line(s) | |||||
270 | { | 271 | { | ||
271 | if (m_borderSize == index) { | 272 | if (m_borderSize == index) { | ||
272 | return; | 273 | return; | ||
273 | } | 274 | } | ||
274 | m_borderSize = index; | 275 | m_borderSize = index; | ||
275 | emit borderSizesIndexChanged(m_borderSize); | 276 | emit borderSizesIndexChanged(m_borderSize); | ||
276 | } | 277 | } | ||
277 | 278 | | |||
279 | | ||||
280 | DecorationPalette::DecorationPalette(QObject *parent) | ||||
281 | :QObject(parent) | ||||
282 | {} | ||||
283 | | ||||
284 | PreviewBridge *DecorationPalette::bridge() const | ||||
285 | { | ||||
286 | return m_bridge; | ||||
287 | } | ||||
288 | | ||||
289 | void DecorationPalette::setBridge(PreviewBridge *bridge) | ||||
290 | { | ||||
291 | m_bridge = bridge; | ||||
292 | auto deco = m_bridge->createDecoration(this); | ||||
293 | if (!deco) { | ||||
294 | return; | ||||
295 | } | ||||
296 | auto client = bridge->lastCreatedClient(); | ||||
297 | if (!client) { | ||||
298 | return; | ||||
299 | } | ||||
300 | auto updateColours = [client, this]() { | ||||
301 | m_foregroundColor = client->color(ColorGroup::Active, ColorRole::Foreground); | ||||
302 | m_titleBarColor = client->color(ColorGroup::Active, ColorRole::TitleBar); | ||||
303 | emit foregroundColorChanged(); | ||||
304 | emit titleBarColorChanged(); | ||||
305 | }; | ||||
306 | connect(client, &PreviewClient::paletteChanged, this, updateColours); | ||||
307 | updateColours(); | ||||
308 | } | ||||
309 | | ||||
310 | | ||||
311 | | ||||
312 | | ||||
278 | } | 313 | } | ||
279 | } | 314 | } |