RGBMatrixEditor::RGBMatrixEditor(QWidget* parent, RGBMatrix* mtx, Doc* doc) : QWidget(parent) , m_doc(doc) , m_matrix(mtx) , m_speedDials(NULL) , m_scene(new QGraphicsScene(this)) , m_previewTimer(new QTimer(this)) , m_previewIterator(0) , m_previewStep(0) { Q_ASSERT(doc != NULL); Q_ASSERT(mtx != NULL); setupUi(this); // Set a nice gradient backdrop m_scene->setBackgroundBrush(Qt::darkGray); QLinearGradient gradient(200, 200, 200, 2000); gradient.setSpread(QGradient::ReflectSpread); m_scene->setBackgroundBrush(gradient); connect(m_previewTimer, SIGNAL(timeout()), this, SLOT(slotPreviewTimeout())); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); connect(m_doc, SIGNAL(fixtureGroupAdded(quint32)), this, SLOT(slotFixtureGroupAdded())); connect(m_doc, SIGNAL(fixtureGroupRemoved(quint32)), this, SLOT(slotFixtureGroupRemoved())); connect(m_doc, SIGNAL(fixtureGroupChanged(quint32)), this, SLOT(slotFixtureGroupChanged(quint32))); init(); slotModeChanged(m_doc->mode()); // Set focus to the editor m_nameEdit->setFocus(); }
int FunctionManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break; case 1: slotFunctionRemoved((*reinterpret_cast< quint32(*)>(_a[1]))); break; case 2: slotTreeSelectionChanged(); break; case 3: slotTreeContextMenuRequested((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; case 4: slotBusTriggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 5: slotBusNameChanged((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 6: slotAddScene(); break; case 7: slotAddChaser(); break; case 8: slotAddCollection(); break; case 9: slotAddEFX(); break; case 10: slotWizard(); break; case 11: { int _r = slotEdit(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 12: slotClone(); break; case 13: slotDelete(); break; case 14: slotSelectAll(); break; default: ; } _id -= 15; } return _id; }
void App::initDoc() { Q_ASSERT(m_doc == NULL); m_doc = new Doc(this); connect(m_doc, SIGNAL(modified(bool)), this, SLOT(slotDocModified(bool))); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); /* Load user fixtures first so that they override system fixtures */ m_doc->fixtureDefCache()->load(QLCFixtureDefCache::userDefinitionDirectory()); m_doc->fixtureDefCache()->load(QLCFixtureDefCache::systemDefinitionDirectory()); /* Load plugins */ connect(m_doc->ioPluginCache(), SIGNAL(pluginLoaded(const QString&)), this, SLOT(slotSetProgressText(const QString&))); m_doc->ioPluginCache()->load(IOPluginCache::systemPluginDirectory()); /* Restore outputmap settings */ Q_ASSERT(m_doc->outputMap() != NULL); m_doc->outputMap()->loadDefaults(); /* Load input plugins & profiles */ Q_ASSERT(m_doc->inputMap() != NULL); m_doc->inputMap()->loadProfiles(InputMap::userProfileDirectory()); m_doc->inputMap()->loadProfiles(InputMap::systemProfileDirectory()); m_doc->inputMap()->loadDefaults(); m_doc->masterTimer()->start(); }
EFXEditor::EFXEditor(QWidget* parent, EFX* efx, Doc* doc) : QWidget(parent) , m_doc(doc) , m_efx(efx) , m_previewArea(NULL) , m_points(NULL) , m_speedDials(NULL) { Q_ASSERT(doc != NULL); Q_ASSERT(efx != NULL); setupUi(this); initGeneralPage(); initMovementPage(); // Used for intensity changes m_testTimer.setSingleShot(true); m_testTimer.setInterval(500); connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(slotRestartTest())); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); createSpeedDials(); // Set focus to the editor m_nameEdit->setFocus(); }
VCWidget::VCWidget(QWidget* parent) : QWidget(parent) { Q_ASSERT(parent != NULL); /* Set the class name "VCWidget" as the object name as well */ setObjectName(VCWidget::staticMetaObject.className()); setMinimumSize(QSize(20, 20)); m_hasCustomBackgroundColor = false; m_hasCustomForegroundColor = false; m_hasCustomFont = false; m_frameStyle = KVCFrameStyleNone; m_resizeMode = false; setBackgroundRole(QPalette::Window); setAutoFillBackground(true); setEnabled(true); m_inputUniverse = InputMap::invalidUniverse(); m_inputChannel = KInputChannelInvalid; connect(_app->doc(), SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); m_mode = Doc::Design; /* Listen to parent's (only VCWidget-kind) key signals */ if (parent->inherits(metaObject()->className()) == true) { connect(parent, SIGNAL(keyPressed(const QKeySequence&)), this, SLOT(slotKeyPressed(const QKeySequence&))); connect(parent, SIGNAL(keyReleased(const QKeySequence&)), this, SLOT(slotKeyReleased(const QKeySequence&))); }
VCClock::VCClock(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_clocktype(Clock) , m_scheduleIndex(-1) , m_hh(0) , m_mm(0) , m_ss(0) , m_targetTime(0) , m_currentTime(0) , m_isPaused(true) { /* Set the class name "VCClock" as the object name as well */ setObjectName(VCClock::staticMetaObject.className()); setType(VCWidget::LabelWidget); setCaption(""); resize(QSize(150, 50)); QFont font = qApp->font(); font.setBold(true); font.setPixelSize(28); setFont(font); connect(doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(slotUpdateTime())); timer->start(1000); }
VCSpeedDial::VCSpeedDial(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_speedTypes(VCSpeedDial::Duration) , m_dial(NULL) , m_absoluteValueMin(0) , m_absoluteValueMax(1000 * 10) { new QVBoxLayout(this); m_dial = new SpeedDial(this); layout()->addWidget(m_dial); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialValueChanged(int))); connect(m_dial, SIGNAL(tapped()), this, SLOT(slotDialTapped())); setType(VCWidget::SpeedDialWidget); setCaption(tr("Duration")); QSettings settings; QVariant var = settings.value(SETTINGS_SPEEDDIAL_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(VCSpeedDial::defaultSize); var = settings.value(SETTINGS_SPEEDDIAL_VALUE); if (var.isValid() == true) m_dial->setValue(var.toUInt()); slotModeChanged(doc->mode()); }
void VCFrame::init() { setMinimumSize(20, 20); resize(120, 120); setFrameStyle(QFrame::Panel | QFrame::Sunken); connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged())); }
void VCSlider::init() { setCaption(""); /* Main VBox */ m_vbox = new QVBoxLayout(this); m_vbox->setMargin(10); m_vbox->setSpacing(10); /* Top label */ m_topLabel = new QLabel(this); m_vbox->addWidget(m_topLabel); m_topLabel->setAlignment(AlignCenter); /* Slider & its HBox */ m_hbox = new QHBoxLayout(m_vbox); m_hbox->insertSpacing(-1, 10); m_slider = new QSlider(this); m_hbox->addWidget(m_slider); m_slider->setRange(KDefaultBusLowLimit * KFrequency, KDefaultBusHighLimit * KFrequency); m_slider->setPageStep(1); connect(m_slider, SIGNAL(sliderPressed()), this, SLOT(slotSliderPressed())); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderValueChanged(int))); connect(m_slider, SIGNAL(sliderReleased()), this, SLOT(slotSliderReleased())); m_hbox->insertSpacing(-1, 10); /* Tap button */ m_tapButton = new QPushButton(this); m_vbox->addWidget(m_tapButton); connect(m_tapButton, SIGNAL(clicked()), this, SLOT(slotTapButtonClicked())); m_time = new QTime(); /* Bottom label */ m_bottomLabel = new QLabel(this); m_vbox->addWidget(m_bottomLabel); m_bottomLabel->setAlignment(AlignCenter); m_bottomLabel->hide(); resize(QPoint(60, 220)); /* Initialize to bus mode by default */ setBus(KBusIDDefaultFade); setSliderMode(Bus); setSliderValue(0); slotSliderValueChanged(0); /* Update the slider according to current mode */ slotModeChanged(_app->mode()); }
// // Init something // void VCDockSlider::init() { m_valueLabel->setBackgroundOrigin(ParentOrigin); m_slider->setBackgroundOrigin(ParentOrigin); setCaption("No Name"); setMode(Speed); connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged())); }
void VCLabel::init() { setMinimumSize(20, 20); setText("Label"); setAlignment(WordBreak | AlignCenter); setFrameStyle(KFrameStyle); connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged())); }
FunctionManager::FunctionManager(QWidget* parent, Doc* doc) : QWidget(parent) , m_doc(doc) , m_hsplitter(NULL) , m_vsplitter(NULL) , m_tree(NULL) , m_toolbar(NULL) , m_addSceneAction(NULL) , m_addChaserAction(NULL) , m_addCollectionAction(NULL) , m_addEFXAction(NULL) , m_addRGBMatrixAction(NULL) , m_addScriptAction(NULL) , m_addAudioAction(NULL) , m_addVideoAction(NULL) , m_autostartAction(NULL) , m_wizardAction(NULL) , m_addFolderAction(NULL) , m_cloneAction(NULL) , m_deleteAction(NULL) , m_selectAllAction(NULL) , m_editor(NULL) , m_scene_editor(NULL) { Q_ASSERT(s_instance == NULL); s_instance = this; Q_ASSERT(doc != NULL); new QVBoxLayout(this); layout()->setContentsMargins(0, 0, 0, 0); layout()->setSpacing(0); initActions(); initToolbar(); initSplitterView(); updateActionStatus(); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged())); m_tree->updateTree(); connect(m_doc, SIGNAL(clearing()), this, SLOT(slotDocClearing())); connect(m_doc, SIGNAL(loaded()), this, SLOT(slotDocLoaded())); connect(m_doc, SIGNAL(functionNameChanged(quint32)), this, SLOT(slotFunctionNameChanged(quint32))); connect(m_doc, SIGNAL(functionAdded(quint32)), this, SLOT(slotFunctionAdded(quint32))); QSettings settings; QVariant var = settings.value(SETTINGS_SPLITTER); if (var.isValid() == true) m_hsplitter->restoreState(var.toByteArray()); else m_hsplitter->setSizes(QList <int> () << int(this->width() / 2) << int(this->width() / 2)); }
int VCXYPad::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = VCWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break; default: ; } _id -= 1; } return _id; }
// // Initialize this widget // void DeviceManagerView::initView() { // Create a vertical layout to this widget m_layout = new QVBoxLayout(this); // Init the title and icon initTitle(); // Set up toolbar initToolBar(); // Init the device view and text view initDataView(); // Connect to know when to enable/disable buttons connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged())); // Update view update(); // // Set widget proportions // QString x, y, w, h; _app->settings()->get(KEY_DEVICE_MANAGER_X, x); _app->settings()->get(KEY_DEVICE_MANAGER_Y, y); _app->settings()->get(KEY_DEVICE_MANAGER_W, w); _app->settings()->get(KEY_DEVICE_MANAGER_H, h); if (w == 0 || h == 0) { setGeometry(0, 0, 350, 200); } else { setGeometry(x.toInt(), y.toInt(), w.toInt(), h.toInt()); } // Check if DM should be open QString config; _app->settings()->get(KEY_DEVICE_MANAGER_OPEN, config); if (config == Settings::trueValue()) { _app->slotViewDeviceManager(); } else { hide(); _app->slotDeviceManagerViewClosed(); } }
void App::initDoc() { // Delete existing document object and create a new one if (m_doc != NULL) delete m_doc; m_doc = new Doc(this, m_outputMap, m_inputMap); connect(m_doc, SIGNAL(modified(bool)), this, SLOT(slotDocModified(bool))); connect(this, SIGNAL(modeChanged(App::Mode)), m_doc, SLOT(slotModeChanged(App::Mode))); emit documentChanged(m_doc); }
void App::initDoc() { Q_ASSERT(m_doc == NULL); m_doc = new Doc(this); connect(m_doc, SIGNAL(modified(bool)), this, SLOT(slotDocModified(bool))); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); /* Load user fixtures first so that they override system fixtures */ m_doc->fixtureDefCache()->load(QLCFixtureDefCache::userDefinitionDirectory()); m_doc->fixtureDefCache()->loadMap(QLCFixtureDefCache::systemDefinitionDirectory()); /* Load channel modifiers templates */ m_doc->modifiersCache()->load(QLCModifiersCache::systemTemplateDirectory(), true); m_doc->modifiersCache()->load(QLCModifiersCache::userTemplateDirectory()); /* Load RGB scripts */ m_doc->rgbScriptsCache()->load(RGBScriptsCache::systemScriptsDirectory()); m_doc->rgbScriptsCache()->load(RGBScriptsCache::userScriptsDirectory()); /* Load plugins */ #if defined(__APPLE__) || defined(Q_OS_MAC) connect(m_doc->ioPluginCache(), SIGNAL(pluginLoaded(const QString&)), this, SLOT(slotSetProgressText(const QString&))); #endif #if defined Q_OS_ANDROID QString pluginsPath = QString("%1/../lib").arg(QDir::currentPath()); m_doc->ioPluginCache()->load(QDir(pluginsPath)); #else m_doc->ioPluginCache()->load(IOPluginCache::systemPluginDirectory()); #endif /* Load audio decoder plugins * This doesn't use a AudioPluginCache::systemPluginDirectory() cause * otherwise the qlcconfig.h creation should have been moved into the * audio folder, which doesn't make much sense */ m_doc->audioPluginCache()->load(QLCFile::systemDirectory(AUDIOPLUGINDIR, KExtPlugin)); /* Restore outputmap settings */ Q_ASSERT(m_doc->inputOutputMap() != NULL); /* Load input plugins & profiles */ m_doc->inputOutputMap()->loadProfiles(InputOutputMap::userProfileDirectory()); m_doc->inputOutputMap()->loadProfiles(InputOutputMap::systemProfileDirectory()); m_doc->inputOutputMap()->loadDefaults(); m_doc->masterTimer()->start(); }
void VCButton::init() { setToggleButton(true); assert(m_keyBind == NULL); m_keyBind = new KeyBind(); connect(m_keyBind, SIGNAL(pressed()), this, SLOT(pressFunction())); connect(m_keyBind, SIGNAL(released()), this, SLOT(releaseFunction())); QToolTip::add(this, "No function"); setMinimumSize(20, 20); resize(30, 30); connect(_app, SIGNAL(modeChanged()), this, SLOT(slotModeChanged())); }
void DeviceManagerView::initView() { setCaption(QString("Device Manager")); resize(300, 200); QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; setIcon(dir + QString("/device.xpm")); m_layout = new QVBoxLayout(this); m_dockArea = new QDockArea(Horizontal, QDockArea::Normal, this); m_dockArea->setFixedHeight(30); m_toolbar = new QToolBar("Device Manager", _app, m_dockArea); m_dm = new DeviceManager(this); m_addOutputDeviceButton = new QToolButton(QIconSet(QPixmap(dir + "/addoutputdevice.xpm")), "Add New Output Device", 0, m_dm, SLOT(slotDLAddOutputDevice()), m_toolbar); m_addBusButton = new QToolButton(QIconSet(QPixmap(dir + "/addbus.xpm")), "Add New Bus", 0, m_dm, SLOT(slotDLAddBus()), m_toolbar); m_removeButton = new QToolButton(QIconSet(QPixmap(dir + "/remove.xpm")), "Remove Current Selection", 0, m_dm, SLOT(slotDLRemove()), m_toolbar); m_toolbar->addSeparator(); m_propertiesButton = new QToolButton(QIconSet(QPixmap(dir + "/settings.xpm")), "Properties", 0, m_dm, SLOT(slotDLViewProperties()), m_toolbar); m_toolbar->addSeparator(); m_monitorButton = new QToolButton(QIconSet(QPixmap(dir + "/monitor.xpm")), "Monitor Device", 0, m_dm, SLOT(slotDLViewMonitor()), m_toolbar); m_consoleButton = new QToolButton(QIconSet(QPixmap(dir + "/console.xpm")), "View Console", 0, m_dm, SLOT(slotDLViewConsole()), m_toolbar); m_layout->addWidget(m_dockArea); m_layout->addWidget(m_dm); connect(_app->virtualConsole(), SIGNAL(modeChange(VirtualConsole::Mode)), this, SLOT(slotModeChanged(VirtualConsole::Mode))); connect(m_dm, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged())); slotSelectionChanged(); }
VCWidget::VCWidget(QWidget* parent, Doc* doc) : QWidget(parent) , m_doc(doc) , m_id(invalidId()) , m_disableState(false) , m_page(0) , m_allowChildren(false) , m_allowResize(true) , m_intensity(1.0) , m_liveEdit(VirtualConsole::instance()->liveEdit()) { Q_ASSERT(parent != NULL); Q_ASSERT(doc != NULL); /* Set the class name "VCWidget" as the object name as well */ setObjectName(VCWidget::staticMetaObject.className()); setMinimumSize(QSize(20, 20)); m_type = UnknownWidget; m_hasCustomBackgroundColor = false; m_hasCustomForegroundColor = false; m_backgroundImage = QString(); m_hasCustomFont = false; m_frameStyle = KVCFrameStyleNone; m_resizeMode = false; setBackgroundRole(QPalette::Window); setAutoFillBackground(true); setEnabled(true); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); /* Listen to parent's (only VCWidget-kind) key signals */ if (parent->inherits(metaObject()->className()) == true) { connect(parent, SIGNAL(keyPressed(const QKeySequence&)), this, SLOT(slotKeyPressed(const QKeySequence&))); connect(parent, SIGNAL(keyReleased(const QKeySequence&)), this, SLOT(slotKeyReleased(const QKeySequence&))); }
VCWidget::VCWidget(QWidget* parent, const char* name) : QFrame(parent, name) { m_backgroundImage = QString::null; m_hasCustomBackgroundColor = false; m_hasCustomForegroundColor = false; m_hasCustomFont = false; m_xpos = 0; m_ypos = 0; m_resizeMode = false; connect(_app, SIGNAL(modeChanged(App::Mode)), this, SLOT(slotModeChanged(App::Mode))); setCaption("Widget"); setFrameStyle(KVCWidgetFrameStyleSunken); setMinimumSize(20, 20); resize(QPoint(120, 120)); }
SslServerConnection::SslServerConnection(quint16 socketDescriptor, QObject *parent) : QThread(parent), blockSize (0) { // Set the new internal id internalId++; // Init the ssl socket this->socket = new QSslSocket(this); this->socket->setProtocol(QSsl::AnyProtocol); this->socket->setSocketDescriptor(socketDescriptor); // Now bind some signal of the ssl socket QObject::connect(socket, SIGNAL(connected()), SLOT(slotAcceptedClient())); QObject::connect(socket, SIGNAL(disconnected()), SLOT(slotConnectionClosed())); QObject::connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); QObject::connect(socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(slotModeChanged(QSslSocket::SslMode))); QObject::connect(socket, SIGNAL(readyRead()), SLOT(slotStartRead())); QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotError(QAbstractSocket::SocketError))); // Set the certificate and the key if (!SslKeyContent::instance()->keyIsValid()) { // Without a valid key, disconnect Debug::error(QLatin1String("No valid key")); socket->disconnectFromHost(); } else { // Key is valid QSslKey key(SslKeyContent::instance()->getKey(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, "server"); // If key is null disconnect and close the socket if (key.isNull()) { Debug::error(QLatin1String("Key is null")); socket->disconnectFromHost(); // Close the socket socket->close(); } else { if (socket->addCaCertificates(QCoreApplication::applicationDirPath() + QLatin1Char('/') + CACERTIFICATES_FILE)) { socket->setLocalCertificate(QCoreApplication::applicationDirPath() + QLatin1Char('/') + LOCALCERTIFICATE_FILE); socket->setPrivateKey(key); socket->startServerEncryption(); } } } }
int VCSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = VCWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break; case 1: slotBusValueChanged((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< quint32(*)>(_a[2]))); break; case 2: slotBusNameChanged((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 3: slotFixtureRemoved((*reinterpret_cast< t_fixture_id(*)>(_a[1]))); break; case 4: slotSliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: slotTapButtonClicked(); break; case 6: slotInputValueChanged((*reinterpret_cast< quint32(*)>(_a[1])),(*reinterpret_cast< quint32(*)>(_a[2])),(*reinterpret_cast< uchar(*)>(_a[3]))); break; default: ; } _id -= 7; } return _id; }
EFXEditor::EFXEditor(QWidget* parent, EFX* efx, Doc* doc) : QWidget(parent) , m_doc(doc) , m_efx(efx) , m_previewArea(NULL) , m_points(NULL) , m_speedDials(NULL) { Q_ASSERT(doc != NULL); Q_ASSERT(efx != NULL); setupUi(this); connect(m_speedDial, SIGNAL(toggled(bool)), this, SLOT(slotSpeedDialToggle(bool))); initGeneralPage(); initMovementPage(); // Start new (==empty) scenes from the first tab and ones with something in them // on the first fixture page. if (m_tab->count() == 0) slotTabChanged(KTabGeneral); else m_tab->setCurrentIndex(efxUiState()->currentTab()); /* Tab widget */ connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(slotTabChanged(int))); // Used for UI parameter changes m_testTimer.setSingleShot(true); m_testTimer.setInterval(500); connect(&m_testTimer, SIGNAL(timeout()), this, SLOT(slotRestartTest())); connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); updateSpeedDials(); // Set focus to the editor m_nameEdit->setFocus(); }
int SslServerConnection::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QThread::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: connectionIsClosed(); break; case 1: slotAcceptedClient(); break; case 2: slotStartRead(); break; case 3: slotConnectionClosed(); break; case 4: slotError((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break; case 5: slotModeChanged((*reinterpret_cast< QSslSocket::SslMode(*)>(_a[1]))); break; case 6: removeItemFromList((*reinterpret_cast< int(*)>(_a[1]))); break; case 7: recDig((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 8; } return _id; }
int FixtureManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotFixtureAdded((*reinterpret_cast< quint32(*)>(_a[1]))); break; case 1: slotFixtureRemoved((*reinterpret_cast< quint32(*)>(_a[1]))); break; case 2: slotModeChanged((*reinterpret_cast< Doc::Mode(*)>(_a[1]))); break; case 3: slotSelectionChanged(); break; case 4: slotDoubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; case 5: slotAdd(); break; case 6: slotRemove(); break; case 7: slotProperties(); break; case 8: slotContextMenuRequested((*reinterpret_cast< const QPoint(*)>(_a[1]))); break; default: ; } _id -= 9; } return _id; }
FixtureManager::FixtureManager(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags) { new QVBoxLayout(this); m_console = NULL; initActions(); initToolBar(); initDataView(); updateView(); /* To disable some actions when switching to operate mode */ connect(_app, SIGNAL(modeChanged(App::Mode)), this, SLOT(slotModeChanged(App::Mode))); /* Listen to document changes */ connect(_app, SIGNAL(documentChanged(Doc*)), this, SLOT(slotDocumentChanged(Doc*))); /* Listen to fixture additions/removals */ slotDocumentChanged(_app->doc()); }
VCSlider::VCSlider(QWidget* parent, Doc* doc) : VCWidget(parent, doc) { /* Set the class name "VCSlider" as the object name as well */ setObjectName(VCSlider::staticMetaObject.className()); m_hbox = NULL; m_topLabel = NULL; m_slider = NULL; m_bottomLabel = NULL; m_valueDisplayStyle = ExactValue; m_levelLowLimit = 0; m_levelHighLimit = UCHAR_MAX; m_levelValue = 0; m_levelValueChanged = false; m_monitorEnabled = false; m_monitorValue = 0; m_playbackFunction = Function::invalidId(); m_playbackValue = 0; m_playbackValueChanged = false; m_widgetMode = WSlider; setType(VCWidget::SliderWidget); setCaption(QString()); setFrameStyle(KVCFrameStyleSunken); /* Main VBox */ new QVBoxLayout(this); /* Top label */ m_topLabel = new QLabel(this); m_topLabel->setAlignment(Qt::AlignHCenter); layout()->addWidget(m_topLabel); /* Slider's HBox |stretch|slider|stretch| */ m_hbox = new QHBoxLayout(); /* Put stretchable space before the slider (to its left side) */ m_hbox->addStretch(); /* The slider */ m_slider = new ClickAndGoSlider(this); m_hbox->addWidget(m_slider); m_slider->setRange(0, 255); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); m_slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_slider->setMinimumWidth(32); m_slider->setMaximumWidth(80); m_slider->setStyleSheet(CNG_DEFAULT_STYLE); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); m_externalMovement = false; /* Put stretchable space after the slider (to its right side) */ m_hbox->addStretch(); layout()->addItem(m_hbox); /* Click & Go button */ m_cngType = ClickAndGoWidget::None; m_cngButton = new QToolButton(this); m_cngButton->setFixedSize(48, 48); m_cngButton->setIconSize(QSize(42, 42)); m_menu = new QMenu(this); QWidgetAction* action = new QWidgetAction(this); m_cngWidget = new ClickAndGoWidget(); action->setDefaultWidget(m_cngWidget); m_menu->addAction(action); m_cngButton->setMenu(m_menu); m_cngButton->setPopupMode(QToolButton::InstantPopup); layout()->addWidget(m_cngButton); layout()->setAlignment(m_cngButton, Qt::AlignHCenter); m_cngButton->hide(); connect(m_cngWidget, SIGNAL(levelChanged(uchar)), this, SLOT(slotClickAndGoLevelChanged(uchar))); connect(m_cngWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotClickAndGoColorChanged(QRgb))); connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)), this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage))); connect(this, SIGNAL(monitorDMXValueChanged(int)), this, SLOT(slotMonitorDMXValueChanged(int))); /* Bottom label */ m_bottomLabel = new QLabel(this); layout()->addWidget(m_bottomLabel); m_bottomLabel->setAlignment(Qt::AlignCenter); m_bottomLabel->setWordWrap(true); m_bottomLabel->hide(); setMinimumSize(20, 20); QSettings settings; QVariant var = settings.value(SETTINGS_SLIDER_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(VCSlider::defaultSize); /* Initialize to playback mode by default */ setInvertedAppearance(false); m_sliderMode = SliderMode(-1); // avoid use of uninitialized value setSliderMode(Playback); /* Update the slider according to current mode */ slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); /* Listen to fixture removals so that LevelChannels can be removed when they no longer point to an existing fixture->channel */ connect(m_doc, SIGNAL(fixtureRemoved(quint32)), this, SLOT(slotFixtureRemoved(quint32))); }
VCMatrix::VCMatrix(QWidget *parent, Doc *doc) : VCWidget(parent, doc) , m_matrixID(Function::invalidId()) , m_instantApply(true) { /* Set the class name "VCLabel" as the object name as well */ setObjectName(VCMatrix::staticMetaObject.className()); setFrameStyle(KVCFrameStyleSunken); QHBoxLayout *hBox = new QHBoxLayout(this); //hBox->setContentsMargins(3, 3, 3, 10); //hBox->setSpacing(5); m_slider = new ClickAndGoSlider(); m_slider->setStyleSheet(CNG_DEFAULT_STYLE); m_slider->setFixedWidth(32); m_slider->setRange(0, 255); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); hBox->addWidget(m_slider); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); QVBoxLayout *vbox = new QVBoxLayout(this); m_startColorButton = new QToolButton(this); m_startColorButton->setFixedSize(48, 48); m_startColorButton->setIconSize(QSize(42, 42)); QWidgetAction* scAction = new QWidgetAction(this); m_scCnGWidget = new ClickAndGoWidget(); m_scCnGWidget->setType(ClickAndGoWidget::RGB, NULL); scAction->setDefaultWidget(m_scCnGWidget); QMenu *startColorMenu = new QMenu(); startColorMenu->addAction(scAction); m_startColorButton->setMenu(startColorMenu); m_startColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_scCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotStartColorChanged(QRgb))); m_endColorButton = new QToolButton(this); m_endColorButton->setFixedSize(48, 48); m_endColorButton->setIconSize(QSize(42, 42)); QWidgetAction* ecAction = new QWidgetAction(this); m_ecCnGWidget = new ClickAndGoWidget(); m_ecCnGWidget->setType(ClickAndGoWidget::RGB, NULL); ecAction->setDefaultWidget(m_ecCnGWidget); QMenu *endColorMenu = new QMenu(); endColorMenu->addAction(ecAction); m_endColorButton->setMenu(endColorMenu); m_endColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_ecCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotEndColorChanged(QRgb))); m_label = new QLabel(this); m_label->setAlignment(Qt::AlignCenter); m_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); vbox->addWidget(m_label); QHBoxLayout *btnHbox = new QHBoxLayout(this); btnHbox->addWidget(m_startColorButton); btnHbox->addWidget(m_endColorButton); vbox->addLayout(btnHbox); m_presetCombo = new QComboBox(this); //m_presetCombo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_presetCombo->addItems(doc->rgbScriptsCache()->names()); connect(m_presetCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotAnimationChanged(QString))); vbox->addWidget(m_presetCombo); hBox->addLayout(vbox); m_controlsLayout = new FlowLayout(); vbox->addLayout(m_controlsLayout); setType(VCWidget::AnimationWidget); setCaption(QString()); /* Initial size */ QSettings settings; QVariant var = settings.value(SETTINGS_RGBMATRIX_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(defaultSize); /* Update the slider according to current mode */ slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); }
VCAudioTriggers::VCAudioTriggers(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_hbox(NULL) , m_button(NULL) , m_label(NULL) , m_spectrum(NULL) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) , m_volumeSlider(NULL) #endif , m_inputCapture(NULL) { /* Set the class name "VCAudioTriggers" as the object name as well */ setObjectName(VCAudioTriggers::staticMetaObject.className()); setType(VCWidget::AudioTriggersWidget); setFrameStyle(KVCFrameStyleSunken); new QVBoxLayout(this); /* Main HBox */ m_hbox = new QHBoxLayout(); m_hbox->setGeometry(QRect(0, 0, 300, 40)); layout()->setSpacing(2); layout()->setContentsMargins(4, 4, 4, 4); layout()->addItem(m_hbox); m_button = new QToolButton(this); m_button->setStyle(AppUtil::saneStyle()); m_button->setIconSize(QSize(32, 32)); m_button->setMinimumSize(QSize(32, 32)); m_button->setMaximumSize(QSize(32, 32)); m_button->setIcon(QIcon(":/check.png")); m_button->setCheckable(true); QString btnSS = "QToolButton { background-color: #E0DFDF; border: 1px solid gray; border-radius: 3px; padding: 3px; } "; btnSS += "QToolButton:checked { background-color: #D7DE75; border: 1px solid gray; border-radius: 3px; padding: 3px; } "; m_button->setStyleSheet(btnSS); m_button->setEnabled(false); m_hbox->addWidget(m_button); connect(m_button, SIGNAL(toggled(bool)), this, SLOT(slotEnableButtonToggled(bool))); m_label = new QLabel(this); m_label->setText(this->caption()); QString txtColor = "white"; if (m_hasCustomForegroundColor) txtColor = this->foregroundColor().name(); m_label->setStyleSheet("QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #345D27, stop: 1 #0E1A0A); " "color: " + txtColor + "; border-radius: 3px; padding: 3px; margin-left: 2px; }"); if (m_hasCustomFont) m_label->setFont(font()); else { QFont m_font = QApplication::font(); m_font.setBold(true); m_font.setPixelSize(12); m_label->setFont(m_font); } m_hbox->addWidget(m_label); QSharedPointer<AudioCapture> capture(m_doc->audioInputCapture()); m_inputCapture = capture.data(); // create the AudioBar items to hold the spectrum data. // To be loaded from the project m_volumeBar = new AudioBar(AudioBar::None, 0); for (int i = 0; i < m_inputCapture->defaultBarsNumber(); i++) { AudioBar *asb = new AudioBar(AudioBar::None, 0); m_spectrumBars.append(asb); } #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QHBoxLayout *hbox2 = new QHBoxLayout(); m_volumeSlider = new ClickAndGoSlider(this); m_volumeSlider->setOrientation(Qt::Vertical); m_volumeSlider->setRange(0, 100); m_volumeSlider->setSliderStyleSheet(CNG_DEFAULT_STYLE); m_volumeSlider->setValue(100); m_volumeSlider->setFixedWidth(32); m_volumeSlider->setEnabled(false); connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotVolumeChanged(int))); #endif m_spectrum = new AudioTriggerWidget(this); m_spectrum->setBarsNumber(m_inputCapture->defaultBarsNumber()); m_spectrum->setMaxFrequency(AudioCapture::maxFrequency()); m_spectrum->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) layout()->addWidget(m_spectrum); #else layout()->addItem(hbox2); hbox2->addWidget(m_spectrum); hbox2->addWidget(m_volumeSlider); #endif /* Initial size */ QSettings settings; QVariant var = settings.value(SETTINGS_AUDIOTRIGGERS_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(defaultSize); slotModeChanged(m_doc->mode()); }
void InputManager::slotDocumentChanged(Doc* doc) { connect(doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); updateTree(); }