Permalink
Browse files

config app for notifications

  • Loading branch information...
1 parent a99d62c commit fd826ca19c5e72e93fce2ed8470973c0edc1a4c4 @pvanek pvanek committed Jun 8, 2012
@@ -3,5 +3,5 @@ add_subdirectory(src)
add_subdirectory(razor-config-mouse)
add_subdirectory(razor-config-appearance)
add_subdirectory(razor-config-qtconfig)
-add_subdirectory(razor-config-notificationd)
+
@@ -1,52 +0,0 @@
-project(razor-config-notificationd)
-
-include_directories (
- ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
- ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR}
- ${QT_QTDBUS_INCLUDE_DIR} ${QT_QTXML_INCLUDE_DIR}
- ${CMAKE_SOURCE_DIR}/libraries/
- ../../libraries/razorqt
- )
-
-set(razor_config_notificationd_hdrs
- )
-
-set(razor_config_notificationd_mocs
- mainwindow.h
-)
-
-set(razor_config_notificationd_srcs
- mainwindow.cpp
- main.cpp
- )
-
-set(razor_config_notificationd_ui
- mainwindow.ui
-)
-
-set(razor_config_notificationd_qrc
-)
-
-# Translations **********************************
-include(RazorTranslate)
-razor_translate_desktop(DESKTOP_FILES razor-config-notificationd.desktop.in)
-#************************************************
-
-qt4_wrap_cpp(razor_config_notificationd_mocs_srcs ${razor_config_notificationd_mocs})
-qt4_wrap_ui(razor_config_notificationd_ui_hdrs ${razor_config_notificationd_ui})
-qt4_add_resources(razor_config_notificationd_qrc_srcs ${razor_config_notificationd_qrc})
-
-set(razor_config_notificationd_srcs
- ${razor_config_notificationd_srcs}
- ${razor_config_notificationd_mocs_srcs}
- ${razor_config_notificationd_ui_hdrs}
- ${razor_config_notificationd_qrc_srcs}
- ${DESKTOP_FILES}
-)
-
-add_executable(${PROJECT_NAME} ${razor_config_notificationd_srcs} )
-add_dependencies(${PROJECT_NAME} razorqt )
-target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} razorqt)
-
-install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
-install(FILES ${DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
@@ -1,131 +0,0 @@
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-
-//#include "razornotification.h"
-#include <QtCore/QDebug>
-#include <QtGui/QColorDialog>
-#include <QtGui/QDesktopWidget>
-
-namespace
-{
- const QString g_scRazorSettingsName ="razorqt-notify";
-
- const QString g_scNotificationSize = "notification_size";
- const QString g_scNotificationPosition = "notification_position";
- const QString g_scNotificationOpacity = "notification_opacity";
- const QString g_scNotificationBckColor = "notification_backgroundColor";
-}
-
-MainWindow::MainWindow(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::MainWindow),
- m_settings( g_scRazorSettingsName ),
- m_notificationId(0)
-{
- ui->setupUi(this);
- connect(ui->showNotificationButton, SIGNAL(pressed()), this, SLOT(showNotification()));
-
- QPoint size = m_settings.value(g_scNotificationSize).toPoint();
- QPoint pos = m_settings.value(g_scNotificationPosition).toPoint();
-
- QDesktopWidget* pDesktop = QApplication::desktop();
-
- qint32 maxX = 0 , maxY = 0 ;
- for ( int i=0;i< pDesktop->screenCount();++i)
- {
- maxX += pDesktop->screenGeometry(i).width();
- maxY = qMax(maxY, pDesktop->screenGeometry(i).height());
- }
- qDebug() << maxX ;
- qDebug() << maxY ;
-
- ui->sizeXspinBox->setMaximum(400);
- ui->sizeXspinBox->setMinimum(200);
- ui->sizeYspinBox->setMaximum(300);// maximum
- ui->sizeYspinBox->setMinimum(100); //minimum height value
-
- ui->PositionXBox->setMaximum(maxX);
- ui->PositionXBox->setMinimum(0);
- ui->PositionYBox->setMaximum(maxY);
- ui->PositionYBox->setMinimum(0);
-
- ui->sizeXspinBox->setValue(size.x());
- ui->sizeYspinBox->setValue(size.y());
-
- ui->PositionXBox->setValue(pos.x());
- ui->PositionYBox->setValue(pos.y());
-
-
- ui->opacitySlider->setMinimum(0);
- ui->opacitySlider->setMaximum(100);
-
- qreal opacityValue = m_settings.value(g_scNotificationOpacity).toReal();
- ui->opacitySlider->setValue(100* opacityValue);
-
- connect( ui->PositionXBox, SIGNAL(valueChanged(int)) , this , SLOT(positionChanged()) );
- connect( ui->PositionYBox, SIGNAL(valueChanged(int)) , this , SLOT(positionChanged()) );
-
- connect( ui->sizeXspinBox, SIGNAL(valueChanged(int)) , this , SLOT(sizeChanged()) );
- connect( ui->sizeYspinBox, SIGNAL(valueChanged(int)) , this , SLOT(sizeChanged()) );
-
- connect( ui->opacitySlider, SIGNAL(valueChanged(int)) , this , SLOT(opacityChanged(int)) );
- connect( ui->colorPickerButton, SIGNAL(pressed()), this, SLOT(colorPickerClicked()));
-}
-
-MainWindow::~MainWindow()
-{
- /*
- RazorNotification::closeNotification(m_notificationId);
- */
- delete ui;
-}
-
-void MainWindow::showNotification()
-{
- /*
- m_notificationId = RazorNotification::notify(tr("A testing application"),
- "razor-logo.png",
- tr("Notification Summary"),
- tr("Notification Body") + "<p>Lorem ipsim dolor sir amet...");
- */
-}
-
-void MainWindow::positionChanged()
-{
- QPoint newPos ;
- newPos.setX(ui->PositionXBox->value());
- newPos.setY(ui->PositionYBox->value());
- m_settings.setValue(g_scNotificationPosition, newPos);
-
- m_settings.sync();
-}
-
-void MainWindow::sizeChanged()
-{
- QPoint newSize ;
- newSize.setX(ui->sizeXspinBox->value());
- newSize.setY(ui->sizeYspinBox->value());
- m_settings.setValue(g_scNotificationSize, newSize);
-
- m_settings.sync();
-}
-
-void MainWindow::opacityChanged(int value)
-{
- qreal newVal = static_cast<qreal>(value) / static_cast<qreal>(100);
- qDebug() << "Opacity changed" << value << " newVal=" << newVal;
- m_settings.setValue(g_scNotificationOpacity, newVal);
-
- m_settings.sync();
-}
-
-void MainWindow::colorPickerClicked()
-{
- QColor init = m_settings.value(g_scNotificationBckColor).value<QColor>();
- QColor c = QColorDialog::getColor(init,this);
- if ( c.isValid() )
- {
- m_settings.setValue(g_scNotificationBckColor, c);
- }
-}
-
@@ -1,34 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QtGui/QWidget>
-
-#include "razorsettings.h"
-
-namespace Ui {
-class MainWindow;
-}
-
-class MainWindow : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit MainWindow(QWidget *parent = 0);
- ~MainWindow();
-
-private slots:
- void showNotification();
- void positionChanged();
- void sizeChanged();
- void opacityChanged(int value);
-
- void colorPickerClicked();
-
-private:
- Ui::MainWindow *ui;
- RazorSettings m_settings ;
- quint32 m_notificationId ;
-};
-
-#endif // MAINWINDOW_H
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QWidget" name="MainWindow">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Razor Notifications Configuration</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="razorqtThemeCheckbox">
- <property name="text">
- <string>Use razorqt theme</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Notification size:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QSpinBox" name="sizeXspinBox"/>
- </item>
- <item row="0" column="3">
- <widget class="QSpinBox" name="sizeYspinBox"/>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Notification position</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QSpinBox" name="PositionXBox"/>
- </item>
- <item row="1" column="3">
- <widget class="QSpinBox" name="PositionYBox"/>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QFormLayout" name="formLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Notification opacity:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSlider" name="opacitySlider">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Notification background color:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QPushButton" name="colorPickerButton">
- <property name="text">
- <string>ColorPicker</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Notification text color:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="pushButton">
- <property name="text">
- <string>ColorPicker</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QPushButton" name="showNotificationButton">
- <property name="text">
- <string>Show notification</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
@@ -7,3 +7,5 @@ find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
add_subdirectory(src)
+add_subdirectory(config)
+
@@ -0,0 +1,45 @@
+project(razor-config-notificationd)
+
+include_directories (
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/libraries/
+ )
+
+set(NOTIFICATIONS_CONF_MOC
+ advancedsettings.h
+ basicsettings.h
+ mainwindow.h
+)
+
+set(NOTIFICATIONS_CONF_SRC
+ advancedsettings.cpp
+ basicsettings.cpp
+ mainwindow.cpp
+ main.cpp
+ )
+
+set(NOTIFICATIONS_CONF_UI
+ advancedsettings.ui
+ basicsettings.ui
+)
+
+
+# Translations **********************************
+include(RazorTranslate)
+razor_translate_desktop(DESKTOP_FILES razor-config-notificationd.desktop.in)
+#************************************************
+
+qt4_wrap_cpp(NOTIFICATIONS_CONF_MOC_CPP ${NOTIFICATIONS_CONF_MOC})
+qt4_wrap_ui(NOTIFICATIONS_CONF_UI_CPP ${NOTIFICATIONS_CONF_UI})
+
+add_executable(${PROJECT_NAME} ${NOTIFICATIONS_CONF_SRC}
+ ${NOTIFICATIONS_CONF_MOC_CPP}
+ ${NOTIFICATIONS_CONF_UI_CPP})
+add_dependencies(${PROJECT_NAME} razorqt )
+target_link_libraries(${PROJECT_NAME} ${QT_QTCORE_LIBRARY}
+ ${QT_QTGUI_LIBRARY}
+ razorqt)
+
+install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
+install(FILES ${DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
Oops, something went wrong.

0 comments on commit fd826ca

Please sign in to comment.