Cleps_VidPlayer::Cleps_VidPlayer(QWidget *parent) : QWidget(parent) { videoWidget = new QVideoWidget(this); videoWidget->setContextMenuPolicy(Qt::CustomContextMenu); videoWidget->setAspectRatioMode(Qt::IgnoreAspectRatio); QBoxLayout *mreLayout = new QHBoxLayout; mreLayout->setMargin(0); mreLayout->setSpacing(0); QBoxLayout *layout = new QVBoxLayout; layout->addWidget(videoWidget); layout->addLayout(mreLayout); setLayout(layout); QShortcut *fll = new QShortcut(QKeySequence(Qt::Key_F11), videoWidget); fll->setContext(Qt::ApplicationShortcut); QShortcut *fllve = new QShortcut(QKeySequence(Qt::Key_Escape), videoWidget); fllve->setContext(Qt::ApplicationShortcut); connect(fll,SIGNAL(activated()),this,SLOT(fullScreen())); connect(fllve,SIGNAL(activated()),this,SLOT(exitFullScreen())); connect(videoWidget, SIGNAL(customContextMenuRequested(QPoint)),this, SLOT(context(QPoint))); }
PluginWidgetAndroid::~PluginWidgetAndroid() { PLUGIN_LOG("%p Deleting Plugin", m_pluginView->instance()); m_acceptEvents = false; if (m_core && android::WebViewCore::isInstance(m_core)) { m_core->removePlugin(this); if (m_isFullScreen) { exitFullScreen(true); } //SAMSUNG CHANGES //Rakesh: Added a check to see whether surface to be //destroyed is valid or not if (m_embeddedView && m_embeddedViewAttached) { m_core->destroySurface(m_embeddedView); m_embeddedViewAttached = false; } //SAMSUNG CHANGES } // cleanup any remaining JNI References JNIEnv* env = JSC::Bindings::getJNIEnv(); if (m_embeddedView) { env->DeleteGlobalRef(m_embeddedView); } m_flipPixelRef->safeUnref(); }
void keyDown(unsigned char key, int x, int y) { keys[key] = 1; switch (key) { case 'o': acceleration += 0.1; break; case 'l': acceleration -= 0.1; break; case 'k': drawOrbits = !drawOrbits; break; case 'n': drawLabels = !drawLabels; break; case 'm': drawMeteorsOn = !drawMeteorsOn; break; case 'f': fullscreen = !fullscreen; if (fullscreen) { glutFullScreen(); } else { exitFullScreen(); } break; case 27: if (fullscreen) { exitFullScreen(); fullscreen = !fullscreen; break; } else { exit(0); break; } } }
void MainWindow::createActions() { chooseVideoAction = new QAction(QIcon(":/video_folder.png"), #ifdef Q_WS_MAC tr("Open Videos"), this); #else tr("Open a Video to Play (Ctrl+O)"), this); chooseVideoAction->setShortcut(tr("Ctrl+O")); #endif playOrPauseAction = new QAction(playIcon, #ifdef Q_WS_MAC tr("Play/Pause"), this); #else tr("Play/Pause (Spacebar)"), this); (void) new QShortcut(QKeySequence("Space"), this, SLOT(playOrPause())); #endif playOrPauseAction->setDisabled(true); stopAction = new QAction(QIcon(":/stop.png"), #ifdef Q_WS_MAC tr("Stop"), this); #else tr("Stop (Ctrl+S)"), this); stopAction->setShortcut(tr("Ctrl+S")); #endif stopAction->setDisabled(true); fullScreenAction = new QAction(QIcon(":/fullscreen.png"), #ifdef Q_WS_MAC tr("Full-screen"), this); #else tr("Show Full-screen (Ctrl+F). " "Press Esc or click the mouse to cancel"), this); fullScreenAction->setShortcut(tr("Ctrl+F")); #endif videoWidget->installEventFilter(this); (void) new QShortcut(QKeySequence("Escape"), videoWidget, SLOT(exitFullScreen())); #if QT_VERSION >= 0x040600 QKeySequence quitKeySequence(QKeySequence::Quit); #else QKeySequence quitKeySequence(tr("Ctrl+Q")); #endif quitAction = new QAction(QIcon(":/exit.png"), tr("Quit (%1)").arg(quitKeySequence.toString( QKeySequence::NativeText)), this); quitAction->setShortcut(quitKeySequence); }
PluginWidgetAndroid::~PluginWidgetAndroid() { PLUGIN_LOG("%p Deleting Plugin", m_pluginView->instance()); m_acceptEvents = false; if (m_core) { m_core->removePlugin(this); if (m_isFullScreen) { exitFullScreen(true); } if (m_embeddedView) { m_core->destroySurface(m_embeddedView); } } // cleanup any remaining JNI References JNIEnv* env = JSC::Bindings::getJNIEnv(); if (m_embeddedView) { env->DeleteGlobalRef(m_embeddedView); } m_flipPixelRef->safeUnref(); }
void VideoPlayer::createActions() { // chooseVideoAction = new QAction(QIcon(":/video_folder.png"), //#ifdef Q_WS_MAC // tr("Open Videos"), this); //#else // tr("Open a Video to Play (Ctrl+O)"), this); // chooseVideoAction->setShortcut(tr("Ctrl+O")); //#endif playOrPauseAction = new QAction(playIcon, #ifdef Q_WS_MAC tr("Play/Pause"), this); #else tr("Play/Pause (Spacebar)"), this); (void) new QShortcut(QKeySequence("Space"), this, SLOT(playOrPause())); #endif playOrPauseAction->setDisabled(false); stopAction = new QAction(QIcon(":/images/stop.png"), #ifdef Q_WS_MAC tr("Stop"), this); #else tr("Stop (Ctrl+S)"), this); stopAction->setShortcut(tr("Ctrl+S")); #endif stopAction->setDisabled(true); fullScreenAction = new QAction(QIcon(":/images/fullscreen.png"), #ifdef Q_WS_MAC tr("Full-screen"), this); #else tr("Show Full-screen (Ctrl+F). " "Press Esc or click the mouse to cancel"), this); fullScreenAction->setShortcut(tr("Ctrl+F")); #endif videoWidget->installEventFilter(this); (void) new QShortcut(QKeySequence("Escape"), videoWidget, SLOT(exitFullScreen())); }
void SystemActions::generateActions(const std::vector<int> & actions) { category()->setText(QCoreApplication::tr("System")); actions_.clear(); std::vector<int> all = actions; if (all.size() <= 0) { all.push_back(ROTATE_SCREEN); all.push_back(SCREEN_UPDATE_TYPE); all.push_back(MUSIC); all.push_back(RETURN_TO_LIBRARY); } for(int i = 0; i < static_cast<int>(all.size()); ++i) { switch (all[i]) { case ROTATE_SCREEN: { shared_ptr<QAction> rotate(new QAction(exclusiveGroup())); rotate->setCheckable(true); rotate->setText(QCoreApplication::tr("Rotate Screen")); rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png"))); rotate->setData(ROTATE_SCREEN); actions_.push_back(rotate); break; } case SCREEN_UPDATE_TYPE: { // Screen update type. shared_ptr<QAction> screen(new QAction(exclusiveGroup())); screen->setCheckable(true); if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC) { screen->setText(QCoreApplication::tr("Full Refresh Off")); screen->setIcon(QIcon(QPixmap(":/images/fast_update.png"))); } else { screen->setText(QCoreApplication::tr("Full Refresh On")); screen->setIcon(QIcon(QPixmap(":/images/full_update.png"))); } screen->setData(SCREEN_UPDATE_TYPE); actions_.push_back(screen); break; } case FULL_SCREEN: { shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup())); fullScreen->setCheckable(true); fullScreen->setText(QCoreApplication::tr("Full Screen")); fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png"))); fullScreen->setData(FULL_SCREEN); actions_.push_back(fullScreen); break; } case EXIT_FULL_SCREEN: { shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup())); exitFullScreen->setCheckable(true); exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen")); exitFullScreen->setIcon(QIcon(QPixmap( ":/images/exit_full_screen.png"))); exitFullScreen->setData(EXIT_FULL_SCREEN); actions_.push_back(exitFullScreen); break; } case MUSIC: { if (sys::SystemConfig::isMusicPlayerAvailable()) { // Music. shared_ptr<QAction> music(new QAction(exclusiveGroup())); music->setCheckable(true); music->setText(QCoreApplication::tr("Music")); music->setIcon(QIcon(QPixmap(":/images/music.png"))); music->setData(MUSIC); actions_.push_back(music); } break; } case RETURN_TO_LIBRARY: { // Close document. shared_ptr<QAction> close(new QAction(exclusiveGroup())); close->setCheckable(true); close->setText(QCoreApplication::tr("Close")); close->setIcon(QIcon(QPixmap(":/images/return_to_library.png"))); close->setData(RETURN_TO_LIBRARY); actions_.push_back(close); break; } } } }
LiveViewWindow::LiveViewWindow(DVRServerRepository *serverRepository, QWidget *parent, bool openfs, Qt::WindowFlags f) : QWidget(parent, f), m_liveView(0), m_serverRepository(serverRepository), m_savedLayouts(new QComboBox), m_lastLayoutIndex(-1), m_autoSized(false), m_isLayoutChanging(false), m_wasOpenedFs(openfs) { QBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); m_toolBar = new QToolBar(tr("Live View")); m_toolBar->setIconSize(QSize(16, 16)); m_toolBar->setMovable(false); #ifndef Q_OS_MAC //toolBar->setStyleSheet(QLatin1String("QToolBar { border: none; }")); #endif m_liveView = new LiveViewArea(m_serverRepository); LiveViewLayout *viewLayout = m_liveView->layout(); /* Saved layouts box */ m_savedLayouts->setModel(SavedLayoutsModel::instance()); m_savedLayouts->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_savedLayouts->setInsertPolicy(QComboBox::NoInsert); m_savedLayouts->setMinimumWidth(100); m_savedLayouts->setContextMenuPolicy(Qt::CustomContextMenu); m_savedLayouts->setCurrentIndex(-1); m_savedLayouts->setMaxVisibleItems(22); m_toolBar->addWidget(m_savedLayouts); QWidget *spacer = new QWidget; spacer->setFixedWidth(20); m_toolBar->addWidget(spacer); aNewLayout = m_toolBar->addAction(QIcon(QLatin1String(":/icons/plus.png")), tr("New Layout"), this, SLOT(createNewLayout())); aRenameLayout = m_toolBar->addAction(QIcon(QLatin1String(":/icons/pencil.png")), tr("Rename Layout"), this, SLOT(renameLayout())); aDelLayout = m_toolBar->addAction(QIcon(QLatin1String(":/icons/cross.png")), tr("Delete Layout"), this, SLOT(deleteCurrentLayout())); aRenameLayout->setEnabled(false); aDelLayout->setEnabled(false); spacer = new QWidget; spacer->setFixedWidth(16); m_toolBar->addWidget(spacer); connect(m_savedLayouts, SIGNAL(currentIndexChanged(int)), SLOT(savedLayoutChanged(int))); connect(m_savedLayouts, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showLayoutMenu(QPoint))); m_addRowAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-split-vertical.png")), tr("Add Row"), viewLayout, SLOT(appendRow())); m_removeRowAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-join-vertical.png")), tr("Remove Row"), viewLayout, SLOT(removeRow())); spacer = new QWidget; spacer->setFixedWidth(16); m_toolBar->addWidget(spacer); m_addColumnAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-split.png")), tr("Add Column"), viewLayout, SLOT(appendColumn())); m_removeColumnAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-join.png")), tr("Remove Column"), viewLayout, SLOT(removeColumn())); spacer = new QWidget; spacer->setFixedWidth(16); m_toolBar->addWidget(spacer); QSignalMapper *mapper = new QSignalMapper(this); connect(mapper, SIGNAL(mapped(int)), viewLayout, SLOT(setGridSize(int))); m_singleAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout.png")), tr("Single"), mapper, SLOT(map())); mapper->setMapping(m_singleAction, 1); QAction *a = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-4.png")), tr("2x2"), mapper, SLOT(map())); mapper->setMapping(a, 2); a = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-9.png")), tr("3x3"), mapper, SLOT(map())); mapper->setMapping(a, 3); a = m_toolBar->addAction(QIcon(QLatin1String(":/icons/layout-16.png")), tr("4x4"), mapper, SLOT(map())); mapper->setMapping(a, 4); spacer = new QWidget; spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_toolBar->addWidget(spacer); m_fullscreenAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/application-resize-full.png")), tr("Fullscreen"), this, SLOT(toggleFullScreen())); m_fullscreenAction->setShortcut(Qt::Key_F11); if (m_wasOpenedFs) { m_closeAction = m_toolBar->addAction(QIcon(QLatin1String(":/icons/cross.png")), tr("Exit"), this, SLOT(close())); new QShortcut(Qt::Key_Escape, this, SLOT(close()), 0, Qt::WindowShortcut); } else new QShortcut(Qt::Key_Escape, this, SLOT(exitFullScreen()), 0, Qt::WindowShortcut); connect(m_liveView->layout(), SIGNAL(layoutChanged()), SLOT(updateLayoutActionStates())); connect(m_liveView->layout(), SIGNAL(layoutChanged()), SLOT(saveLayout())); QMainWindow *wnd = qobject_cast<QMainWindow*>(window()); if (wnd) wnd->addToolBar(Qt::TopToolBarArea, m_toolBar); else layout->addWidget(m_toolBar); layout->addWidget(m_liveView); updateLayoutActionStates(); }
void SystemActions::generateActions(const std::vector<int> & actions) { category()->setFont(actionFont()); category()->setText(QCoreApplication::tr("System")); actions_.clear(); std::vector<int> all = actions; if (all.size() <= 0) { all.push_back(ROTATE_SCREEN); all.push_back(SCREEN_UPDATE_TYPE); all.push_back(MUSIC); #ifdef BUILD_WITH_TFT all.push_back(BACKLIGHT_BRIGHTNESS); #endif all.push_back(RETURN_TO_LIBRARY); } for(int i = 0; i < static_cast<int>(all.size()); ++i) { switch (all[i]) { case ROTATE_SCREEN: { shared_ptr<QAction> rotate(new QAction(exclusiveGroup())); rotate->setCheckable(true); rotate->setFont(actionFont()); rotate->setText(QCoreApplication::tr("Rotate Screen")); rotate->setIcon(QIcon(QPixmap(":/images/screen_rotation.png"))); rotate->setData(ROTATE_SCREEN); actions_.push_back(rotate); break; } case SCREEN_UPDATE_TYPE: { // Screen update type. shared_ptr<QAction> screen(new QAction(exclusiveGroup())); screen->setCheckable(true); screen->setFont(actionFont()); if (onyx::screen::instance().defaultWaveform() == onyx::screen::ScreenProxy::GC) { screen->setText(QCoreApplication::tr("Full Refresh Off")); screen->setIcon(QIcon(QPixmap(":/images/fast_update.png"))); } else { screen->setText(QCoreApplication::tr("Full Refresh On")); screen->setIcon(QIcon(QPixmap(":/images/full_update.png"))); } screen->setData(SCREEN_UPDATE_TYPE); actions_.push_back(screen); break; } case FULL_SCREEN: { shared_ptr<QAction> fullScreen(new QAction(exclusiveGroup())); fullScreen->setCheckable(true); fullScreen->setFont(actionFont()); fullScreen->setText(QCoreApplication::tr("Full Screen")); fullScreen->setIcon(QIcon(QPixmap(":/images/full_screen.png"))); fullScreen->setData(FULL_SCREEN); actions_.push_back(fullScreen); break; } case EXIT_FULL_SCREEN: { shared_ptr<QAction> exitFullScreen(new QAction(exclusiveGroup())); exitFullScreen->setCheckable(true); exitFullScreen->setFont(actionFont()); exitFullScreen->setText(QCoreApplication::tr("Exit Full Screen")); exitFullScreen->setIcon(QIcon(QPixmap( ":/images/exit_full_screen.png"))); exitFullScreen->setData(EXIT_FULL_SCREEN); actions_.push_back(exitFullScreen); break; } case MUSIC: { if (sys::SystemConfig::isMusicPlayerAvailable()) { // Music. shared_ptr<QAction> music(new QAction(exclusiveGroup())); music->setCheckable(true); music->setFont(actionFont()); music->setText(QCoreApplication::tr("Music")); music->setIcon(QIcon(QPixmap(":/images/music.png"))); music->setData(MUSIC); actions_.push_back(music); } break; } case SYSTEM_VOLUME: { // when music and tts both are disabled, do not show volume configure bool music_available = sys::SystemConfig::isMusicPlayerAvailable(); bool disable_tts = qgetenv("DISABLE_TTS").toInt(); if (!music_available && disable_tts) { continue; } // system volume. shared_ptr<QAction> volume(new QAction(exclusiveGroup())); volume->setCheckable(true); volume->setFont(actionFont()); volume->setText(QCoreApplication::tr("Volume")); volume->setIcon(QIcon(QPixmap(":/images/system_volume.png"))); volume->setData(SYSTEM_VOLUME); actions_.push_back(volume); break; } case RETURN_TO_LIBRARY: { // Close document. shared_ptr<QAction> close(new QAction(exclusiveGroup())); close->setCheckable(true); close->setFont(actionFont()); close->setText(QCoreApplication::tr("Close")); close->setIcon(QIcon(QPixmap(":/images/return_to_library.png"))); close->setData(RETURN_TO_LIBRARY); actions_.push_back(close); break; } case BACKLIGHT_BRIGHTNESS: { shared_ptr<QAction> br(new QAction(exclusiveGroup())); br->setCheckable(true); br->setFont(actionFont()); br->setText(QCoreApplication::tr("Brightness")); br->setIcon(QIcon(QPixmap(":/images/return_to_library.png"))); br->setData(BACKLIGHT_BRIGHTNESS); actions_.push_back(br); break; } case GLOW_LIGHT_CONTROL: { if (!sys::hasGlowLight()) { continue; } shared_ptr<QAction> glow_light(new QAction(exclusiveGroup())); glow_light->setCheckable(true); glow_light->setFont(actionFont()); glow_light->setText(QCoreApplication::tr("MOON Light Control")); glow_light->setIcon(QIcon(QPixmap(":/images/glow_light_switch.png"))); glow_light->setData(GLOW_LIGHT_CONTROL); actions_.push_back(glow_light); break; } } } }