Commit 2416635d authored by Denis Kuplyakov's avatar Denis Kuplyakov

Popup colors now taken from KDE theme.

Special QML class ColorScheme was created to access KDE theme colors
from QML. It is now used at Popup.
parent 529449e9
project(kreversi)
if(NOT COMPILING_KDEGAMES)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
find_package(KDEGames 4.9.0 REQUIRED)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${KDEGAMES_INCLUDE_DIRS} ${KDEGAMES_INCLUDE_DIR}/highscore ${KDE4_INCLUDES} ${QDBUS_INCLUDE_DIRS})
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
find_package(KDEGames 4.9.0 REQUIRED)
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${KDEGAMES_INCLUDE_DIRS} ${KDEGAMES_INCLUDE_DIR}/highscore ${KDE4_INCLUDES} ${QDBUS_INCLUDE_DIRS})
endif(NOT COMPILING_KDEGAMES)
find_package(KDeclarative REQUIRED)
add_subdirectory( pics )
add_subdirectory( sounds )
add_subdirectory( icons )
add_subdirectory( pics )
add_subdirectory( sounds )
add_subdirectory( icons )
add_subdirectory( doc )
include_directories( ${CMAKE_SOURCE_DIR}/libkdegames/highscore )
########### next target ###############
set(kreversi_SRCS
set(kreversi_SRCS
colorscheme.cpp
kreversigame.cpp
kreversiview.cpp
Engine.cpp
......@@ -35,7 +36,7 @@ kde4_add_kcfg_files(kreversi_SRCS preferences.kcfgc)
kde4_add_app_icon(kreversi_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/hi*-app-kreversi.png")
kde4_add_executable(kreversi ${kreversi_SRCS})
target_link_libraries(kreversi kdegames ${KDE4_KDEUI_LIBS}
target_link_libraries(kreversi kdegames ${KDE4_KDEUI_LIBS}
${QT_QTXML_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${KDECLARATIVE_LIBRARIES})
install(TARGETS kreversi ${INSTALL_TARGETS_DEFAULT_ARGS} )
......
......@@ -4,3 +4,24 @@ ColorScheme::ColorScheme(QDeclarativeItem *parent) :
QDeclarativeItem(parent)
{
}
QColor ColorScheme::background() const
{
return KStatefulBrush(KColorScheme::Tooltip,
KColorScheme::NormalBackground)
.brush(QPalette::Active).color();
}
QColor ColorScheme::foreground() const
{
return KStatefulBrush(KColorScheme::Tooltip,
KColorScheme::NormalText)
.brush(QPalette::Active).color();
}
QColor ColorScheme::border() const
{
return KStatefulBrush(KColorScheme::View,
KColorScheme::NormalText)
.brush(QPalette::Active).color();
}
......@@ -3,17 +3,21 @@
#include <QDeclarativeItem>
#include <KColorScheme>
#include <QColor>
class ColorScheme : public QDeclarativeItem
{
Q_OBJECT
public:
explicit ColorScheme(QDeclarativeItem *parent = 0);
signals:
Q_PROPERTY(QColor background READ background)
Q_PROPERTY(QColor foreground READ foreground)
Q_PROPERTY(QColor border READ border)
public slots:
public:
ColorScheme(QDeclarativeItem *parent = 0);
QColor background() const;
QColor foreground() const;
QColor border() const;
};
#endif // COLORSCHEME_H
......@@ -24,6 +24,8 @@ KReversiView::KReversiView(KReversiGame* game, QWidget *parent) :
m_demoMode(false), m_showLastMove(false), m_showLegalMoves(false),
m_showLabels(false)
{
qmlRegisterType<ColorScheme>("ColorScheme", 1, 0, "ColorScheme");
m_provider = new KgThemeProvider();
m_provider->discoverThemes("appdata", QLatin1String("pics"));
m_provider->setDeclarativeEngine("themeProvider", engine());
......
......@@ -26,6 +26,7 @@
#include <KgThemeProvider>
#include <QTimer>
#include "colorscheme.h"
#include "kreversigame.h"
/**
......
import QtQuick 1.1
Item {
property color color
property Gradient gradient
/* Transformation in original is accessed through QTransform */
property Scale scale
property Rotation rotation
property Translate translate
/* In original there are texture access through QPixmap and QImage, what the
difference? */
property Image texture;
}
......@@ -17,6 +17,7 @@
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import ColorScheme 1.0
Rectangle {
id: popupContainer
......@@ -28,9 +29,9 @@ Rectangle {
anchors.leftMargin: 5
anchors.bottomMargin: 5
color: "#111111"
color: colorScheme.background
opacity: 0.9
border.color: "#111111"
border.color: colorScheme.border
border.width: 1
function show(message) {
......@@ -39,6 +40,10 @@ Rectangle {
state = "Showing"
}
ColorScheme {
id: colorScheme
}
Timer {
id: timer
repeat: false
......@@ -64,7 +69,7 @@ Rectangle {
Text {
id: text
anchors.verticalCenter: parent.verticalCenter
color: "white"
color: colorScheme.foreground
wrapMode: Text.WordWrap
}
}
......
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