}
VButton {
-
margin:1px;
padding:0px;
border-style: outset;
}
VButton:pressed {
-
border-style: inset;
}
VButton:checked {
}
VButton[action="toggleExtension"] {
- background-color:gray;
- border-color: gray;
+ background-color:gray;
+ border-color: gray;
}
VButton[action="toggleVisibility"] {
- background-color:red;
- border-color:red;
+ background-color:red;
+ border-color:red;
}
\ No newline at end of file
QWidget[name="main"] {
- background-color:black;
+ background-color:rgba(0,0,0,30%);
border-radius: 5px 5px 5px 5px;
}
VButton[action="toggleExtension"] {
- background-color:gray;
- border-color: gray;
+ background-color:gray;
+ border-color: gray;
}
VButton[action="toggleVisibility"] {
- background-color:red;
- border-color:red;
+ background-color:red;
+ border-color:red;
}
\ No newline at end of file
}
VButton {
-
margin:1px;
padding:0px;
border-style: outset;
}
VButton:pressed {
-
border-style: inset;
}
VButton:checked {
-
border-style: inset;
border-width:2px;
}
border-color: #555555;
}
VButton[action="toggleExtension"] {
- background-color:gray;
- border-color: gray;
+ background-color:gray;
+ border-color: gray;
}
VButton[action="toggleVisibility"] {
- background-color:red;
- border-color:red;
+ background-color:red;
+ border-color:red;
}
QWidget[name="main"] {
- background-color:rgba(255,255,255,12%);
-
+ background-color:rgba(255,255,255,30%);
}
VButton {
-
margin:2px;
padding:0px;
border-style: outset;
}
VButton:pressed {
-
border-style: inset;
- border-color: #333333;
+ border-color: #333333;
}
VButton:checked {
-
/* border-style: inset; */
border-width:2px;
border-color: #333333;
}
VButton[action="toggleExtension"] {
- background-color:gray;
- border-color: gray;
+ background-color:gray;
+ border-color: gray;
}
VButton[action="toggleVisibility"] {
- background-color:red;
- border-color:red;
+ background-color:red;
+ border-color:red;
}
DragWidget::DragWidget(QWidget *parent) :
- QWidget(parent), dragged(false), moved(false), locked(false)
+ QWidget(parent), dragged(false), moved(false), locked(false)
{
setAttribute(Qt::WA_TranslucentBackground);
}
DragWidget::~DragWidget()
{
-
}
void DragWidget::blurBackground(bool blurEnabled)
{
- this->setProperty("blurBackground", QVariant(blurEnabled));
-
- Display *dpy = QX11Info::display();
- Atom net_wm_blur_region = XInternAtom(dpy, "_KDE_NET_WM_BLUR_BEHIND_REGION", False);
-
- if (blurEnabled) {
-
- XChangeProperty(dpy, this->winId(), net_wm_blur_region, XA_CARDINAL, 32, PropModeReplace, 0, 0);
-
- }
- else {
- XDeleteProperty(dpy, this->winId(), net_wm_blur_region);
-
- }
- repaint();
+ setProperty("blurBackground", QVariant(blurEnabled));
+ repaint();
}
+
void DragWidget::setLocked(bool locked)
{
- this->locked = locked;
+ this->locked = locked;
}
bool DragWidget::isLocked()
{
- return locked;
+ return locked;
}
void DragWidget::mousePressEvent(QMouseEvent *e)
{
-
if (locked) {
return;
}
gpress = e->globalPos();
dragged = true;
dragPoint = e->pos();
-
-
-
}
void DragWidget::mouseMoveEvent(QMouseEvent *ev)
{
+ if (!dragged) {
+ return;
+ }
-
- if (!dragged) return;
-
- moved=true;
+ moved = true;
QPoint curr(ev->globalPos().x() - dragPoint.x(), ev->globalPos().y() - dragPoint.y());
move(curr);
void DragWidget::mouseReleaseEvent(QMouseEvent *)
{
-
dragged = false;
moved = false;
}
if (isMinimized()) {
showNormal();
show();
- raise();
- }
- else {
+ raise();
+ } else {
showMinimized();
hide();
- lower();
+ lower();
}
}
virtual void paintEvent(QPaintEvent *e);
-
QPoint dragPoint;
QPoint gpress;
autoResizeAction->setChecked(autoResizeEnabled);
widget->setProperty("autoresfont", autoResizeEnabled);
cmenu->addAction(autoResizeAction);
- connect(autoResizeAction,SIGNAL(triggered(bool)), this, SLOT(autoResizeFont(bool)));
+ connect(autoResizeAction, SIGNAL(triggered(bool)), this, SLOT(autoResizeFont(bool)));
bool blur = cfg.readEntry("blurBackground", QVariant(true)).toBool();
blurBackgroundAction->setChecked(blur);
cmenu->addAction(blurBackgroundAction);
widget->blurBackground(blur);
- connect(blurBackgroundAction,SIGNAL(triggered(bool)), widget, SLOT(blurBackground(bool)));
+ connect(blurBackgroundAction, SIGNAL(triggered(bool)), widget, SLOT(blurBackground(bool)));
dock->blurBackground(blur);
- connect(blurBackgroundAction,SIGNAL(triggered(bool)), dock, SLOT(blurBackground(bool)));
+ connect(blurBackgroundAction, SIGNAL(triggered(bool)), dock, SLOT(blurBackground(bool)));
widget->blurBackground(blur);
dock->blurBackground(blur);
KToggleAction *showDockAction = new KToggleAction(i18nc("@action:inmenu", "Show Dock"), this);
showDockAction->setChecked(dockVisible);
cmenu->addAction(showDockAction);
- connect(showDockAction,SIGNAL(triggered(bool)), dock, SLOT(setVisible(bool)));
+ connect(showDockAction, SIGNAL(triggered(bool)), dock, SLOT(setVisible(bool)));
bool isLocked = cfg.readEntry("locked", QVariant(false)).toBool();
KToggleAction *lockOnScreenAction = new KToggleAction(i18nc("@action:inmenu", "Lock on Screen"), this);
lockOnScreenAction->setChecked(isLocked);
cmenu->addAction(lockOnScreenAction);
- connect(lockOnScreenAction,SIGNAL(triggered(bool)), widget, SLOT(setLocked(bool)));
+ connect(lockOnScreenAction, SIGNAL(triggered(bool)), widget, SLOT(setLocked(bool)));
bool stickyModKeys = cfg.readEntry("stickyModKeys", QVariant(false)).toBool();
KToggleAction *stickyModKeysAction = new KToggleAction(i18nc("@action:inmenu", "Sticky Modifier Keys"), this);
stickyModKeysAction->setChecked(stickyModKeys);
cmenu->addAction(stickyModKeysAction);
- connect(stickyModKeysAction,SIGNAL(triggered(bool)), this, SLOT(setStickyModKeys(bool)));
+ connect(stickyModKeysAction, SIGNAL(triggered(bool)), this, SLOT(setStickyModKeys(bool)));
widget->setProperty("stickyModKeys", stickyModKeys);
QFont font = cfg.readEntry("font", widget->font());
cmenu->addMenu(colors);
connect(themeLoader, SIGNAL(colorStyleChanged()), widget, SLOT(repaint()));
connect(themeLoader, SIGNAL(colorStyleChanged()), dock, SLOT(repaint()));
+ connect(blurBackgroundAction, SIGNAL(triggered(bool)), themeLoader, SLOT(reloadColorStyle()));
KHelpMenu *helpMenu = new KHelpMenu(widget, KCmdLineArgs::aboutData());
cmenu->addMenu((QMenu*)helpMenu->menu());
themeLoader->loadTheme(themeName);
widget->setProperty("layout", themeName);
-
QSize defaultSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
QDesktopWidget *pDesktop = QApplication::desktop();
{
if (btn->property("modifier").toBool() == true) {
modKeys.append(btn);
- }
- else {
+ } else {
QObject::connect(btn, SIGNAL(keyClick(unsigned int)), xkbd, SLOT(processKeyPress(unsigned int)) );
}
QString bAction = btn->property("action").toString();
KvkbdApp(bool loginhelper=false);
~KvkbdApp();
-
-
public slots:
void keyProcessComplete(unsigned int);
void chooseFont();
void autoResizeFont(bool mode);
void setStickyModKeys(bool mode);
-
void partLoaded(MainWidget *vPart, int total_rows, int total_cols);
void buttonLoaded(VButton *btn);
-
-
protected:
explicit ResizableDragWidget(QWidget *parent = 0);
~ResizableDragWidget();
-
-
-
protected:
virtual void mouseMoveEvent(QMouseEvent * e);
virtual void mousePressEvent(QMouseEvent * e);
QWidget[name="main"] {
- background-color:rgba(0,0,0,20%);
-
+ background-color:rgba(0,0,0,30%);
}
VButton {
-
margin:1px;
padding:0px;
border-style: outset;
font-size:13px;
font-weight:bold;
-
}
VButton:pressed {
-
border-style: inset;
}
VButton:checked {
-
border-style: inset;
border-width:2px;
}
VButton[colorGroup="normal"] {
border-color: #97c5d5;
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 #97c5d5, stop: 1 #c7f5f5);
-
}
VButton[colorGroup="system"] {
border-color: #e8a8a5;
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 #9faaca, stop: 1 #9faaca);
}
VButton[action="toggleExtension"] {
- background-color:gray;
- border-color: gray;
+ background-color:gray;
+ border-color: gray;
}
VButton[action="toggleVisibility"] {
- background-color:red;
- border-color:red;
+ background-color:red;
+ border-color:red;
}
VButton[colorGroup="nextLayout"] {
- background-color:none;
- border:none;
+ background-color:none;
+ border:none;
}
if (QString::compare(themeName, "standart")==0) {
loading = false;
kapp->quit();
- }
- else {
+ } else {
themeName="standart";
}
}
}
void ThemeLoader::loadColorFile(const QString& fileName)
{
+ lastcolorstyle = fileName;
+
QFile themeFile;
themeFile.setFileName(fileName);
if (!themeFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
-
QMessageBox::information(0, "Error", QString("Unable to open css file: %1").arg(themeFile.fileName()));
return;
}
- ((QWidget*)parent())->setStyleSheet(themeFile.readAll());
+ QString themeData = themeFile.readAll();
+ if (!(QWidget*)parent()->property("blurBackground").toBool()) {
+ themeData = themeData.replace(",30%);", ");");
+ }
+
+ ((QWidget*)parent())->setStyleSheet(themeData);
((QWidget*)parent())->setProperty("colors", fileName);
themeFile.close();
((QWidget*)parent())->repaint();
emit colorStyleChanged();
-
-
}
+
void ThemeLoader::loadColorStyle()
{
-
QAction *action = (QAction*)QObject::sender();
QFileInfo info(action->data().toString());
- this->loadColorFile(info.absoluteFilePath());
+ loadColorFile(info.absoluteFilePath());
+}
+void ThemeLoader::reloadColorStyle()
+{
+ loadColorFile(lastcolorstyle);
}
+
void ThemeLoader::findColorStyles(QMenu *colors, const QString& configSelectedStyle)
{
KStandardDirs kdirs;
item->setData(":/theme/standart.css");
colors->addAction(item);
color_group->addAction(item);
-
-
-
-
colors->setTitle("Color Style");
colors->setIcon(KIcon("preferences-desktop-color"));
}
QString selectedStyle = configSelectedStyle;
- if (selectedStyle.length()<1) {
- selectedStyle = DEFAULT_CSS;
+ if (selectedStyle.length() < 1) {
+ selectedStyle = DEFAULT_CSS;
}
QAction *selectedAction = 0;
QListIterator<QAction*> itrActions(color_group->actions());
while (itrActions.hasNext()) {
QAction *item = itrActions.next();
-
- if (item->data().toString() == selectedStyle) {
- item->setChecked(true);
- selectedAction = item;
- }
-
-
+
+ if (item->data().toString() == selectedStyle) {
+ item->setChecked(true);
+ selectedAction = item;
+ }
+
connect(item, SIGNAL(triggered(bool)), this, SLOT(loadColorStyle()));
}
QFile themeFile;
-
-
QDomDocument doc;
themeFile.setFileName(QString(path + "%1.xml").arg(themeName));
//cout << "heights[" << qPrintable(hintName) << "]=>"<< height << endl;
}
-
wList = docElem.elementsByTagName("spacingHints");
wNode = wList.at(0);
nList = (wNode.toElement()).elementsByTagName("item");
//cout << "spacing[" << qPrintable(hintName) << "]=>"<< width << endl;
}
-
wList = docElem.elementsByTagName("part");
wNode = wList.at(0);
}
}
-
-
return 0;
}
bool ThemeLoader::applyProperty(VButton *btn, const QString& attributeName, QDomNamedNodeMap *attributes, QVariant defaultValue)
if (attributeValue.length()>0) {
btn->setProperty(qPrintable(attributeName), attributeValue);
ret = true;
- }
- else {
+ } else {
if (defaultValue.toString().length()>0) {
btn->setProperty(qPrintable(attributeName), defaultValue);
ret = true;
rowHeight = heightMap.value(rowHeightHint);
}
-
for (int b=0; b<key_list.count(); b++) {
QDomNode node = key_list.at(b);
QDomNamedNodeMap attributes = node.attributes();
btn->setText(btn->property("label").toString());
}
-
applyProperty(btn, "group_label", &attributes);
applyProperty(btn, "group_toggle", &attributes);
applyProperty(btn, "colorGroup", &attributes, "normal");
- applyProperty(btn, "tooltip", &attributes);
+ applyProperty(btn, "tooltip", &attributes);
QString modifier = attributes.namedItem("modifier").toAttr().value();
if (modifier.toInt()>0) {
sx+=buttonWidth+rowSpacingX;
emit buttonLoaded(btn);
- }
- else if (node.toElement().tagName()=="spacing") {
+ } else if (node.toElement().tagName()=="spacing") {
QString widthHint = attributes.namedItem("width").toAttr().value();
QString heightHint = attributes.namedItem("height").toAttr().value();
vPart->setBaseSize(max_sx, max_sy);
emit partLoaded(vPart, total_rows, total_cols);
-
-
-
}
#include "moc_themeloader.cpp"
void loadTheme(QString& themeName);
-
void loadColorFile(const QString& fileName);
int loadLayout(const QString& themeName, const QString& path);
public slots:
void loadColorStyle();
+ void reloadColorStyle();
signals:
-
void partLoaded(MainWidget *vPart, int total_rows, int total_cols);
void buttonLoaded(VButton *btn);
void colorStyleChanged();
+
+private:
+ QString lastcolorstyle;
};
#endif // THEMELOADER_H