1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
/******************************************************************************
* Copyright © 2012-2014 Institut für Nachrichtentechnik, Universität Rostock *
* Copyright © 2006-2012 Quality & Usability Lab, *
* Telekom Innovation Laboratories, TU Berlin *
* *
* This file is part of the SoundScape Renderer (SSR). *
* *
* The SSR is free software: you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or (at your option) *
* any later version. *
* *
* The SSR is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
* FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along *
* with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* The SSR is a tool for real-time spatial audio reproduction providing a *
* variety of rendering algorithms. *
* *
* http://spatialaudio.net/ssr ssr@spatialaudio.net *
******************************************************************************/
/// @file
/// GUI wrapper class (implementation).
#include "qgui.h"
// Qt stylesheet
QString qt_style_sheet =
#ifdef __APPLE__
"QWidget { \n"
" color: black; \n"
" font: normal 13pt; \n"
" } \n"
#else
"QWidget { \n"
" color: black; \n"
" font: normal 9pt \"Monospace\"; \n"
" } \n"
#endif
"QLabel { \n"
" background-color: rgb(244, 244, 244); \n"
" color: black; \n"
" } \n"
" \n"
"QLabel#notifier { \n"
" background-color: rgb(244, 0, 0, 255); \n"
/* " color: black; \n"*/
" } \n"
" \n"
// define style of processing button
"QPushButton#_processing_button { \n"
" border-image: url(images/processing_button.png) 0; \n"
" } \n"
" \n"
"QPushButton#_processing_button:pressed { \n"
" border-image: url(images/processing_button_pressed.png) 0; \n"
" } \n"
" \n"
"QPushButton#_processing_button:checked { \n"
" border-image: url(images/processing_button_pressed.png)0; \n"
" } \n"
" \n"
// define style of stop button
"QPushButton#_skip_back_button { \n"
" border-image: url(images/skip_back_button.png) 0; \n"
" } \n"
" \n"
"QPushButton#_skip_back_button:pressed { \n"
" border-image: url(images/skip_back_button_pressed.png) 0; \n"
" } \n"
" \n"
// define style of pause button
"QPushButton#_pause_button { \n"
" border-image: url(images/pause_button.png)0; \n"
" } \n"
" \n"
"QPushButton#_pause_button:checked { \n"
" border-image: url(images/pause_button_pressed.png)0; \n"
" } \n"
" \n"
"QPushButton#_pause_button:pressed { \n"
" border-image: url(images/pause_button_pressed.png)0; \n"
" } \n"
" \n"
// define style of play button
"QPushButton#_play_button { \n"
" border-image: url(images/play_button.png)0; \n"
" } \n"
" \n"
"QPushButton#_play_button:checked { \n"
" border-image: url(images/play_button_pressed.png)0; \n"
" } \n"
" \n"
"QPushButton#_play_button:pressed { \n"
" border-image: url(images/play_button_pressed.png)0; \n"
" } \n"
" \n"
// define style of other labels
"QSceneButton { \n"
" border-image: url(images/scene_menu_item.png)0; \n"
" } \n"
" \n"
"QSceneButton:pressed { \n"
" border-image: url(images/scene_menu_item_selected.png)0; \n"
" } \n"
" \n"
"QSceneButton:checked { \n"
" border-image: url(images/scene_menu_item_selected.png)0; \n"
" } \n"
" \n"
"QVolumeSlider { \n"
" margin: 4px; \n"
" background-color: rgb(244, 244, 244); \n"
//" border-width: 1px; \n"
//" border-color: red; \n"
//" border-style: solid; \n"
" border-radius: 0; \n"
" } \n"
" \n"
"QTimeLine { \n"
" background-color: rgb(244, 244, 244); \n"
" } \n"
" \n"
"QCPULabel { \n"
" background-color: white; \n"
" } \n"
" \n"
" \n"
"QZoomLabel { \n"
" background-color: white; \n"
" } \n"
" \n"
"QFileMenuLabel { \n"
" background-color: white; \n"
" font: bold 11pt; \n"
//" border-width: 1px; \n"
//" border-color: red; \n"
//" border-style: solid; \n"
" border-radius: 0; \n"
" } \n"
" \n"
// define style of popup menu
"QMenu { \n"
" background-color: rgba(255, 255, 255, 92%); \n"
" border-width: 1px; \n"
" border-color: black; \n"
" border-style: solid; \n"
" border-radius: 0; \n"
" } \n"
" \n"
"QMenu::item:hover { \n"
" selection-background-color: rgba(208, 245, 247, 92%);\n"
" selection-color: black; \n"
" } \n"
"QSourceProperties { \n"
" background-color: rgba(255, 255, 255, 92%); \n"
" border-width: 1px; \n"
" border-color: black; \n"
" border-style: solid; \n"
" border-radius: 0; \n"
" } \n"
" \n"
"QLabel#item { \n"
" background-color: rgb(255, 255, 255); \n"
" color: black; \n"
" } \n"
" \n"
"QClicktextLabel#item:hover { \n"
" background-color: rgba(208, 245, 247, 92%); \n"
" color: red; \n"
" } \n"
" \n"
"QRadioButton { \n"
" background-color: rgb(255, 255, 255); \n"
" color: black; \n"
" } \n"
" \n"
"QCheckBox { \n"
" background-color: rgb(255, 255, 255); \n"
" color: black; \n"
" } \n"
" \n"
; // don't forget this semi-colon
/** ctor.
* @param controller this can be either the Controller or, if the IP interface
* is used, an IPClient.
* @param scene reference to the MasterScene or to a client-side copy of the
* Scene.
* @param argc number of command line arguments passed to the GUI.
* @param argv the arguments themselves.
**/
ssr::QGUI::QGUI(api::Publisher& controller, const LegacyScene& scene, int &argc, char *argv[]
, const std::string& path_to_gui_images
, const std::string& path_to_scene_menu) :
_qt_app(argc, argv), _gui(controller, scene
, path_to_gui_images, path_to_scene_menu)
{
// this is a quick hack to allow dynamic specification of path
QString url_to_gui_images = path_to_gui_images.c_str();
url_to_gui_images.replace(QString("\\"), "/"); // url needs all forward
qt_style_sheet.replace(QString("images"), url_to_gui_images);
// set stylesheet
_qt_app.setStyleSheet(qt_style_sheet);
}
ssr::QGUI::~QGUI()
{}
/**
* This function is used to verify if setting the sample buffer (enabling
* anti-aliasing) has succeeded.
* @return current QGLFormat
*/
QGLFormat ssr::QGUI::format() const
{
return _gui.format();
}
/**
* This function starts the GUI.
* @return application exit code
*/
int ssr::QGUI::run()
{
// TODO: check return values
_gui.show();
#ifdef __APPLE__
// bring window to front
_gui.raise();
_gui.activateWindow();
#endif
// TODO: check if _qt_app is valid
_qt_app.connect(&_qt_app, SIGNAL(lastWindowClosed()), &_qt_app, SLOT(quit()));
return _qt_app.exec();
}
|