int Viewfinder::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: processFrames((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: processFrame(); break; case 2: toggleCube(); break; case 3: toggleGourd(); break; case 4: paintCube(); break; case 5: paintGourd(); break; case 6: changeX(); break; case 7: changeY(); break; case 8: changeZ(); break; case 9: rotateX(); break; case 10: rotateY(); break; case 11: rotateZ(); break; case 12: plus(); break; case 13: minus(); break; case 14: openDirectory(); break; default: ; } _id -= 15; } return _id; }
ViewpointFileNavigationToolFactory::ViewpointFileNavigationToolFactory(ToolManager& toolManager) :ToolFactory("ViewpointFileNavigationTool",toolManager), viewpointFileName(""), viewpointSelectionHelper("",".views,.curve",openDirectory(".")), showGui(false), showKeyframes(true), pauseFileName("ViewpointFileNavigation.pauses"), autostart(false) { /* Initialize tool layout: */ layout.setNumButtons(1); /* Insert class into class hierarchy: */ ToolFactory* toolFactory=toolManager.loadClass("NavigationTool"); toolFactory->addChildClass(this); addParentClass(toolFactory); /* Load class settings: */ Misc::ConfigurationFileSection cfs=toolManager.getToolClassSection(getClassName()); viewpointFileName=cfs.retrieveString("./viewpointFileName",viewpointFileName); showGui=cfs.retrieveValue<bool>("./showGui",showGui); showKeyframes=cfs.retrieveValue<bool>("./showKeyframes",showKeyframes); pauseFileName=cfs.retrieveString("./pauseFileName",pauseFileName); autostart=cfs.retrieveValue<bool>("./autostart",autostart); /* Set tool class' factory pointer: */ ViewpointFileNavigationTool::factory=this; }
SlideShow::SlideShow(QWidget *parent) : QMainWindow(parent) , imageViewer(0) , playlist(0) , statusLabel(0) , countdownLabel(0) , playAction(0) , stopAction(0) { imageViewer = new QMediaImageViewer(this); connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)), this, SLOT(stateChanged(QMediaImageViewer::State))); connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)), this, SLOT(statusChanged(QMediaImageViewer::MediaStatus))); connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int))); playlist = new QMediaPlaylist; imageViewer->bind(playlist); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); QVideoWidget *videoWidget = new QVideoWidget; imageViewer->setVideoOutput(videoWidget); menuBar()->addAction(tr("Open Directory..."), this, SLOT(openDirectory())); menuBar()->addAction(tr("Open Playlist..."), this, SLOT(openPlaylist())); toolBar = new QToolBar; toolBar->setMovable(false); toolBar->setFloatable(false); toolBar->setEnabled(false); toolBar->addAction( style()->standardIcon(QStyle::SP_MediaSkipBackward), tr("Previous"), playlist, SLOT(previous())); stopAction = toolBar->addAction( style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), imageViewer, SLOT(stop())); playAction = toolBar->addAction( style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this, SLOT(play())); toolBar->addAction( style()->standardIcon(QStyle::SP_MediaSkipForward), tr("Next"), playlist, SLOT(next())); addToolBar(Qt::BottomToolBarArea, toolBar); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); countdownLabel = new QLabel; countdownLabel->setAlignment(Qt::AlignRight); statusBar()->addPermanentWidget(statusLabel, 1); statusBar()->addPermanentWidget(countdownLabel); setCentralWidget(videoWidget); }
BackupItem::BackupItem(QWidget *obj_parent) : QWidget(obj_parent), ui(new Ui::BackupItem) { ui->setupUi(this); // connect the buttons connect(ui->openButton, SIGNAL(clicked()), this, SLOT(openDirectory())); connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeEntry())); }
void GuiDirectoryFileListCtrl::setCurrentFilter( const char* filter ) { if( !filter ) filter = ""; mFilter = StringTable->insert( filter ); // Update our view openDirectory(); }
/*! * @brief System::endMessage().プログラム終了時のメッセージ * @param なし * @return なし */ void System::endMessage(int cNum) { cout << "==================================================================" << endl; cout << "Closing the Program...." << endl; if (cNum == 1){ cout << "Data Has Been Output to \"" << directoryName << "\"." << endl; openDirectory(); } cout << "==================================================================" << endl; return; }
void SamaelMainWindow::createActions() { // "Open" Action m_OpenAction = new QAction(tr("&Open File(s)"), this); m_OpenAction->setShortcut(Qt::CTRL + Qt::Key_O); m_OpenAction->setToolTip(tr("Open File(s)")); m_OpenAction->setStatusTip(tr("Open File(s)")); connect(m_OpenAction, SIGNAL(triggered()), m_TreeWidget, SLOT(openFiles())); // "Open Folder" Action m_OpenFolderAction = new QAction(tr("Open &Folder (Recursive)"), this); m_OpenFolderAction->setShortcut(Qt::CTRL + Qt::Key_F); m_OpenFolderAction->setToolTip(tr("Open Folder (Recursive)")); m_OpenFolderAction->setStatusTip(tr("Open Folder (Recursive)")); connect(m_OpenFolderAction, SIGNAL(triggered()), m_TreeWidget, SLOT(openDirectory())); // "Open Confusion Matrix" Action m_OpenConfusionMatrixAction = new QAction(tr("Open Confusion &Matrix"), this); m_OpenConfusionMatrixAction->setShortcut(Qt::CTRL + Qt::Key_M); m_OpenConfusionMatrixAction->setToolTip(tr("Open Confusion Matrix")); m_OpenConfusionMatrixAction->setStatusTip(tr("Open Confusion Matrix")); connect(m_OpenConfusionMatrixAction, SIGNAL(triggered()), m_CentralWidget->getDataViewerWidget(), SLOT(loadConfusionMatrices())); // "Save Confusion Matrix" Action m_SaveConfusionMatrixAction = new QAction(tr("Save Confusion &Matrix"), this); m_SaveConfusionMatrixAction->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_M); m_SaveConfusionMatrixAction->setToolTip(tr("Save Confusion Matrix")); m_SaveConfusionMatrixAction->setStatusTip(tr("Save Confusion Matrix")); connect(m_SaveConfusionMatrixAction, SIGNAL(triggered()), m_CentralWidget->getDataViewerWidget(), SLOT(saveConfusionMatrices())); // "Exit" Action m_ExitAction = new QAction(tr("&Exit"), this); m_ExitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); m_ExitAction->setToolTip(tr("Exit Application")); m_ExitAction->setStatusTip(tr("Exit Application")); connect(m_ExitAction, SIGNAL(triggered()), this, SLOT(exit())); // "About" Action m_AboutAction = new QAction(tr("&About"), this); m_AboutAction->setToolTip(tr("About Application")); m_AboutAction->setStatusTip(tr("About Application")); connect(m_AboutAction, SIGNAL(triggered()), this, SLOT(about())); // "Toggle Main View" Action m_ToggleMainViewAction = new QAction(tr("Toggle Main View"), this); m_ToggleMainViewAction->setShortcut(Qt::CTRL + Qt::Key_Space); m_ToggleMainViewAction->setToolTip(tr("Toggle Main View")); m_ToggleMainViewAction->setStatusTip(tr("Toggle Main View")); connect(m_ToggleMainViewAction, SIGNAL(triggered()), m_CentralWidget, SLOT(toggleWidget())); }
QString FileDialogs::openByType(const File::Type &type, const QString &arg) { switch (type) { case File::Directory: return openDirectory(arg); case File::M3U: return openPlaylistSimple(); case File::XmltvFile: return openXmltvFile(arg); default: return QString(); } }
void QgsOpenVectorLayerDialog::on_buttonSelectSrc_clicked() { if ( radioSrcFile->isChecked() ) { inputSrcDataset->setText( openFile().join( ";" ) ); } else if ( radioSrcDirectory->isChecked() ) { inputSrcDataset->setText( openDirectory() ); } else if ( !radioSrcDatabase->isChecked() ) { Q_ASSERT( !"SHOULD NEVER GET HERE" ); } }
void QgsOpenVectorLayerDialog::on_buttonSelectSrc_clicked() { if ( radioSrcFile->isChecked() ) { QStringList selected = openFile(); if ( !selected.isEmpty() ) { inputSrcDataset->setText( selected.join( ";" ) ); buttonBox->button( QDialogButtonBox::Open )->setFocus(); } } else if ( radioSrcDirectory->isChecked() ) { inputSrcDataset->setText( openDirectory() ); } }
void * CWS_Begin_Enum(const char *topdir, int filetype) { int processDir; CWS_Control *cc = (CWS_Control*) malloc(sizeof(CWS_Control)); if (cc && tmpnam(cc->name)) { cc->fp = fopen(cc->name,"w"); processDir = openDirectory((char*)topdir,cc->fp,filetype); fclose(cc->fp); cc->fp = fopen(cc->name,"r"); } if (processDir != 0) { free(cc); cc = NULL; } return cc; }
int SampleGraphicsViewApp::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: openDirectory(); break; case 1: zoom((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: onSliderPressed(); break; case 3: onSliderReleased(); break; case 4: setImageFileFilter((*reinterpret_cast< bool(*)>(_a[1]))); break; case 5: setEmfFileFilter((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 6; } return _id; }
//! \brief create the action with in the right clic on the icon void TrayIcon::createActions() { //-------------------------------------------------- // Pour mettre une image dans le TrayIcon QString path(":/logoBig"); _logoAction = new MyCustomActionPixmap(this, path); connect(_logoAction, SIGNAL(triggered()), this, SLOT(clickLogo())); //-------------------------------------------------- //-------------------------------------------------- // Pour mettre du text non cliquable // _testAction = new MyCustomActionLabel(this, tr("Coucou")); //-------------------------------------------------- //-------------------------------------------------- // Pour mettre du texte cliquable openFolderAction = new QAction(tr("&Open Woda folder"), this); connect(openFolderAction, SIGNAL(triggered()), this, SLOT(openDirectory())); goWebsiteAction = new QAction(tr("&Open Woda webapp"), this); connect(goWebsiteAction, SIGNAL(triggered()), this, SLOT(openBrowserWoda())); //recentFilesAction = new QAction(tr("&Recent files"), this); friendsAction = new QAction(tr("&Manage Friendlist"), this); connect(friendsAction, SIGNAL(triggered()), this, SLOT(openFriendManager())); spaceAction = new QAction(tr("10GO (5%) used of 50GO"), this); spaceAction->setDisabled(true); getMoreAction = new QAction(tr("&Get more storage"), this); connect(getMoreAction, SIGNAL(triggered()), this, SLOT(openBrowserMoreStorage())); preferencesAction = new QAction(tr("&Preferences"), this); connect(preferencesAction, SIGNAL(triggered()), this, SLOT(openPreferences())); helpAction = new QAction(tr("&Help"), this); connect(helpAction, SIGNAL(triggered()), this, SLOT(openFileshare())); quitAction = new QAction(tr("&Quit Woda"), this); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); //-------------------------------------------------- }
void Package::open(const String& n, bool fast) { assert(!isOpened()); // not already opened PROFILER(_("open package")); // get absolute path wxFileName fn(n); fn.Normalize(); filename = fn.GetFullPath(); // get modified time if (!fn.FileExists() || !fn.GetTimes(0, &modified, 0)) { modified = wxDateTime(0.0); // long time ago } // type of package if (wxDirExists(filename)) { openDirectory(fast); } else if (wxFileExists(filename)) { openZipfile(); } else { throw PackageNotFoundError(_("Package not found: '") + filename + _("'")); } }
void QgsOgrSourceSelect::on_buttonSelectSrc_clicked() { if ( radioSrcFile->isChecked() ) { QStringList selected = openFile(); if ( !selected.isEmpty() ) { inputSrcDataset->setText( selected.join( QStringLiteral( ";" ) ) ); addButton()->setFocus(); emit enableButtons( true ); } } else if ( radioSrcDirectory->isChecked() ) { inputSrcDataset->setText( openDirectory() ); } else if ( !radioSrcDatabase->isChecked() ) { Q_ASSERT( !"SHOULD NEVER GET HERE" ); } }
/* * This Event method is called whenever the user presses a key */ void MainWindow::keyPressEvent(QKeyEvent* ke) { if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) { //We are searching for AUR foreign packages... if (isRemoteSearchSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL) { if (m_leFilterPackage->text().size() < 2) { QMessageBox::information(this, StrConstants::getWarning(), StrConstants::getSearchStringIsShort(), QMessageBox::Ok); return; } //ui->twGroups->setEnabled(false); QFuture<QList<PackageListData> *> f; disconnect(&g_fwRemote, SIGNAL(finished()), this, SLOT(preBuildRemotePackageList())); m_cic = new CPUIntensiveComputing(); f = QtConcurrent::run(searchRemotePackages, m_leFilterPackage->text()); g_fwRemote.setFuture(f); connect(&g_fwRemote, SIGNAL(finished()), this, SLOT(preBuildRemotePackageList())); } //We are searching for packages that own some file typed by user... else if (isSearchByFileSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL) { //ui->twGroups->setEnabled(false); QFuture<QString> f; disconnect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile())); m_cic = new CPUIntensiveComputing(); f = QtConcurrent::run(searchPacmanPackagesByFile, m_leFilterPackage->text()); g_fwPackageOwnsFile.setFuture(f); connect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile())); } //We are probably inside 'Files' tab... else { QTreeView *tvPkgFileList = ui->twProperties->widget(ctn_TABINDEX_FILES)->findChild<QTreeView*>("tvPkgFileList"); if(tvPkgFileList) { if(tvPkgFileList->hasFocus()) { openFile(); } } } } else if(ke->key() == Qt::Key_Escape) { if(m_leFilterPackage->hasFocus()) { m_leFilterPackage->clear(); } } else if(ke->key() == Qt::Key_Delete) { onPressDelete(); } else if(ke->key() == Qt::Key_1 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION); } else if(ke->key() == Qt::Key_2 && ke->modifiers() == Qt::AltModifier) { ui->twProperties->setCurrentIndex(ctn_TABINDEX_FILES); refreshTabFiles(false, true); } else if(ke->key() == Qt::Key_3 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_TRANSACTION); } else if(ke->key() == Qt::Key_4 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_OUTPUT); } else if(ke->key() == Qt::Key_5 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS); } else if(ke->key() == Qt::Key_6 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_HELPUSAGE); } else if(ke->key() == Qt::Key_F4) { openTerminal(); } /*else if(ke->key() == Qt::Key_F5) { metaBuildPackageList(); }*/ else if(ke->key() == Qt::Key_F6) { openDirectory(); } else if (ke->key() == Qt::Key_F10) { maximizePackagesTreeView(false); } else if (ke->key() == Qt::Key_F12) { maximizePropertiesTabWidget(false); } else if(ke->key() == Qt::Key_C && ke->modifiers() == Qt::ControlModifier) { copyFullPathToClipboard(); } else if(ke->key() == Qt::Key_L && ke->modifiers() == Qt::ControlModifier) { m_leFilterPackage->setFocus(); m_leFilterPackage->selectAll(); } else if(ke->key() == Qt::Key_F && ke->modifiers() == Qt::ControlModifier) { if (m_commandExecuting != ectn_NONE) return; if (isPropertiesTabWidgetVisible() && (ui->twProperties->currentIndex() == ctn_TABINDEX_INFORMATION || ui->twProperties->currentIndex() == ctn_TABINDEX_OUTPUT || ui->twProperties->currentIndex() == ctn_TABINDEX_NEWS || ui->twProperties->currentIndex() == ctn_TABINDEX_HELPUSAGE)) { QTextBrowser *tb = ui->twProperties->currentWidget()->findChild<QTextBrowser*>("textBrowser"); SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar"); if (tb && tb->toPlainText().size() > 0 && searchBar) { if (searchBar) searchBar->show(); } } else if (isPropertiesTabWidgetVisible() && ui->twProperties->currentIndex() == ctn_TABINDEX_FILES) { QTreeView *tb = ui->twProperties->currentWidget()->findChild<QTreeView*>("tvPkgFileList"); SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar"); if (tb && tb->model()->rowCount() > 0 && searchBar) { if (searchBar) searchBar->show(); } } } else if(ke->key() == Qt::Key_D && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { //The user wants to know which packages have no description! showPackagesWithNoDescription(); } else if(ke->key() == Qt::Key_G && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { //The user wants to go to "Display All groups" if (!isAllCategoriesSelected()) { ui->twGroups->setCurrentItem(m_AllGroupsItem); } } else if(ke->key() == Qt::Key_C && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { if (m_commandExecuting == ectn_NONE) { doCleanCache(); //If we are not executing any command, let's clean the cache } } else if(ke->key() == Qt::Key_R && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { if (m_commandExecuting == ectn_NONE) { doRemovePacmanLockFile(); //If we are not executing any command, let's remove Pacman's lock file } } else if(ke->key() == Qt::Key_T && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier) && m_initializationCompleted) { if (m_commandExecuting != ectn_NONE) return; QStringList terminals = Terminal::getListOfAvailableTerminals(); if (terminals.count() > 2) { int index = terminals.indexOf(SettingsManager::getTerminal()); int newIndex = selectTerminal(index); if (index != newIndex) { SettingsManager::setTerminal(terminals.at(newIndex)); } } } /*else if(ke->key() == Qt::Key_Z && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { parseXBPSProcessOutput("Updating configuration file `/etc/skel/.bashrc"); }*/ else ke->ignore(); }
/* * This Event method is called whenever the user presses a key */ void MainWindow::keyPressEvent(QKeyEvent* ke) { if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) { if (ui->tvPackages->hasFocus()) { execKeyActionOnPackage(ectn_INSTALL); } //We are searching for AUR foreign packages... else if (isAURGroupSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL) { if (UnixCommand::getLinuxDistro() == ectn_KAOS) return; ui->twGroups->setEnabled(false); QFuture<QList<PackageListData> *> f; disconnect(&g_fwAUR, SIGNAL(finished()), this, SLOT(preBuildAURPackageList())); m_cic = new CPUIntensiveComputing(); f = QtConcurrent::run(searchAURPackages, m_leFilterPackage->text()); g_fwAUR.setFuture(f); connect(&g_fwAUR, SIGNAL(finished()), this, SLOT(preBuildAURPackageList())); } //We are searching for packages that own some file typed by user... else if (isSearchByFileSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL) { ui->twGroups->setEnabled(false); QFuture<QString> f; disconnect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile())); m_cic = new CPUIntensiveComputing(); f = QtConcurrent::run(searchPacmanPackagesByFile, m_leFilterPackage->text()); g_fwPackageOwnsFile.setFuture(f); connect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile())); } //We are probably inside 'Files' tab... else { QTreeView *tvPkgFileList = ui->twProperties->widget(ctn_TABINDEX_FILES)->findChild<QTreeView*>("tvPkgFileList"); if(tvPkgFileList) { if(tvPkgFileList->hasFocus()) { openFile(); } } } } else if(ke->key() == Qt::Key_Escape) { if(m_leFilterPackage->hasFocus()) { m_leFilterPackage->clear(); } } else if(ke->key() == Qt::Key_Delete) { onPressDelete(); } else if(ke->key() == Qt::Key_1 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION); } else if(ke->key() == Qt::Key_2 && ke->modifiers() == Qt::AltModifier) { ui->twProperties->setCurrentIndex(ctn_TABINDEX_FILES); refreshTabFiles(false, true); } else if(ke->key() == Qt::Key_3 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_TRANSACTION); } else if(ke->key() == Qt::Key_4 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_OUTPUT); } else if(ke->key() == Qt::Key_5 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS); } else if(ke->key() == Qt::Key_6 && ke->modifiers() == Qt::AltModifier) { changeTabWidgetPropertiesIndex(ctn_TABINDEX_HELPUSAGE); } else if(ke->key() == Qt::Key_F2) { if (isPackageTreeViewVisible()) { if (!ui->tvPackages->hasFocus()) ui->tvPackages->setFocus(); } else { maximizePropertiesTabWidget(false); if (!ui->tvPackages->hasFocus()) ui->tvPackages->setFocus(); } } else if(ke->key() == Qt::Key_F4) { openTerminal(); } else if(ke->key() == Qt::Key_F6) { openDirectory(); } else if (ke->key() == Qt::Key_F10) { maximizePackagesTreeView(false); } else if (ke->key() == Qt::Key_F12) { maximizePropertiesTabWidget(false); } else if(ke->key() == Qt::Key_C && ke->modifiers() == Qt::ControlModifier) { copyFullPathToClipboard(); } else if(ke->key() == Qt::Key_L && ke->modifiers() == Qt::ControlModifier) { m_leFilterPackage->setFocus(); m_leFilterPackage->selectAll(); } else if(ke->key() == Qt::Key_F && ke->modifiers() == Qt::ControlModifier) { if (m_commandExecuting != ectn_NONE) return; if (isPropertiesTabWidgetVisible() && (ui->twProperties->currentIndex() == ctn_TABINDEX_INFORMATION || ui->twProperties->currentIndex() == ctn_TABINDEX_OUTPUT || ui->twProperties->currentIndex() == ctn_TABINDEX_NEWS || ui->twProperties->currentIndex() == ctn_TABINDEX_HELPUSAGE)) { QTextBrowser *tb = ui->twProperties->currentWidget()->findChild<QTextBrowser*>("textBrowser"); SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar"); if (tb && tb->toPlainText().size() > 0 && searchBar) { if (searchBar) searchBar->show(); } } else if (isPropertiesTabWidgetVisible() && ui->twProperties->currentIndex() == ctn_TABINDEX_FILES) { QTreeView *tb = ui->twProperties->currentWidget()->findChild<QTreeView*>("tvPkgFileList"); SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar"); if (tb && tb->model()->rowCount() > 0 && searchBar) { if (searchBar) searchBar->show(); } } } else if(ke->key() == Qt::Key_D && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { //The user wants to know which packages have no description! showPackagesWithNoDescription(); } else if(ke->key() == Qt::Key_G && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { //The user wants to go to "Display All groups" if (!isAllGroupsSelected()) { ui->twGroups->setCurrentItem(m_AllGroupsItem); } } else if(ke->key() == Qt::Key_Y && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier) && m_hasAURTool) { if (m_commandExecuting != ectn_NONE) return; //The user wants to use "AUR tool" to search for pkgs m_actionSwitchToAURTool->trigger(); if (m_actionSwitchToAURTool->isChecked() && UnixCommand::getLinuxDistro() != ectn_KAOS) { m_leFilterPackage->setFocus(); } else { ui->tvPackages->setFocus(); } } else if(ke->key() == Qt::Key_C && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { if (m_commandExecuting == ectn_NONE) { doCleanCache(); //If we are not executing any command, let's clean the cache } } else if(ke->key() == Qt::Key_R && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { if (m_commandExecuting == ectn_NONE) { doRemovePacmanLockFile(); //If we are not executing any command, let's remove Pacman's lock file } } else if(ke->key() == Qt::Key_S && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)) { gistSysInfo(); } #if QT_VERSION >= 0x050300 else if(ke->key() == Qt::Key_T && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier) && m_initializationCompleted) { if (m_commandExecuting != ectn_NONE) return; QStringList terminals = Terminal::getListOfAvailableTerminals(); if (terminals.count() > 2) { int index = terminals.indexOf(SettingsManager::getTerminal()); int newIndex = selectTerminal(index); if (index != newIndex) { SettingsManager::setTerminal(terminals.at(newIndex)); } } } #endif else ke->ignore(); }
TitleList *getUpdateCIAs() { Handle dir, CIAFile; FS_DirectoryEntry ent; int ret; int ciafiles; TitleList *updateCIAs; char ciaPath[9 + 16 + 4 + 1]; // /updates/ + 16 hex digits + .cia + \0 LOG_INFO("getUpdateCIAs"); // Run through first and count .cia files. dir = openDirectory(CIAS_PATH); if(dir == 0) { LOG_ERROR("getUpdateCIAs: Failed to open SDMC:" CIAS_PATH ".\n"); printf("Failed to open SDMC:" CIAS_PATH ".\n"); goto error0; } ciafiles = 0; for(;;) { ret = getNextFile(dir, &ent); if(ret < 1) { if(ret == -1) { LOG_ERROR("getUpdateCIAs: Error reading directory."); printf("Error reading directory.\n"); goto error2; } break; } simpleUTF16toASCII((char *)(ent.name)); if(isCIAName((char *)(ent.name)) == 1) { ciafiles++; } } closeDirectory(dir); LOG_VERBOSE("Found %d files.", ciafiles); updateCIAs = initTitleList(ciafiles, 0); // Run through a second time and add CIA info. dir = openDirectory(CIAS_PATH); if(dir == 0) { LOG_ERROR("getUpdateCIAs: Failed to open SDMC:" CIAS_PATH ".\n"); printf("Failed to open SDMC:" CIAS_PATH ".\n"); goto error1; } ciafiles = 0; for(;;) { ret = getNextFile(dir, &ent); if(ret < 1) { if(ret == -1) { LOG_ERROR("getUpdateCIAs: Error reading directory."); printf("Error reading directory.\n"); goto error2; } break; } simpleUTF16toASCII((char *)(ent.name)); if(isCIAName((char *)(ent.name)) == 1) { snprintf(ciaPath, 9 + 16 + 4 + 1, CIAS_PATH "%s", ent.name); CIAFile = openFileHandle(ciaPath, FS_OPEN_READ); if(CIAFile == 0) { LOG_ERROR("getUpdateCIAs: Failed to open %s for read.\n", ciaPath); printf("Failed to open %s for read.\n", ciaPath); goto error2; } if(R_FAILED(AM_GetCiaFileInfo(MEDIATYPE_NAND, updateCIAs->title[ciafiles], CIAFile))) { LOG_ERROR("getUpdateCIAs: Failed to get information on %s.\n", ciaPath); printf("Failed to get information on %s.\n", ciaPath); goto error3; } closeFileHandle(CIAFile); ciafiles++; LOG_VERBOSE("getUpdateCIAs: Added %s.", (char *)(ent.name)); } } closeDirectory(dir); LOG_INFO("getUpdateCIAs: Got CIAs from SD card."); return(updateCIAs); error3: closeFileHandle(CIAFile); error2: closeDirectory(dir); error1: freeTitleList(updateCIAs); error0: LOG_ERROR("getUpdateCIAs: Failed to get CIAs from SD card."); return(NULL); }
int openDirectory(char* topDir,FILE * fp,char fileType) { struct dirent dirEntry; struct dirent *dirResult; DIR* dirPoint; struct stat fileDetails; char path[MAX_PATH_LEN],fileName[MAX_FILENAME_LEN]; if ((dirPoint = opendir(topDir)) != NULL) { while ((readdir_r(dirPoint,&dirEntry,&dirResult) == 0) && dirResult ) { strcpy(fileName,dirEntry.d_name); strcpy(path,topDir); if (topDir[ strlen(topDir) - 1 ] != '/') { strcat(path,"/"); } strcat(path,fileName); if (stat(path,&fileDetails) != -1) { if ( S_ISDIR( fileDetails.st_mode )) { if (strcmp(dirEntry.d_name,".")==0 || strcmp(dirEntry.d_name, "..") == 0) { continue; } else if (chdir(path) != -1) { openDirectory(path,fp,fileType); } if ( fileType == CWS_TYPE_DIR ) { fprintf( fp, "%s %ld %ld %ld %ld %o\n", path, fileDetails.st_size, fileDetails.st_ctime, fileDetails.st_atime, fileDetails.st_mtime, fileDetails.st_mode); } } if ( fileType == CWS_TYPE_PLAIN ) { fprintf( fp, "%s %ld %ld %ld %ld %o\n", path, fileDetails.st_size, fileDetails.st_ctime, fileDetails.st_atime, fileDetails.st_mtime, fileDetails.st_mode); } } } closedir(dirPoint); } else { return errno; } return 0; }
SlideShow::SlideShow(QWidget *parent) : QWidget(parent) , imageViewer(0) , playlist(0) , statusLabel(0) , countdownLabel(0) , playButton(0) , stopButton(0) , viewerLayout(0) { imageViewer = new QMediaImageViewer(this); connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)), this, SLOT(stateChanged(QMediaImageViewer::State))); connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)), this, SLOT(statusChanged(QMediaImageViewer::MediaStatus))); connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int))); playlist = new QMediaPlaylist; imageViewer->bind(playlist); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded())); connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed())); QVideoWidget *videoWidget = new QVideoWidget; imageViewer->bind(videoWidget); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); statusLabel = new QLabel(tr("%1 Images").arg(0)); statusLabel->setAlignment(Qt::AlignCenter); viewerLayout = new QStackedLayout; viewerLayout->setStackingMode(QStackedLayout::StackAll); viewerLayout->addWidget(videoWidget); viewerLayout->addWidget(statusLabel); QMenu *openMenu = new QMenu(this); openMenu->addAction(tr("Directory..."), this, SLOT(openDirectory())); openMenu->addAction(tr("Playlist..."), this, SLOT(openPlaylist())); QToolButton *openButton = new QToolButton; openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton)); openButton->setMenu(openMenu); openButton->setPopupMode(QToolButton::InstantPopup); playButton = new QToolButton; playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); playButton->setEnabled(false); connect(playButton, SIGNAL(clicked()), this, SLOT(play())); connect(this, SIGNAL(enableButtons(bool)), playButton, SLOT(setEnabled(bool))); stopButton = new QToolButton; stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setEnabled(false); connect(stopButton, SIGNAL(clicked()), imageViewer, SLOT(stop())); QAbstractButton *nextButton = new QToolButton; nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward)); nextButton->setEnabled(false); connect(nextButton, SIGNAL(clicked()), playlist, SLOT(next())); connect(this, SIGNAL(enableButtons(bool)), nextButton, SLOT(setEnabled(bool))); QAbstractButton *previousButton = new QToolButton; previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); previousButton->setEnabled(false); connect(previousButton, SIGNAL(clicked()), playlist, SLOT(previous())); connect(this, SIGNAL(enableButtons(bool)), previousButton, SLOT(setEnabled(bool))); countdownLabel = new QLabel; QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->setMargin(0); controlLayout->addWidget(openButton); controlLayout->addStretch(1); controlLayout->addWidget(previousButton); controlLayout->addWidget(stopButton); controlLayout->addWidget(playButton); controlLayout->addWidget(nextButton); controlLayout->addStretch(1); controlLayout->addWidget(countdownLabel); QBoxLayout *layout = new QVBoxLayout; layout->addLayout(viewerLayout); layout->addLayout(controlLayout); setLayout(layout); }
void SketchingTool::loadCurvesCallback(Misc::CallbackData* cbData) { /* Create a file selection dialog to select a curve file: */ GLMotif::FileSelectionDialog* loadCurvesDialog=new GLMotif::FileSelectionDialog(getWidgetManager(),"Load Curves...",openDirectory("."),".curves"); loadCurvesDialog->getOKCallbacks().add(this,&SketchingTool::loadCurvesOKCallback); loadCurvesDialog->getCancelCallbacks().add(loadCurvesDialog,&GLMotif::FileSelectionDialog::defaultCloseCallback); /* Show the file selection dialog: */ popupPrimaryWidget(loadCurvesDialog); }