bool WebSettings::canJavaScriptOpenWindowsAutomatically() const { return d->isGlobal() ? d->m_webCoreSettingsState->canJavaScriptOpenWindowsAutomatically : getSettings(d->m_page)->javaScriptCanOpenWindowsAutomatically(); }
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) { p_vlm = vlm_New( p_intf ); if( !p_vlm ) { msg_Warn( p_intf, "Couldn't build VLM object "); return; } vlmWrapper = new VLMWrapper( p_vlm ); // UI stuff ui.setupUi( this ); ui.saveButton->hide(); #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) ); ADDMEDIATYPES( N_("Broadcast"), QVLM_Broadcast ); ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule ); ADDMEDIATYPES( N_("Video On Demand ( VOD )"), QVLM_VOD ); #undef ADDMEDIATYPES /* Schedule Stuffs */ QGridLayout *schetimelayout = new QGridLayout( ui.schedBox ); QLabel *schetimelabel = new QLabel( qtr( "Hours / Minutes / Seconds:" ) ); schetimelayout->addWidget( schetimelabel, 0, 0 ); QLabel *schedatelabel = new QLabel( qtr( "Day / Month / Year:" ) ); schetimelayout->addWidget( schedatelabel, 1, 0 ); QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) ); schetimelayout->addWidget( scherepeatLabel, 2, 0 ); QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) ); schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 ); time = new QDateTimeEdit( QTime::currentTime() ); time->setAlignment( Qt::AlignRight ); time->setDisplayFormat( "hh:mm:ss" ); schetimelayout->addWidget( time, 0, 1, 1, 3 ); date = new QDateTimeEdit( QDate::currentDate() ); date->setAlignment( Qt::AlignRight ); date->setCalendarPopup( true ); #ifdef _WIN32 date->setDisplayFormat( "dd MM yyyy" ); #else date->setDisplayFormat( "dd MMMM yyyy" ); #endif schetimelayout->addWidget( date, 1, 1, 1, 3 ); scherepeatnumber = new QSpinBox; scherepeatnumber->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 ); repeatDays = new QSpinBox; repeatDays->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 ); repeatDays->setSuffix( qtr(" days") ); repeatTime = new QDateTimeEdit; repeatTime->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 ); repeatTime->setDisplayFormat( "hh:mm:ss" ); /* scrollArea */ ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame ); ui.vlmItemScroll->setWidgetResizable( true ); vlmItemWidget = new QWidget; vlmItemLayout = new QVBoxLayout( vlmItemWidget ); vlmItemWidget->setLayout( vlmItemLayout ); ui.vlmItemScroll->setWidget( vlmItemWidget ); QSpacerItem *spacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); vlmItemLayout->addItem( spacer ); QPushButton *importButton = new QPushButton( qtr( "I&mport" ) ); ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole ); QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) ); ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole ); QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); ui.buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole ); showScheduleWidget( QVLM_Broadcast ); /* Connect the comboBox to show the right Widgets */ CONNECT( ui.mediaType, currentIndexChanged( int ), this, showScheduleWidget( int ) ); /* Connect the leftList to show the good VLMItem */ CONNECT( ui.vlmListItem, currentRowChanged( int ), this, selectVLMItem( int ) ); BUTTONACT( closeButton, close() ); BUTTONACT( exportButton, exportVLMConf() ); BUTTONACT( importButton, importVLMConf() ); BUTTONACT( ui.addButton, addVLMItem() ); BUTTONACT( ui.clearButton, clearWidgets() ); BUTTONACT( ui.saveButton, saveModifications() ); BUTTONACT( ui.inputButton, selectInput() ); BUTTONACT( ui.outputButton, selectOutput() ); if( !restoreGeometry( getSettings()->value("VLM/geometry").toByteArray() ) ) { resize( QSize( 700, 500 ) ); } }
FileOpenPanel::~FileOpenPanel() { if( dialogBox ) getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); }
void ToolbarEditDialog::close() { bool isChecked = getSettings()->value( "MainWindow/ToolbarPos" ).toBool(); QString c1 = getSettings()->value( "MainWindow/MainToolbar1" ).toString(); QString c2 = getSettings()->value( "MainWindow/MainToolbar2" ).toString(); QString cA = getSettings()->value( "MainWindow/AdvToolbar" ).toString(); QString c = getSettings()->value( "MainWindow/InputToolbar" ).toString(); QString cFSC = getSettings()->value( "MainWindow/FSCToolbar" ).toString(); if ( isChecked == positionCheckbox->isChecked() && c1 == controller1->getValue() && c2 == controller2->getValue() && cA == controllerA->getValue() && c == controller->getValue() && cFSC == controllerFSC->getValue() ) { reject(); return; } getSettings()->setValue( "MainWindow/ToolbarPos", !!positionCheckbox->isChecked() ); getSettings()->setValue( "MainWindow/MainToolbar1", controller1->getValue() ); getSettings()->setValue( "MainWindow/MainToolbar2", controller2->getValue() ); getSettings()->setValue( "MainWindow/AdvToolbar", controllerA->getValue() ); getSettings()->setValue( "MainWindow/InputToolbar", controller->getValue() ); getSettings()->setValue( "MainWindow/FSCtoolbar", controllerFSC->getValue() ); getSettings()->sync(); accept(); }
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) { /* Variables initialisation */ // need_components_update = false; bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; #ifndef HAVE_MAEMO sysTray = NULL; #endif videoIsActive = false; playlistVisible = false; input_name = ""; fullscreenControls = NULL; cryptedLabel = NULL; controls = NULL; inputC = NULL; b_shouldHide = false; bgWasVisible = false; i_bg_height = 0; /* Ask for privacy */ askForPrivacy(); /** * Configuration and settings * Pre-building of interface **/ /* Main settings */ setFocusPolicy( Qt::StrongFocus ); setAcceptDrops( true ); setWindowRole( "vlc-main" ); setWindowIcon( QApplication::windowIcon() ); setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) ); /* Set The Video In emebedded Mode or not */ videoEmbeddedFlag = config_GetInt( p_intf, "embedded-video" ); /* Does the interface resize to video size or the opposite */ b_keep_size = !config_GetInt( p_intf, "qt-video-autoresize" ); /* Are we in the enhanced always-video mode or not ? */ i_visualmode = config_GetInt( p_intf, "qt-display-mode" ); /* Do we want anoying popups or not */ notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" ); /* Set the other interface settings */ settings = getSettings(); settings->beginGroup( "MainWindow" ); /** * Retrieve saved sizes for main window * mainBasedSize = based window size for normal mode * (no video, no background) * mainVideoSize = window size with video (all modes) **/ mainBasedSize = settings->value( "mainBasedSize", QSize( 350, 120 ) ).toSize(); mainVideoSize = settings->value( "mainVideoSize", QSize( 400, 300 ) ).toSize(); /************** * Status Bar * **************/ createStatusBar(); /************************** * UI and Widgets design **************************/ setVLCWindowsTitle(); createMainWidget( settings ); /************ * Menu Bar * ************/ QVLCMenu::createMenuBar( this, p_intf ); CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, destroyPopupMenu() ); #if 0 /* Create a Dock to get the playlist */ dockPL = new QDockWidget( qtr( "Playlist" ), this ); dockPL->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); dockPL->setFeatures( QDockWidget::AllDockWidgetFeatures ); dockPL->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea ); dockPL->hide(); #endif /********************************* * Create the Systray Management * *********************************/ initSystray(); /******************** * Input Manager * ********************/ MainInputManager::getInstance( p_intf ); /************************************************************ * Connect the input manager to the GUI elements it manages * ************************************************************/ /** * Connects on nameChanged() * Those connects are different because options can impeach them to trigger. **/ /* Main Interface statusbar */ CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setName( const QString& ) ); /* and systray */ #ifndef HAVE_MAEMO if( sysTray ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, updateSystrayTooltipName( const QString& ) ); } #endif /* and title of the Main Interface*/ if( config_GetInt( p_intf, "qt-name-in-title" ) ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setVLCWindowsTitle( const QString& ) ); }
void TimeLabel::toggleTimeDisplay() { b_remainingTime = !b_remainingTime; getSettings()->setValue( "MainWindow/ShowRemainingTime", b_remainingTime ); }
void StandardPLPanel::showView( int i_view ) { bool b_treeViewCreated = false; switch( i_view ) { case ICON_VIEW: { if( iconView == NULL ) createIconView(); currentView = iconView; break; } case LIST_VIEW: { if( listView == NULL ) createListView(); currentView = listView; break; } case PICTUREFLOW_VIEW: { if( picFlowView == NULL ) createCoverView(); currentView = picFlowView; break; } default: case TREE_VIEW: { if( treeView == NULL ) { createTreeView(); b_treeViewCreated = true; } currentView = treeView; break; } } changeModel( false ); /* Restoring the header Columns must come after changeModel */ if( b_treeViewCreated ) { assert( treeView ); if( getSettings()->contains( "Playlist/headerStateV2" ) ) { treeView->header()->restoreState(getSettings() ->value( "Playlist/headerStateV2" ).toByteArray() ); /* if there is allready stuff in playlist, we don't sort it and we reset sorting */ if( model->rowCount() ) { treeView->header()->setSortIndicator( -1 , Qt::AscendingOrder ); } } else { for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ ) { treeView->setColumnHidden( c, !( m & COLUMN_DEFAULT ) ); if( m == COLUMN_TITLE ) treeView->header()->resizeSection( c, 200 ); else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 ); } } } viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); }
static void *Thread( void *obj ) { intf_thread_t *p_intf = (intf_thread_t *)obj; MainInterface *p_mi; char vlc_name[] = "vlc"; /* for WM_CLASS */ #ifdef QT5_HAS_X11 char platform_parm[] = "-platform"; char platform_value[] = "xcb"; #endif char *argv[] = { vlc_name, #ifdef QT5_HAS_X11 platform_parm, platform_value, #endif NULL, }; int argc = sizeof(argv) / sizeof(argv[0]) - 1; Q_INIT_RESOURCE( vlc ); /* Start the QApplication here */ QVLCApp app( argc, argv ); p_intf->p_sys->p_app = &app; /* All the settings are in the .conf/.ini style */ #ifdef _WIN32 char *cConfigDir = config_GetUserDir( VLC_CONFIG_DIR ); QString configDir = cConfigDir; free( cConfigDir ); if( configDir.endsWith( "\\vlc" ) ) configDir.chop( 4 ); /* the "\vlc" dir is added again by QSettings */ QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configDir ); #endif p_intf->p_sys->mainSettings = new QSettings( #ifdef _WIN32 QSettings::IniFormat, #else QSettings::NativeFormat, #endif QSettings::UserScope, "vlc", "vlc-qt-interface" ); /* Icon setting, Mac uses icon from .icns */ #ifndef Q_OS_MAC if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) app.setWindowIcon( QIcon::fromTheme( "vlc-xmas", QIcon( ":/logo/vlc128-xmas.png" ) ) ); else app.setWindowIcon( QIcon::fromTheme( "vlc", QIcon( ":/logo/vlc256.png" ) ) ); #endif /* Initialize the Dialog Provider and the Main Input Manager */ DialogsProvider::getInstance( p_intf ); MainInputManager *mim = MainInputManager::getInstance( p_intf ); /* initialize p_input (an input can already be running) */ input_thread_t *p_input = playlist_CurrentInput( THEPL ); if( p_input ) mim->getIM()->inputChangedHandler(); #ifdef UPDATE_CHECK /* Checking for VLC updates */ if( var_InheritBool( p_intf, "qt-updates-notif" ) && !var_InheritBool( p_intf, "qt-privacy-ask" ) ) { int interval = var_InheritInteger( p_intf, "qt-updates-days" ); if( QDate::currentDate() > getSettings()->value( "updatedate" ).toDate().addDays( interval ) ) { /* The constructor of the update Dialog will do the 1st request */ UpdateDialog::getInstance( p_intf ); getSettings()->setValue( "updatedate", QDate::currentDate() ); } } #endif /* Create the normal interface in non-DP mode */ if( !p_intf->p_sys->b_isDialogProvider ) { p_mi = new MainInterface( p_intf ); p_intf->p_sys->p_mi = p_mi; } else p_mi = NULL; /* Explain how to show a dialog :D */ p_intf->pf_show_dialog = ShowDialog; /* Check window type from the Qt platform back-end */ p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_INVALID; #if HAS_QT5 || defined (Q_WS_QPA) QString platform = app.platformName(); if( platform == qfu("xcb") ) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID; else if( platform == qfu("windows") ) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND; else if( platform == qfu("cocoa" ) ) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT; else msg_Err( p_intf, "unknown Qt platform: %s", qtu(platform) ); #elif defined (Q_WS_X11) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_XID; #elif defined (Q_WS_WIN) || defined (Q_WS_PM) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND; #elif defined (Q_WS_MAC) p_intf->p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT; #endif /* Tell the main LibVLC thread we are ready */ vlc_sem_post (&ready); #ifdef Q_OS_MAC /* We took over main thread, register and start here */ if( !p_intf->p_sys->b_isDialogProvider ) { RegisterIntf( p_intf ); playlist_Play( THEPL ); } #endif /* Last settings */ app.setQuitOnLastWindowClosed( false ); /* Retrieve last known path used in file browsing */ p_intf->p_sys->filepath = getSettings()->value( "filedialog-path", QVLCUserDir( VLC_HOME_DIR ) ).toString(); /* Loads and tries to apply the preferred QStyle */ QString s_style = getSettings()->value( "MainWindow/QtStyle", "" ).toString(); if( s_style.compare("") != 0 ) QApplication::setStyle( s_style ); /* Launch */ app.exec(); msg_Dbg( p_intf, "QApp exec() finished" ); if (p_mi != NULL) { QMutexLocker locker (&lock); active = false; p_intf->p_sys->p_mi = NULL; /* Destroy first the main interface because it is connected to some slots in the MainInputManager */ delete p_mi; } /* */ ExtensionsManager::killInstance(); AddonsManager::killInstance(); /* Destroy all remaining windows, because some are connected to some slots in the MainInputManager Settings must be destroyed after that. */ DialogsProvider::killInstance(); /* Delete the recentsMRL object before the configuration */ RecentsMRL::killInstance(); /* Save the path or delete if recent play are disabled */ if( var_InheritBool( p_intf, "qt-recentplay" ) ) getSettings()->setValue( "filedialog-path", p_intf->p_sys->filepath ); else getSettings()->remove( "filedialog-path" ); /* */ delete p_intf->p_sys->pl_model; /* Delete the configuration. Application has to be deleted after that. */ delete p_intf->p_sys->mainSettings; /* Destroy the MainInputManager */ MainInputManager::killInstance(); /* Delete the application automatically */ return NULL; }
/* * Called from game/g_main.c/G_InitGame(). * Initializes the variables and the bots for the game. */ void qv_initEnvironment(void) { int i; int roundNum; char **botNames = malloc(sizeof(char*) * getSettings()->bots); char *botName; /* Check if testmode is on, if so go to testEnvironment */ if (getSettings()->testmode) { initTestEnvironment(); return; } roundNum = readRoundNum(); switch (roundNum) { case 0: /* Com_Printf("\n\n^4 <-------> INITIALIZING QV ENVIRONMENT <------->\n"); */ /* * during initial round (0), completely random bots must be generated * and added to bot database so genetic algorithm can start properly * (bots generated here cannot yet be loaded ingame so round 0 just * serves as setup) */ for(i = 0; i < getSettings()->bots; i++) { botNames[i] = generateBotName(roundNum + 1, QV_RANDOM_BOT_STR, (i+1)); } generateRandomGenes(roundNum + 1, botNames); startNextRound(roundNum); for(i = 0; i < getSettings()->bots; i++) { free(botNames[i]); } break; case 1: /* spawn bots generated in dummy setup round */ for(i = 0; i < getSettings()->bots; i++) { botName = generateBotName(roundNum, QV_RANDOM_BOT_STR, (i+1)); spawnBot(botName); free(botName); } break; default: /* * child bots generated at end of previous round must be spawned * here since Quake does not know about any new bots.txt aliases * until start of next round */ for(i = 0; i < getSettings()->bots; i++) { botName = generateBotName(roundNum, QV_CHILD_BOT_STR, (i+1)); spawnBot(botName); free(botName); } break; } trap_SendConsoleCommand(EXEC_APPEND, "team spectator\n"); trap_SendConsoleCommand(EXEC_APPEND, "bot_nochat 1\n"); free(botNames); freeSettings(); }
/** * @brief MainWindow::checkConfig */ bool MainWindow::checkConfig() { QSettings &settings(getSettings()); if (firstRun) { settings.beginGroup( "mainwindow" ); restoreGeometry(settings.value( "geometry", saveGeometry() ).toByteArray()); restoreState(settings.value( "savestate", saveState() ).toByteArray()); move(settings.value( "pos", pos() ).toPoint()); resize(settings.value( "size", size() ).toSize()); QList<int> splitter = ui->splitter->sizes(); int left = settings.value("splitterLeft", splitter[0]).toInt(); int right= settings.value("splitterRight", splitter[1]).toInt(); if (left > 0 || right > 0) { splitter[0] = left; splitter[1] = right; ui->splitter->setSizes(splitter); } if ( settings.value( "maximized", isMaximized() ).toBool() ) showMaximized(); settings.endGroup(); } usePass = (settings.value("usePass") == "true"); useClipboard = (settings.value("useClipboard") == "true"); useAutoclear = (settings.value("useAutoclear") == "true"); autoclearSeconds = settings.value("autoclearSeconds").toInt(); hidePassword = (settings.value("hidePassword") == "true"); hideContent = (settings.value("hideContent") == "true"); addGPGId = (settings.value("addGPGId") != "false"); passStore = settings.value("passStore").toString(); if (passStore.isEmpty()) { passStore = Util::findPasswordStore(); settings.setValue("passStore", passStore); } passStore = Util::normalizeFolderPath(passStore); passExecutable = settings.value("passExecutable").toString(); if (passExecutable.isEmpty()) { passExecutable = Util::findBinaryInPath("pass"); } gitExecutable = settings.value("gitExecutable").toString(); if (gitExecutable.isEmpty()) { gitExecutable = Util::findBinaryInPath("git"); } gpgExecutable = settings.value("gpgExecutable").toString(); if (gpgExecutable.isEmpty()) { gpgExecutable = Util::findBinaryInPath("gpg2"); } gpgHome = settings.value("gpgHome").toString(); useWebDav = (settings.value("useWebDav") == "true"); webDavUrl = settings.value("webDavUrl").toString(); webDavUser = settings.value("webDavUser").toString(); webDavPassword = settings.value("webDavPassword").toString(); profile = settings.value("profile").toString(); settings.beginGroup("profiles"); QStringList keys = settings.childKeys(); foreach (QString key, keys) { profiles[key] = settings.value(key).toString(); }
burnConfigDialog::burnConfigDialog(QWidget *parent) : QDialog(parent), ui(new Ui::burnConfigDialog) { ui->setupUi(this); setWindowIcon(CompanionIcon("configure.png")); ui->avrdude_programmer->model()->sort(0); getSettings(); populateProgrammers(); EEPROMInterface *eepromInterface = GetEepromInterface(); if (IS_TARANIS(eepromInterface->getBoard())) { setWindowTitle(tr("DFU-UTIL Configuration")); ui->avrArgs->hide(); ui->avrdude_location->hide(); ui->avrdude_port->hide(); ui->avrdude_programmer->hide(); ui->label_av1->hide(); ui->label_av2->hide(); ui->label_av4->hide(); ui->label_av5->hide(); ui->pushButton->hide(); ui->pushButton_3->hide(); ui->pushButton_4->hide(); ui->label_sb1->hide(); ui->label_sb3->hide(); ui->samba_location->hide(); ui->samba_port->hide(); ui->sb_browse->hide(); } else if (IS_SKY9X(eepromInterface->getBoard())) { setWindowTitle(tr("SAM-BA Configuration")); ui->avrArgs->hide(); ui->avrdude_location->hide(); ui->avrdude_port->hide(); ui->avrdude_programmer->hide(); ui->label_av1->hide(); ui->label_av2->hide(); ui->label_av4->hide(); ui->label_av5->hide(); ui->pushButton->hide(); ui->pushButton_3->hide(); ui->pushButton_4->hide(); ui->label_dfu1->hide(); ui->dfu_location->hide(); ui->dfu_browse->hide(); } else { setWindowTitle(tr("AVRDUDE Configuration")); ui->label_sb1->hide(); ui->label_sb3->hide(); ui->samba_location->hide(); ui->samba_port->hide(); ui->sb_browse->hide(); ui->label_dfu1->hide(); ui->label_dfu2->hide(); ui->dfu_location->hide(); ui->dfu_browse->hide(); } ui->label_av3->hide(); ui->avrdude_mcu->hide(); ui->label_sb2->hide(); ui->arm_mcu->hide(); ui->label_dfu2->hide(); ui->dfuArgs->hide(); QTimer::singleShot(0, this, SLOT(shrink())); connect(this,SIGNAL(accepted()),this,SLOT(putSettings())); }
void EarthManipulator::overrideDefaultSettings( ) { //osg::ref_ptr< Settings > settings = new Settings( ); osg::ref_ptr< Settings > settings = getSettings( ); // install default action bindings: ActionOptions options; settings->bindKey( ACTION_HOME, osgGA::GUIEventAdapter::KEY_Space ); // pan as you hold the left button: options.clear( ); settings->bindMouse( ACTION_PAN, osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON, 0L, options); // zoom as you hold the right button: options.clear( ); options.add( OPTION_CONTINUOUS, true ); settings->bindMouse( ACTION_ZOOM, osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON, 0L, options ); // rotate with either the middle button or the left+right buttons: options.clear( ); settings->bindMouse( ACTION_ROTATE, osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON, 0L, options ); settings->bindMouse( ACTION_ROTATE, osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON | osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON ); // zoom with the scroll wheel: settings->bindScroll( ACTION_ZOOM, osgGA::GUIEventAdapter::SCROLL_2D ); settings->bindScroll( ACTION_ZOOM_IN, osgGA::GUIEventAdapter::SCROLL_DOWN ); settings->bindScroll( ACTION_ZOOM_OUT, osgGA::GUIEventAdapter::SCROLL_UP ); // pan around with arrow keys: settings->bindKey( ACTION_PAN_LEFT, osgGA::GUIEventAdapter::KEY_Left ); settings->bindKey( ACTION_PAN_RIGHT, osgGA::GUIEventAdapter::KEY_Right ); settings->bindKey( ACTION_PAN_UP, osgGA::GUIEventAdapter::KEY_Up ); settings->bindKey( ACTION_PAN_DOWN, osgGA::GUIEventAdapter::KEY_Down ); // double click the left button (or CTRL-left button) to zoom in on a point: options.clear( ); options.add( OPTION_GOTO_RANGE_FACTOR, 0.4 ); settings->bindMouseDoubleClick( ACTION_GOTO, osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON, 0L, options ); settings->bindMouseClick( ACTION_GOTO, osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON, osgGA::GUIEventAdapter::MODKEY_CTRL, options ); // double click the right button (or CTRL-right button) to zoom out to a point options.clear( ); options.add( OPTION_GOTO_RANGE_FACTOR, 2.5 ); settings->bindMouseDoubleClick( ACTION_GOTO, osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON, 0L, options ); settings->bindMouseClick( ACTION_GOTO, osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON, osgGA::GUIEventAdapter::MODKEY_CTRL, options ); //settings->setThrowingEnabled( true ); settings->setLockAzimuthWhilePanning( true ); settings->setArcViewpointTransitions( true ); settings->setMouseSensitivity( 2.0 ); //applySettings( settings ); }
int WebSettings::firstScheduledLayoutDelay() const { return d->isGlobal() ? d->m_webCoreSettingsState->firstScheduledLayoutDelay : getSettings(d->m_page)->firstScheduledLayoutDelay(); }
bool WebSettings::arePluginsEnabled() const { return d->isGlobal() ? d->m_webCoreSettingsState->arePluginsEnabled : getSettings(d->m_page)->arePluginsEnabled(); }
//=========================================================================== void DrawBBPager(HWND hwnd) { Settings const & s = getSettings(); // Create buffer hdc's, bitmaps etc. PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); HDC buf = CreateCompatibleDC(NULL); HBITMAP bufbmp = CreateCompatibleBitmap(hdc, s.m_frame.width, s.m_frame.height); HGDIOBJ oldbmp = SelectObject(buf, bufbmp); RECT r; char toolText[256]; GetClientRect(hwnd, &r); // Paint background and border according to the current style... MakeStyleGradient(buf, &r, s.m_frame.ownStyle ? s.m_frame.style : &s.m_frame.Style, true); HFONT font = CreateStyleFont((StyleItem *)GetSettingPtr(SN_TOOLBARLABEL)); HGDIOBJ oldfont = SelectObject(buf, font); SetBkMode(buf, TRANSPARENT); SetTextColor(buf, s.m_desktop.fontColor); UINT flags = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_WORD_ELLIPSIS|DT_NOPREFIX; desktopRect.clear(); // Paint desktops :D if (s.m_position.horizontal) { // Do loop to draw desktops other than current selected desktop int i = 0; do { col = i / s.m_frame.rows; row = i % s.m_frame.rows + 1; if (getRuntimeState().m_currentDesktop == i) { currentCol = col; currentRow = row; } else { r.left = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((col) * (s.m_desktop.width + s.m_frame.bevelWidth)); r.right = r.left + s.m_desktop.width; r.top = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((row - 1) * (s.m_desktop.height + s.m_frame.bevelWidth)); r.bottom = r.top + s.m_desktop.height; //desktopRect[i] = r; // set RECT item for this desktop //desktopRect.insert(desktopRect.begin() + i - 1, r); desktopRect.push_back(r); if (s.m_desktop.ownStyle) CreateBorder(buf, &r, s.m_activeDesktop.borderColor, 1); else { r.left += 1; r.top += 1; r.right -= 1; r.bottom -= 1; MakeStyleGradient(buf, &r, &s.m_activeDesktop.Style, false); } if (s.m_desktop.numbers) { char desktopNumber[4]; sprintf(desktopNumber, "%d", (i + 1)); DrawText(buf, desktopNumber, -1, &r, flags); } } i++; } while (i < getRuntimeState().m_desktops); // Do this now so bordered desktop is drawn last i = getRuntimeState().m_currentDesktop; r.left = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((currentCol) * (s.m_desktop.width + s.m_frame.bevelWidth)); r.right = r.left + s.m_desktop.width; r.top = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((currentRow - 1) * (s.m_desktop.height + s.m_frame.bevelWidth)); r.bottom = r.top + s.m_desktop.height; //desktopRect[i] = r; // set RECT item for this desktop DrawActiveDesktop(buf, r, i); if (s.m_desktop.numbers) { char desktopNumber[4]; sprintf(desktopNumber, "%d", (i + 1)); DrawText(buf, desktopNumber, -1, &r, flags); } } else if (s.m_position.vertical) { // Do loop to draw desktops other than current selected desktop int i = 0; do { row = i / s.m_frame.columns; col = i % s.m_frame.columns + 1; if (getRuntimeState().m_currentDesktop == i) { currentCol = col; currentRow = row; } else { r.left = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((col - 1) * (s.m_desktop.width + s.m_frame.bevelWidth)); r.right = r.left + s.m_desktop.width; r.top = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((row) * (s.m_desktop.height + s.m_frame.bevelWidth)); r.bottom = r.top + s.m_desktop.height; //desktopRect[i] = r; // set RECT item for this desktop //desktopRect.insert(desktopRect.begin() + i - 1, r); desktopRect.push_back(r); MakeStyleGradient(buf, &r, s.m_desktop.ownStyle ? s.m_desktop.style : &s.m_desktop.Style, false); if (s.m_desktop.ownStyle) CreateBorder(buf, &r, s.m_activeDesktop.borderColor, 1); else { r.left += 1; r.top += 1; r.right -= 1; r.bottom -= 1; MakeStyleGradient(buf, &r, &s.m_activeDesktop.Style, false); } if (s.m_desktop.numbers) { char desktopNumber[4]; sprintf(desktopNumber, "%d", (i + 1)); DrawText(buf, desktopNumber, -1, &r, flags); } } i++; } while (i < getRuntimeState().m_desktops); // Do this now so bordered desktop is drawn last i = getRuntimeState().m_currentDesktop; r.left = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((currentCol - 1) * (s.m_desktop.width + s.m_frame.bevelWidth)); r.right = r.left + s.m_desktop.width; r.top = s.m_frame.borderWidth + s.m_frame.bevelWidth + ((currentRow) * (s.m_desktop.height + s.m_frame.bevelWidth)); r.bottom = r.top + s.m_desktop.height; //desktopRect[i] = r; // set RECT item for this desktop DrawActiveDesktop(buf, r, i); if (s.m_desktop.numbers) { char desktopNumber[4]; sprintf(desktopNumber, "%d", (i + 1)); SetTextColor(buf, s.m_activeDesktop.borderColor); DrawText(buf, desktopNumber, -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX); //DrawText(buf, desktopNumber, strlen(desktopNumber), &r, DT_CALCRECT|DT_NOPREFIX); //SetTextColor(buf, s.m_desktop.fontColor); } } //DeleteObject(font); DeleteObject(SelectObject(buf, oldfont)); // Draw windows on workspaces if wanted if (s.m_desktop.windows) { getRuntimeState().m_winCount = 0; // Reset number of windows to 0 on each paint to be counted by... getRuntimeState().m_winList.clear(); // ... this function which passes HWNDs to CheckTaskEnumProc callback procedure if (!getRuntimeState().m_is_xoblite && getRuntimeState().m_usingAltMethod) EnumWindows(CheckTaskEnumProc_AltMethod, 0); else EnumWindows(CheckTaskEnumProc, 0); //struct tasklist *tlist; /*tl = GetTaskListPtr(); while (tl) { AddBBWindow(tl); tl = tl->next; }*/ // Only paint windows if there are any! if (getRuntimeState().m_winCount > 0) { // Start at end of list (bottom of zorder) for (int i = (getRuntimeState().m_winCount - 1); i > -1; i--) { RECT win = getRuntimeState().m_winList[i].r; RECT desk = desktopRect[getRuntimeState().m_winList[i].desk]; if (win.right - win.left <= 1 && win.bottom - win.top <= 1) continue; // This is done so that windows only show within the applicable desktop RECT if (win.top < desk.top) win.top = desk.top; // + 1; if (win.right > desk.right) win.right = desk.right; // - 1; if (win.bottom > desk.bottom) win.bottom = desk.bottom; // - 1; if (win.left < desk.left) win.left = desk.left; // + 1; if (getRuntimeState().m_winList[i].sticky) { RECT sWin; RECT sDesk; win.bottom = win.bottom - desk.top; win.top = win.top - desk.top; win.left = win.left - desk.left; win.right = win.right - desk.left; for (int j = 0; j < getRuntimeState().m_desktops; j++) { sDesk = desktopRect[j]; sWin.bottom = sDesk.top + win.bottom; sWin.top = sDesk.top + win.top; sWin.left = sDesk.left + win.left; sWin.right = sDesk.left + win.right; if (getRuntimeState().m_winList[i].active) // draw active window style { DrawActiveWindow(buf, sWin); RemoveFlash(getRuntimeState().m_winList[i].window, true); } else if (IsFlashOn(getRuntimeState().m_winList[i].window)) { DrawActiveWindow(buf, sWin); } else // draw inactive window style { DrawInactiveWindow(buf, sWin); RemoveFlash(getRuntimeState().m_winList[i].window, true); } // Create a tooltip... if (s.m_desktop.tooltips) { GetWindowText(getRuntimeState().m_winList[i].window, toolText, 255); SetToolTip(&sWin, toolText); } } } else { if (getRuntimeState().m_winList[i].active) // draw active window style { DrawActiveWindow(buf, win); RemoveFlash(getRuntimeState().m_winList[i].window, true); } else if (IsFlashOn(getRuntimeState().m_winList[i].window)) { DrawActiveWindow(buf, win); } else // draw inactive window style { DrawInactiveWindow(buf, win); RemoveFlash(getRuntimeState().m_winList[i].window, true); } // Create a tooltip... if (s.m_desktop.tooltips) { GetWindowText(getRuntimeState().m_winList[i].window, toolText, 255); SetToolTip(&win, toolText); } } } } if (getRuntimeState().m_winMoving) { RECT win = getRuntimeState().m_moveWin.r; RECT client; GetClientRect(getRuntimeState().m_hwndBBPager, &client); // This is done so that the window only shows within the pager if (win.top < client.top) win.top = client.top; // + 1; if (win.right > client.right) win.right = client.right; // - 1; if (win.bottom > client.bottom) win.bottom = client.bottom; // - 1; if (win.left < client.left) win.left = client.left; // + 1; if (getRuntimeState().m_moveWin.active) // draw active window style DrawActiveWindow(buf, win); else // draw inactive window style DrawInactiveWindow(buf, win); } } ClearToolTips(); // Finally, copy from the paint buffer to the window... BitBlt(hdc, 0, 0, s.m_frame.width, s.m_frame.height, buf, 0, 0, SRCCOPY); //restore the first previous whatever to the dc, //get in exchange back our bitmap, and delete it. DeleteObject(SelectObject(buf, oldbmp)); //delete the memory - 'device context' DeleteDC(buf); //done EndPaint(hwnd, &ps); }
/** Called when asyn clients call pasynInt32->write(). * This function performs actions for some parameters, including ADAcquire, ADBinX, etc. * For all parameters it sets the value in the parameter library and calls any registered callbacks.. * \param[in] pasynUser pasynUser structure that encodes the reason and address. * \param[in] value Value to write. */ asynStatus mythen::writeInt32(asynUser *pasynUser, epicsInt32 value) { int function = pasynUser->reason; int status = asynSuccess; static const char *functionName = "writeInt32"; /* Reject any call to the detector if it is running */ if ((function != ADAcquire) && acquiring_) { asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: detector is busy\n", driverName, functionName); return asynError; } /* Set the parameter and readback in the parameter library. * This may be overwritten when we read back the * status at the end, but that's OK */ status |= setIntegerParam(function, value); if (function == ADAcquire) { getIntegerParam(SDReadMode, &readmode_); status |= setAcquire(value); } else { if (function == SDSetting) { status |= loadSettings(value); } else if (function == SDUseFlatField) { status |= setFCorrection(value); } else if (function == SDUseCountRate) { status |= setRCorrection(value); } else if (function == SDUseBadChanIntrpl) { status |= setBadChanIntrpl(value); } else if (function == SDBitDepth) { status |= setBitDepth(value); } else if (function == SDNumGates) { status = setNumGates(value); } else if (function == SDUseGates) { status = setUseGates(value); } else if (function == SDNumFrames) { status |= setFrames(value); } else if (function == SDTrigger) { status |= setTrigger(value); } else if (function == SDReset) { status |= setReset(); } else if (function == ADImageMode) { //getIntegerParam(SDNumFrames, &frames_); status |= setFrames(frames_); } else { /* If this is not a parameter we have handled call the base class */ if (function < FIRST_SD_PARAM) status = ADDriver::writeInt32(pasynUser, value); } status |= getSettings(); } /* Update any changed parameters */ status |= callParamCallbacks(); if (status) asynPrint(pasynUser, ASYN_TRACE_ERROR, "%s:%s: error, status=%d function=%d, value=%d\n", driverName, functionName, status, function, value); else asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: function=%d, value=%d\n", driverName, functionName, function, value); return((asynStatus)status); }
//---------- void Device::drawWorld() { auto colorSource = this->getColorSource(); auto depthSource = this->getDepthSource(); auto bodySource = this->getBodySource(); if (!depthSource) { ofLogError("ofxKinectForWindows2::Device::drawPrettyMesh") << "No depth source initialised"; return; } //point cloud { //setup some point cloud properties for kicks bool usePointSize = true; #if OF_VERSION_MAJOR > 0 || OF_VERSION_MINOR >= 10 auto mainWindow = std::static_pointer_cast<ofAppGLFWWindow>(ofGetCurrentWindow()); usePointSize = mainWindow ? mainWindow->getSettings().glVersionMajor <= 2 : false; #endif usePointSize = false; if (usePointSize) { glPushAttrib(GL_POINT_BIT); glPointSize(5.0f); glEnable(GL_POINT_SMOOTH); } ofPushStyle(); bool useColor = colorSource.get(); if (useColor) { useColor &= colorSource->getTexture().isAllocated(); } if (useColor) { //bind kinect color camera texture and draw mesh from depth (which has texture coordinates) colorSource->getTexture().bind(); } auto opts = Source::Depth::PointCloudOptions(true, Source::Depth::PointCloudOptions::TextureCoordinates::ColorCamera); auto mesh = depthSource->getMesh(opts); //draw point cloud mesh.drawVertices(); //draw triangles ofSetColor(255, 150); mesh.drawWireframe(); //draw fills faded ofSetColor(255, 50); mesh.drawFaces(); if (useColor) { //unbind colour camera colorSource->getTexture().unbind(); } ofPopStyle(); //clear the point cloud drawing attributes if (usePointSize) { glPopAttrib(); } } //bodies and floor if (bodySource) { bodySource->drawWorld(); ofPushMatrix(); ofRotate(90, 0, 0, 1); ofMultMatrix(bodySource->getFloorTransform()); ofDrawGridPlane(5.0f); ofPopMatrix(); } //draw the view cones of depth and colour cameras ofPushStyle(); ofNoFill(); ofSetLineWidth(2.0f); ofSetColor(100, 200, 100); depthSource->drawFrustum(); if (colorSource) { ofSetColor(200, 100, 100); colorSource->drawFrustum(); } ofPopStyle(); }
/** Constructor for mythen driver; most parameters are simply passed to ADDriver::ADDriver. * After calling the base class constructor this method creates a thread to collect the detector data, * and sets reasonable default values for the parameters defined in this class, asynNDArrayDriver, and ADDriver. * \param[in] portName The name of the asyn port driver to be created. * \param[in] IPPortName The asyn network port connection to the Mythen * \param[in] maxBuffers The maximum number of NDArray buffers that the NDArrayPool for this driver is * allowed to allocate. Set this to -1 to allow an unlimited number of buffers. * \param[in] maxMemory The maximum amount of memory that the NDArrayPool for this driver is * allowed to allocate. Set this to -1 to allow an unlimited amount of memory. * \param[in] priority The thread priority for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. * \param[in] stackSize The stack size for the asyn port driver thread if ASYN_CANBLOCK is set in asynFlags. */ mythen::mythen(const char *portName, const char *IPPortName, int maxBuffers, size_t maxMemory, int priority, int stackSize) : ADDriver(portName, 1, NUM_SD_PARAMS, maxBuffers, maxMemory, 0, 0, /* No interfaces beyond those set in ADDriver.cpp */ ASYN_CANBLOCK | ASYN_MULTIDEVICE, 1, /* ASYN_CANBLOCK=1, ASYN_MULTIDEVICE=1, autoConnect=1 */ priority, stackSize) // , pDetector(NULL) { int status = asynSuccess; // NDArray *pData; const char *functionName = "mythen"; IPPortName_ = epicsStrDup(IPPortName); isBigEndian_ = EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG; /* Create the epicsEvents for signaling to the mythen task when acquisition starts and stops */ this->startEventId_ = epicsEventCreate(epicsEventEmpty); if (!this->startEventId_) { printf("%s:%s epicsEventCreate failure for start event\n", driverName, functionName); return; } // Connect to the server status = pasynOctetSyncIO->connect(IPPortName, 0, &pasynUserMeter_, NULL); if (status) { printf("%s:%s: error calling pasynOctetSyncIO->connect, status=%d, error=%s\n", driverName, functionName, status, pasynUserMeter_->errorMessage); return; } createParam(SDSettingString, asynParamInt32, &SDSetting); createParam(SDDelayTimeString, asynParamFloat64, &SDDelayTime); createParam(SDThresholdString, asynParamFloat64, &SDThreshold); createParam(SDEnergyString, asynParamFloat64, &SDEnergy); createParam(SDUseFlatFieldString, asynParamInt32, &SDUseFlatField); createParam(SDUseCountRateString, asynParamInt32, &SDUseCountRate); createParam(SDUseBadChanIntrplString, asynParamInt32, &SDUseBadChanIntrpl); createParam(SDBitDepthString, asynParamInt32, &SDBitDepth); createParam(SDUseGatesString, asynParamInt32, &SDUseGates); createParam(SDNumGatesString, asynParamInt32, &SDNumGates); createParam(SDNumFramesString, asynParamInt32, &SDNumFrames); createParam(SDTriggerString, asynParamInt32, &SDTrigger); createParam(SDResetString, asynParamInt32, &SDReset); createParam(SDTauString, asynParamFloat64, &SDTau); createParam(SDNModulesString, asynParamInt32, &SDNModules); createParam(SDFirmwareVersionString, asynParamOctet, &SDFirmwareVersion); createParam(SDReadModeString, asynParamInt32, &SDReadMode); status = setStringParam (ADManufacturer, "Dectris"); status |= setStringParam (ADModel, "Mythen"); status |= getFirmware(); status |= setStringParam (SDFirmwareVersion, firmwareVersion_); int sensorSizeX = MAX_DIMS; int sensorSizeY = 1; status |= setIntegerParam(ADMaxSizeX, sensorSizeX); status |= setIntegerParam(ADMaxSizeY, sensorSizeY); int minX, minY, sizeX, sizeY; minX = 1; minY = 1; sizeX = MAX_DIMS; sizeY = 1; status |= setIntegerParam(ADMinX, minX); status |= setIntegerParam(ADMinY, minY); status |= setIntegerParam(ADSizeX, sizeX); status |= setIntegerParam(ADSizeY, sizeY); status |= setIntegerParam(NDArraySize, 0); status |= setIntegerParam(NDDataType, NDInt32); status |= setIntegerParam(ADImageMode, ADImageSingle); /* NOTE: these char type waveform record could not be initialized in iocInit * Instead use autosave to restore their values. * It is left here only for references. * */ status |= setIntegerParam(ADStatus, getStatus()); //Get Firmware version // Read the current settings from the device. This will set parameters in the parameter library. getSettings(); int aux; //get nmodules and check for errors strcpy(outString_, "-get nmodules"); status |= writeReadMeter(); aux = stringToInt32(this->inString_); if (aux < 0) { asynPrint(pasynUserSelf, ASYN_TRACE_ERROR, "%s:%s: error, outString=%s, inString=%s\n", driverName, functionName, outString_, inString_); return; } this->nmodules=aux; status |= setIntegerParam(SDNModules, aux); detArray_ = (epicsInt32*) calloc(this->nmodules*1280, sizeof(epicsInt32)); tmpArray_ = (epicsUInt32*) calloc(this->nmodules*1280, sizeof(epicsInt32)); callParamCallbacks(); if (status) { printf("%s: unable to read camera parameters\n", functionName); return; } /* Register the shutdown function for epicsAtExit */ // epicsAtExit(c_shutdown, (void*)this); /* Create the thread that runs acquisition */ status = (epicsThreadCreate("acquisitionTask", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), (EPICSTHREADFUNC)acquisitionTaskC, this) == NULL); /* Create the thread that polls status */ // status = (epicsThreadCreate("pollTask", // epicsThreadPriorityMedium, // epicsThreadGetStackSize(epicsThreadStackMedium), // (EPICSTHREADFUNC)pollTaskC, // this) == NULL); }
OpenDialog::OpenDialog( QWidget *parent, intf_thread_t *_p_intf, bool b_selectMode, int _action_flag, bool _b_pl) : QVLCDialog( parent, _p_intf ) { i_action_flag = _action_flag; b_pl =_b_pl; if( b_selectMode ) /* Select mode */ i_action_flag = SELECT; /* Basic Creation of the Window */ ui.setupUi( this ); setWindowTitle( qtr( "Open Media" ) ); setWindowRole( "vlc-open-media" ); setWindowModality( Qt::WindowModal ); /* Tab definition and creation */ fileOpenPanel = new FileOpenPanel( this, p_intf ); discOpenPanel = new DiscOpenPanel( this, p_intf ); netOpenPanel = new NetOpenPanel( this, p_intf ); captureOpenPanel = new CaptureOpenPanel( this, p_intf ); /* Insert the tabs */ ui.Tab->insertTab( OPEN_FILE_TAB, fileOpenPanel, QIcon( ":/type/file-asym" ), qtr( "&File" ) ); ui.Tab->insertTab( OPEN_DISC_TAB, discOpenPanel, QIcon( ":/type/disc" ), qtr( "&Disc" ) ); ui.Tab->insertTab( OPEN_NETWORK_TAB, netOpenPanel, QIcon( ":/type/network" ), qtr( "&Network" ) ); ui.Tab->insertTab( OPEN_CAPTURE_TAB, captureOpenPanel, QIcon( ":/type/capture-card" ), qtr( "Capture &Device" ) ); /* Hide the Slave input widgets */ ui.slaveLabel->hide(); ui.slaveText->hide(); ui.slaveBrowseButton->hide(); /* Buttons Creation */ /* Play Button */ playButton = ui.playButton; /* Cancel Button */ cancelButton = new QPushButton( qtr( "&Cancel" ) ); /* Select Button */ selectButton = new QPushButton( qtr( "&Select" ) ); /* Menu for the Play button */ QMenu * openButtonMenu = new QMenu( "Open", playButton ); openButtonMenu->addAction( qtr( "&Enqueue" ), this, SLOT( enqueue() ), QKeySequence( "Alt+E" ) ); openButtonMenu->addAction( qtr( "&Play" ), this, SLOT( play() ), QKeySequence( "Alt+P" ) ); openButtonMenu->addAction( qtr( "&Stream" ), this, SLOT( stream() ) , QKeySequence( "Alt+S" ) ); openButtonMenu->addAction( qtr( "C&onvert" ), this, SLOT( transcode() ) , QKeySequence( "Alt+O" ) ); playButton->setMenu( openButtonMenu ); /* Add the three Buttons */ ui.buttonsBox->addButton( selectButton, QDialogButtonBox::AcceptRole ); ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole ); /* At creation time, modify the default buttons */ setMenuAction(); /* Force MRL update on tab change */ CONNECT( ui.Tab, currentChanged( int ), this, signalCurrent( int ) ); CONNECT( fileOpenPanel, mrlUpdated( const QStringList&, const QString& ), this, updateMRL( const QStringList&, const QString& ) ); CONNECT( netOpenPanel, mrlUpdated( const QStringList&, const QString& ), this, updateMRL( const QStringList&, const QString& ) ); CONNECT( discOpenPanel, mrlUpdated( const QStringList&, const QString& ), this, updateMRL( const QStringList&, const QString& ) ); CONNECT( captureOpenPanel, mrlUpdated( const QStringList&, const QString& ), this, updateMRL( const QStringList&, const QString& ) ); CONNECT( fileOpenPanel, methodChanged( const QString& ), this, newCachingMethod( const QString& ) ); CONNECT( netOpenPanel, methodChanged( const QString& ), this, newCachingMethod( const QString& ) ); CONNECT( discOpenPanel, methodChanged( const QString& ), this, newCachingMethod( const QString& ) ); CONNECT( captureOpenPanel, methodChanged( const QString& ), this, newCachingMethod( const QString& ) ); /* Advanced frame Connects */ CONNECT( ui.slaveCheckbox, toggled( bool ), this, updateMRL() ); CONNECT( ui.slaveText, textChanged( const QString& ), this, updateMRL() ); CONNECT( ui.cacheSpinBox, valueChanged( int ), this, updateMRL() ); CONNECT( ui.startTimeTimeEdit, timeChanged ( const QTime& ), this, updateMRL() ); CONNECT( ui.stopTimeTimeEdit, timeChanged ( const QTime& ), this, updateMRL() ); BUTTONACT( ui.advancedCheckBox, toggleAdvancedPanel() ); BUTTONACT( ui.slaveBrowseButton, browseInputSlave() ); /* Buttons action */ BUTTONACT( playButton, selectSlots() ); BUTTONACT( selectButton, close() ); BUTTONACT( cancelButton, cancel() ); /* Hide the advancedPanel */ if( !getSettings()->value( "OpenDialog/advanced", false ).toBool()) { ui.advancedFrame->hide(); ui.advancedFrame->setEnabled( false ); } else ui.advancedCheckBox->setChecked( true ); /* Initialize caching */ storedMethod = ""; newCachingMethod( "file-caching" ); /* enforce section due to .ui bug */ ui.startTimeTimeEdit->setCurrentSection( QDateTimeEdit::SecondSection ); ui.stopTimeTimeEdit->setCurrentSection( QDateTimeEdit::SecondSection ); setMinimumSize( sizeHint() ); setMaximumWidth( 900 ); resize( getSettings()->value( "OpenDialog/size", QSize( 500, 400 ) ).toSize() ); }
/* Cette fonction se reconnecte au server servername, * port serverport, toute les time secondes, avec un * maximum de _nb_tentatives. * * Si _nb_tentatives est NULL, ou égal a -1, alors il n'y * a aucune limite. * * Retourne la chausette créée */ int reconnect(int time, int _nb_tentatives, int _get_headers, icyHeaders *out_icy) { int tentatives = 0; int server_socket; serverSettings_t *settings; icyHeaders *icy; if (!time) time = 2; if (serversPool == NULL) { _ERROR("Error: not any server defined.\n"); exit(1); } /* Get an entry in the pool */ settings = getSettings(serversPool, &poolPosition); if (settings == NULL) { _ERROR("No valid settings in urlPool.\n"); exit(1); } RECO: sleep(time); while ( (server_socket = server_connect(settings->serverAddr, settings->port)) < 0) { /* Get an entry in the pool */ settings = getSettings(serversPool, &poolPosition); if (settings == NULL) { _ERROR("No valid settings in urlPool.\n"); exit(1); } tentatives++; if ((tentatives > _nb_tentatives) && (_nb_tentatives != -1)) { MESSAGE("Too many tentatives. Exiting program.\n"); exit(-2); } MESSAGE("Reconnecting to http://%s:%d%s [try %d] in %d sec.\n", settings->serverAddr, settings->port, settings->mountpoint, tentatives, time); sleep(time); } VERBOSE("Time spent to reconnect: %d seconds, %d tentatives.\n", (tentatives * time), tentatives); if (sendHeaders(server_socket, settings->mountpoint, 1) <= 0) { _ERROR("Error sending headers: 0 byte sent.\n"); goto RECO; } if (_get_headers) { if ( (icy = readicyheaders(getHeaders(server_socket))) == NULL) goto RECO; else out_icy = icy; } cPigeStats->reconnections++; return server_socket; }
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) { /* Variables initialisation */ bgWidget = NULL; videoWidget = NULL; playlistWidget = NULL; stackCentralOldWidget= NULL; sysTray = NULL; fullscreenControls = NULL; cryptedLabel = NULL; controls = NULL; inputC = NULL; b_hideAfterCreation = false; // --qt-start-minimized playlistVisible = false; input_name = ""; b_interfaceFullScreen= false; b_hasPausedWhenMinimized = false; i_kc_offset = false; /* Ask for Privacy */ FirstRun::CheckAndRun( this, p_intf ); /** * Configuration and settings * Pre-building of interface **/ /* Main settings */ setFocusPolicy( Qt::StrongFocus ); setAcceptDrops( true ); setWindowRole( "vlc-main" ); setWindowIcon( QApplication::windowIcon() ); setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) ); #ifdef Q_OS_MAC setAttribute( Qt::WA_MacBrushedMetal ); #endif /* Is video in embedded in the UI or not */ b_videoEmbedded = var_InheritBool( p_intf, "embedded-video" ); /* Does the interface resize to video size or the opposite */ b_autoresize = var_InheritBool( p_intf, "qt-video-autoresize" ); /* Are we in the enhanced always-video mode or not ? */ b_minimalView = var_InheritBool( p_intf, "qt-minimal-view" ); /* Do we want anoying popups or not */ i_notificationSetting = var_InheritInteger( p_intf, "qt-notification" ); /* */ b_pauseOnMinimize = var_InheritBool( p_intf, "qt-pause-minimized" ); /* Set the other interface settings */ settings = getSettings(); #ifdef _WIN32 /* Volume keys */ p_intf->p_sys->disable_volume_keys = var_InheritBool( p_intf, "qt-disable-volume-keys" ); #endif /* */ b_plDocked = getSettings()->value( "MainWindow/pl-dock-status", true ).toBool(); /************************** * UI and Widgets design **************************/ setVLCWindowsTitle(); /************ * Menu Bar * ************/ VLCMenuBar::createMenuBar( this, p_intf ); CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, destroyPopupMenu() ); createMainWidget( settings ); /************** * Status Bar * **************/ createStatusBar(); setStatusBarVisibility( getSettings()->value( "MainWindow/status-bar-visible", false ).toBool() ); /******************** * Input Manager * ********************/ MainInputManager::getInstance( p_intf ); #ifdef _WIN32 himl = NULL; p_taskbl = NULL; taskbar_wmsg = RegisterWindowMessage(TEXT("TaskbarButtonCreated")); #endif /********************************* * Create the Systray Management * *********************************/ initSystray(); /************************************************************* * Connect the input manager to the GUI elements it manages * * Beware initSystray did some connects on input manager too * *************************************************************/ /** * Connects on nameChanged() * Those connects are different because options can impeach them to trigger. **/ /* Main Interface statusbar */ CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setName( const QString& ) ); /* and title of the Main Interface*/ if( var_InheritBool( p_intf, "qt-name-in-title" ) ) { CONNECT( THEMIM->getIM(), nameChanged( const QString& ), this, setVLCWindowsTitle( const QString& ) ); }
int main(int argc, char **argv) { MyScopedSyslogListener syslogListener; //did the user specified files on the command line? //stash the files so they are loaded into the editor //this replaces the currently stored file list QStringList files; for (int i = 1; i < argc; i++) { QString file(argv[i]); if (file.isEmpty()) continue; files.push_back(file); } if (not files.isEmpty()) getSettings().setValue("GraphEditorTabs/files", files); //create the entry point to the GUI QApplication app(argc, argv); app.setOrganizationName("PothosWare"); app.setApplicationName("Pothos"); //create splash screen getSplashScreen()->show(); //setup the application icon app.setWindowIcon(QIcon(makeIconPath("PothosGui.png"))); //perform library initialization with graphical error message on failure Pothos::RemoteServer server; try { //try to talk to the server on localhost, if not there, spawn a custom one //make a server and node that is temporary with this process postStatusMessage("Launching scratch process..."); try { Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr()); } catch (const Pothos::RemoteClientError &) { server = Pothos::RemoteServer("tcp://"+Pothos::Util::getLoopbackAddr(Pothos::RemoteServer::getLocatorPort())); //TODO make server background so it does not close with process Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr()); //now it should connect to the new server } } catch (const Pothos::Exception &ex) { QMessageBox msgBox(QMessageBox::Critical, "Pothos Initialization Error", QString::fromStdString(ex.displayText())); msgBox.exec(); return EXIT_FAILURE; } POTHOS_EXCEPTION_TRY { postStatusMessage("Initializing Pothos plugins..."); Pothos::ScopedInit init; //create the main window for the GUI std::unique_ptr<QWidget> mainWindow(new PothosGuiMainWindow(nullptr)); mainWindow->show(); getSplashScreen()->finish(mainWindow.get()); getSettings().setParent(mainWindow.get()); //begin application execution return app.exec(); } POTHOS_EXCEPTION_CATCH (const Pothos::Exception &ex) { QMessageBox msgBox(QMessageBox::Critical, "PothosGui Application Error", QString::fromStdString(ex.displayText())); msgBox.exec(); return EXIT_FAILURE; }
ToolbarEditDialog::ToolbarEditDialog( QWidget *_w, intf_thread_t *_p_intf) : QVLCDialog( _w, _p_intf ) { setWindowTitle( qtr( "Toolbars Editor" ) ); setWindowRole( "vlc-toolbars-editor" ); QGridLayout *mainLayout = new QGridLayout( this ); setMinimumWidth( 600 ); setAttribute( Qt::WA_DeleteOnClose ); /* main GroupBox */ QGroupBox *widgetBox = new QGroupBox( qtr( "Toolbar Elements") , this ); widgetBox->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); QGridLayout *boxLayout = new QGridLayout( widgetBox ); flatBox = new QCheckBox( qtr( "Flat Button" ) ); flatBox->setToolTip( qtr( "Next widget style" ) ); bigBox = new QCheckBox( qtr( "Big Button" ) ); bigBox->setToolTip( flatBox->toolTip() ); shinyBox = new QCheckBox( qtr( "Native Slider" ) ); shinyBox->setToolTip( flatBox->toolTip() ); boxLayout->addWidget( new WidgetListing( p_intf, this ), 1, 0, 1, -1 ); boxLayout->addWidget( flatBox, 0, 0 ); boxLayout->addWidget( bigBox, 0, 1 ); boxLayout->addWidget( shinyBox, 0, 2 ); mainLayout->addWidget( widgetBox, 5, 0, 3, 6 ); QTabWidget *tabWidget = new QTabWidget(); mainLayout->addWidget( tabWidget, 1, 0, 4, 9 ); /* Main ToolBar */ QWidget *mainToolbarBox = new QWidget(); tabWidget->addTab( mainToolbarBox, qtr( "Main Toolbar" ) ); QFormLayout *mainTboxLayout = new QFormLayout( mainToolbarBox ); positionCheckbox = new QCheckBox( qtr( "Above the Video" ) ); positionCheckbox->setChecked( getSettings()->value( "MainWindow/ToolbarPos", 0 ).toInt() ); mainTboxLayout->addRow( new QLabel( qtr( "Toolbar position:" ) ), positionCheckbox ); QString line1 = getSettings()->value( "MainWindow/MainToolbar1", MAIN_TB1_DEFAULT ).toString(); controller1 = new DroppingController( p_intf, line1, this ); mainTboxLayout->addRow( new QLabel( qtr("Line 1:") ), controller1 ); QString line2 = getSettings()->value( "MainWindow/MainToolbar2", MAIN_TB2_DEFAULT ).toString(); controller2 = new DroppingController( p_intf, line2, this ); mainTboxLayout->addRow( new QLabel( qtr("Line 2:") ), controller2 ); /* TimeToolBar */ QString line = getSettings()->value( "MainWindow/InputToolbar", INPT_TB_DEFAULT ).toString(); controller = new DroppingController( p_intf, line, this ); QWidget *timeToolbarBox = new QWidget(); timeToolbarBox->setLayout( new QVBoxLayout() ); timeToolbarBox->layout()->addWidget( controller ); tabWidget->addTab( timeToolbarBox, qtr( "Time Toolbar" ) ); /* Advanced ToolBar */ QString lineA = getSettings()->value( "MainWindow/AdvToolbar", ADV_TB_DEFAULT ).toString(); controllerA = new DroppingController( p_intf, lineA, this ); QWidget *advToolbarBox = new QWidget(); advToolbarBox->setLayout( new QVBoxLayout() ); advToolbarBox->layout()->addWidget( controllerA ); tabWidget->addTab( advToolbarBox, qtr( "Advanced Widget" ) ); /* FSCToolBar */ QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString(); controllerFSC = new DroppingController( p_intf, lineFSC, this ); QWidget *FSCToolbarBox = new QWidget(); FSCToolbarBox->setLayout( new QVBoxLayout() ); FSCToolbarBox->layout()->addWidget( controllerFSC ); tabWidget->addTab( FSCToolbarBox, qtr( "Fullscreen Controller" ) ); /* Profile */ QGridLayout *profileBoxLayout = new QGridLayout(); profileCombo = new QComboBox; QToolButton *newButton = new QToolButton; newButton->setIcon( QIcon( ":/new" ) ); newButton->setToolTip( qtr("New profile") ); QToolButton *deleteButton = new QToolButton; deleteButton->setIcon( QIcon( ":/toolbar/clear" ) ); deleteButton->setToolTip( qtr( "Delete the current profile" ) ); profileBoxLayout->addWidget( new QLabel( qtr( "Select profile:" ) ), 0, 0 ); profileBoxLayout->addWidget( profileCombo, 0, 1 ); profileBoxLayout->addWidget( newButton, 0, 2 ); profileBoxLayout->addWidget( deleteButton, 0, 3 ); mainLayout->addLayout( profileBoxLayout, 0, 0, 1, 9 ); /* Fill combos */ int i_size = getSettings()->beginReadArray( "ToolbarProfiles" ); for( int i = 0; i < i_size; i++ ) { getSettings()->setArrayIndex(i); profileCombo->addItem( getSettings()->value( "ProfileName" ).toString(), getSettings()->value( "Value" ).toString() ); } getSettings()->endArray(); /* Load defaults ones if we have no combos */ /* We could decide that we load defaults on first launch of the dialog or when the combo is back to 0. I choose the second solution, because some clueless user might hit on delete a bit too much, but discussion is opened. -- jb */ if( i_size == 0 ) { profileCombo->addItem( PROFILE_NAME_6, QString( VALUE_6 ) ); profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) ); profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) ); profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) ); profileCombo->addItem( PROFILE_NAME_4, QString( VALUE_4 ) ); profileCombo->addItem( PROFILE_NAME_5, QString( VALUE_5 ) ); } profileCombo->setCurrentIndex( -1 ); /* Build and prepare our preview */ PreviewWidget *previewWidget = new PreviewWidget( controller, controller1, controller2 ); QGroupBox *previewBox = new QGroupBox( qtr("Preview"), this ); previewBox->setLayout( new QVBoxLayout() ); previewBox->layout()->addWidget( previewWidget ); mainLayout->addWidget( previewBox, 5, 6, 3, 3 ); CONNECT( positionCheckbox, stateChanged(int), previewWidget, setBarsTopPosition(int) ); /* Buttons */ QDialogButtonBox *okCancel = new QDialogButtonBox; QPushButton *okButton = new QPushButton( qtr( "Cl&ose" ), this ); okButton->setDefault( true ); QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ), this ); okCancel->addButton( okButton, QDialogButtonBox::AcceptRole ); okCancel->addButton( cancelButton, QDialogButtonBox::RejectRole ); BUTTONACT( deleteButton, deleteProfile() ); BUTTONACT( newButton, newProfile() ); CONNECT( profileCombo, currentIndexChanged( int ), this, changeProfile( int ) ); BUTTONACT( okButton, close() ); BUTTONACT( cancelButton, cancel() ); mainLayout->addWidget( okCancel, 8, 0, 1, 9 ); }
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) : QWidget( _par ), p_intf ( _p_i ) { setContentsMargins( 0, 3, 0, 3 ); QGridLayout *layout = new QGridLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); /******************* * Left * *******************/ /* We use a QSplitter for the left part */ leftSplitter = new QSplitter( Qt::Vertical, this ); /* Source Selector */ selector = new PLSelector( this, p_intf ); leftSplitter->addWidget( selector ); /* Create a Container for the Art Label in order to have a beautiful resizing for the selector above it */ artContainer = new QStackedWidget; artContainer->setMaximumHeight( 256 ); /* Art label */ CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf ); art->setToolTip( qtr( "Double click to get media information" ) ); artContainer->addWidget( art ); CONNECT( THEMIM->getIM(), artChanged( QString ), art, showArtUpdate( const QString& ) ); CONNECT( THEMIM->getIM(), artChanged( input_item_t * ), art, showArtUpdate( input_item_t * ) ); leftSplitter->addWidget( artContainer ); /******************* * Right * *******************/ /* Initialisation of the playlist */ playlist_t * p_playlist = THEPL; PL_LOCK; playlist_item_t *p_root = p_playlist->p_playing; PL_UNLOCK; setMinimumWidth( 400 ); PLModel *model = PLModel::getPLModel( p_intf ); #ifdef MEDIA_LIBRARY MLModel *mlmodel = new MLModel( p_intf, this ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel ); #else mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL ); #endif /* Location Bar */ locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0, 1, 2 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), mainView, browseInto( const QModelIndex & ) ); QHBoxLayout *topbarLayout = new QHBoxLayout(); layout->addLayout( topbarLayout, 0, 1 ); topbarLayout->setSpacing( 10 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview") ); topbarLayout->addWidget( viewButton ); viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView )); CONNECT( viewButton, clicked(), mainView, cycleViews() ); /* Search */ searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); searchEdit->setToolTip( qtr("Search the playlist") ); topbarLayout->addWidget( searchEdit ); CONNECT( searchEdit, textChanged( const QString& ), mainView, search( const QString& ) ); CONNECT( searchEdit, searchDelayedChanged( const QString& ), mainView, searchDelayed( const QString & ) ); CONNECT( mainView, viewChanged( const QModelIndex& ), this, changeView( const QModelIndex &) ); /* Connect the activation of the selector to a redefining of the PL */ DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), mainView, setRootItem( playlist_item_t *, bool ) ); mainView->setRootItem( p_root, false ); CONNECT( selector, SDCategorySelected(bool), mainView, setWaiting(bool) ); /* */ split = new PlaylistSplitter( this ); /* Add the two sides of the QSplitter */ split->addWidget( leftSplitter ); split->addWidget( mainView ); QList<int> sizeList; sizeList << 180 << 420 ; split->setSizes( sizeList ); split->setStretchFactor( 0, 0 ); split->setStretchFactor( 1, 3 ); split->setCollapsible( 1, false ); leftSplitter->setMaximumWidth( 250 ); /* In case we want to keep the splitter information */ // components shall never write there setting to a fixed location, may infer // with other uses of the same component... getSettings()->beginGroup("Playlist"); split->restoreState( getSettings()->value("splitterSizes").toByteArray()); leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() ); getSettings()->endGroup(); layout->addWidget( split, 1, 0, 1, -1 ); setAcceptDrops( true ); setWindowTitle( qtr( "Playlist" ) ); setWindowRole( "vlc-playlist" ); setWindowIcon( QApplication::windowIcon() ); }
/** * Set the coordinator ID. If set to zero this device will * be a coordinator. * @return true if successful or false if not */ bool TauLink::bindRadio(quint32 id, quint32 baud_rate, float rf_power, Core::IBoardType::LinkMode linkMode, quint8 min, quint8 max) { HwTauLink::DataFields settings = getSettings()->getData(); settings.CoordID = id; switch(baud_rate) { case 9600: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_9600; break; case 19200: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_19200; break; case 32000: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_32000; break; case 64000: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_64000; break; case 100000: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_100000; break; case 192000: settings.MaxRfSpeed = HwTauLink::MAXRFSPEED_192000; break; } // Round to an integer to use a switch statement quint32 rf_power_100 = rf_power * 100; switch(rf_power_100) { case 0: settings.MaxRfPower = HwTauLink::MAXRFPOWER_0; break; case 125: settings.MaxRfPower = HwTauLink::MAXRFPOWER_125; break; case 160: settings.MaxRfPower = HwTauLink::MAXRFPOWER_16; break; case 316: settings.MaxRfPower = HwTauLink::MAXRFPOWER_316; break; case 630: settings.MaxRfPower = HwTauLink::MAXRFPOWER_63; break; case 1260: settings.MaxRfPower = HwTauLink::MAXRFPOWER_126; break; case 2500: settings.MaxRfPower = HwTauLink::MAXRFPOWER_25; break; case 5000: settings.MaxRfPower = HwTauLink::MAXRFPOWER_50; break; case 10000: settings.MaxRfPower = HwTauLink::MAXRFPOWER_100; break; } switch(linkMode) { case Core::IBoardType::LINK_TELEM: settings.Radio = HwTauLink::RADIO_TELEM; break; case Core::IBoardType::LINK_TELEM_PPM: settings.Radio = HwTauLink::RADIO_TELEMPPM; break; case Core::IBoardType::LINK_PPM: settings.Radio = HwTauLink::RADIO_PPM; break; } settings.MinChannel = min; settings.MaxChannel = max; getSettings()->setData(settings); uavoUtilManager->saveObjectToFlash( getSettings()); return true; }
static void *Thread( void *obj ) { intf_thread_t *p_intf = (intf_thread_t *)obj; MainInterface *p_mi; char dummy[] = "vlc"; /* for WM_CLASS */ char *argv[4] = { dummy, NULL, }; int argc = 1; Q_INIT_RESOURCE( vlc ); /* Start the QApplication here */ #ifdef Q_WS_X11 if( x11_display != NULL ) { argv[argc++] = const_cast<char *>("-display"); argv[argc++] = x11_display; argv[argc] = NULL; } #endif QVLCApp app( argc, argv ); p_intf->p_sys->p_app = &app; /* All the settings are in the .conf/.ini style */ p_intf->p_sys->mainSettings = new QSettings( #ifdef WIN32 QSettings::IniFormat, #else QSettings::NativeFormat, #endif QSettings::UserScope, "vlc", "vlc-qt-interface" ); /* Icon setting */ if( QDate::currentDate().dayOfYear() >= 352 ) /* One Week before Xmas */ app.setWindowIcon( QIcon(vlc_christmas_xpm) ); else app.setWindowIcon( QIcon(vlc_xpm) ); /* Initialize timers and the Dialog Provider */ DialogsProvider::getInstance( p_intf ); /* Detect screensize for small screens like TV or EEEpc*/ p_intf->p_sys->i_screenHeight = app.QApplication::desktop()->availableGeometry().height(); #ifdef UPDATE_CHECK /* Checking for VLC updates */ if( var_InheritBool( p_intf, "qt-updates-notif" ) && !var_InheritBool( p_intf, "qt-privacy-ask" ) ) { int interval = var_InheritInteger( p_intf, "qt-updates-days" ); if( QDate::currentDate() > getSettings()->value( "updatedate" ).toDate().addDays( interval ) ) { /* The constructor of the update Dialog will do the 1st request */ UpdateDialog::getInstance( p_intf ); getSettings()->setValue( "updatedate", QDate::currentDate() ); } } #endif /* Create the normal interface in non-DP mode */ if( !p_intf->p_sys->b_isDialogProvider ) { p_mi = new MainInterface( p_intf ); p_intf->p_sys->p_mi = p_mi; } else p_mi = NULL; /* Explain how to show a dialog :D */ p_intf->pf_show_dialog = ShowDialog; /* Tell the main LibVLC thread we are ready */ vlc_sem_post (&ready); /* Last settings */ if( p_intf->p_sys->b_isDialogProvider ) app.setQuitOnLastWindowClosed( false ); else app.setQuitOnLastWindowClosed( true ); /* Retrieve last known path used in file browsing */ p_intf->p_sys->filepath = getSettings()->value( "filedialog-path", QVLCUserDir( VLC_HOME_DIR ) ).toString(); /* Loads and tries to apply the preferred QStyle */ QString s_style = getSettings()->value( "MainWindow/QtStyle", "" ).toString(); if( s_style.compare("") != 0 ) QApplication::setStyle( s_style ); /* Launch */ app.exec(); msg_Dbg( p_intf, "Exec finished()" ); if (p_mi != NULL) { QMutexLocker locker (&lock); active = false; p_intf->p_sys->p_mi = NULL; /* Destroy first the main interface because it is connected to some slots in the MainInputManager */ delete p_mi; } /* Destroy all remaining windows, because some are connected to some slots in the MainInputManager Settings must be destroyed after that. */ DialogsProvider::killInstance(); /* Delete the recentsMRL object before the configuration */ RecentsMRL::killInstance(); /* Save the path or delete if recent play are disabled */ if( var_InheritBool( p_intf, "qt-recentplay" ) ) getSettings()->setValue( "filedialog-path", p_intf->p_sys->filepath ); else getSettings()->remove( "filedialog-path" ); /* Delete the configuration. Application has to be deleted after that. */ delete p_intf->p_sys->mainSettings; /* Destroy the MainInputManager */ MainInputManager::killInstance(); /* Delete the application automatically */ return NULL; }
void RecentsMRL::save() { getSettings()->setValue( "RecentsMRL/list", *stack ); }
/********************************************************************** * Fullscrenn control widget **********************************************************************/ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWidget *_parent ) : AbstractController( _p_i, _parent ) { RTL_UNAFFECTED_WIDGET i_mouse_last_x = -1; i_mouse_last_y = -1; b_mouse_over = false; i_mouse_last_move_x = -1; i_mouse_last_move_y = -1; #if HAVE_TRANSPARENCY b_slow_hide_begin = false; i_slow_hide_timeout = 1; #endif b_fullscreen = false; i_hide_timeout = 1; i_screennumber = -1; vout.clear(); setWindowFlags( Qt::ToolTip ); setMinimumWidth( FSC_WIDTH ); isWideFSC = false; setFrameShape( QFrame::StyledPanel ); setFrameStyle( QFrame::Sunken ); setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); QVBoxLayout *controlLayout2 = new QVBoxLayout( this ); controlLayout2->setContentsMargins( 4, 6, 4, 2 ); /* First line */ InputControlsWidget *inputC = new InputControlsWidget( p_intf, this ); controlLayout2->addWidget( inputC ); controlLayout = new QHBoxLayout; QString line = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString(); parseAndCreate( line, controlLayout ); controlLayout2->addLayout( controlLayout ); /* hiding timer */ p_hideTimer = new QTimer( this ); p_hideTimer->setSingleShot( true ); CONNECT( p_hideTimer, timeout(), this, hideFSC() ); /* slow hiding timer */ #if HAVE_TRANSPARENCY p_slowHideTimer = new QTimer( this ); CONNECT( p_slowHideTimer, timeout(), this, slowHideFSC() ); f_opacity = var_InheritFloat( p_intf, "qt-fs-opacity" ); #endif i_sensitivity = var_InheritInteger( p_intf, "qt-fs-sensitivity" ); vlc_mutex_init_recursive( &lock ); DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, setVoutList( vout_thread_t **, int ) ); /* First Move */ previousPosition = getSettings()->value( "FullScreen/pos" ).toPoint(); screenRes = getSettings()->value( "FullScreen/screen" ).toRect(); isWideFSC = getSettings()->value( "FullScreen/wide" ).toBool(); i_screennumber = var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ); }
void RecentsMRL::save() { getSettings()->setValue( "RecentsMRL/list", recents ); getSettings()->setValue( "RecentsMRL/times", times ); }
bool WebSettings::isFrameFlatteningEnabled() const { return d->isGlobal() ? d->m_webCoreSettingsState->isFrameFlatteningEnabled : getSettings(d->m_page)->frameFlatteningEnabled(); }