void OpenFileWidget::setupGUI() { QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setSizeConstraint(QLayout::SetMaximumSize); m_pathLabel = new QLabel(m_path); mainLayout->addWidget(m_pathLabel); m_fileList = new QListWidget(); m_fileList->setSelectionMode(QAbstractItemView::SingleSelection); m_fileList->setSortingEnabled(false); m_fileList->setTextElideMode(Qt::ElideRight); m_fileList->setSpacing(4); connect(m_fileList, SIGNAL(itemClicked(QListWidgetItem*)) , this, SLOT(onItemClicked(QListWidgetItem*))); connect(m_fileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)) , this, SLOT(onItemDoubleClicked(QListWidgetItem*))); mainLayout->addWidget(m_fileList, 1); QHBoxLayout *operateLayout = new QHBoxLayout(); m_parentButton = new QPushButton("上级目录"); connect(m_parentButton, SIGNAL(clicked()), this, SLOT(onParent())); m_openButton = new QPushButton("打开"); connect(m_openButton, SIGNAL(clicked()), this, SLOT(onOpen())); m_cancelButton = new QPushButton("取消"); connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel())); operateLayout->addStretch(1); operateLayout->addWidget(m_parentButton); operateLayout->addWidget(m_openButton); operateLayout->addWidget(m_cancelButton); mainLayout->addLayout(operateLayout); }
void BaseEditor::processAssetLoadRequest(const char* assetPath, bool activateLoadingFile, const Variant& resourcesToLoad) { auto editor = pImpl_->get<IEditor>(); TF_ASSERT(editor != nullptr); if (!editor) { return; } auto doc = editor->open(assetPath, activateLoadingFile); if (doc == nullptr) { // A new document was not opened. return; } if (std::string(assetPath) == doc->getFilePath()) { clearCheckoutState(); } if (auto editorCommon = pImpl_->get<IEditorCommon>()) { editorCommon->setSelectedSceneNodeIds(std::vector<uintptr_t>()); } bindDocument(doc); onOpen(assetPath, doc); loadResources(assetPath, resourcesToLoad); }
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); // setup the docking widgets controlWidget = new ControlWidget(this); // setup the toolbar ui.fileToolBar->addAction(ui.actionNew); ui.fileToolBar->addAction(ui.actionOpen); ui.areaToolBar->addAction(ui.actionHintLine); // register the menu's action handlers connect(ui.actionNew, SIGNAL(triggered()), this, SLOT(onNew())); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen())); connect(ui.actionLoadArea, SIGNAL(triggered()), this, SLOT(onLoadArea())); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionCreateArea, SIGNAL(triggered()), this, SLOT(onCreateArea())); connect(ui.actionHintLine, SIGNAL(triggered()), this, SLOT(onHintLine())); connect(ui.actionControlWidget, SIGNAL(triggered()), this, SLOT(onShowControlWidget())); // setup the GL widget glWidget = new GLWidget(this); setCentralWidget(glWidget); controlWidget->show(); addDockWidget(Qt::LeftDockWidgetArea, controlWidget); mode = MODE_AREA_CREATE; }
DBFileSelector::DBFileSelector(QWidget *parent, QStringList fileList, QString filter, QString *filePath) : QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint) { QVBoxLayout *vertLayout = new QVBoxLayout(this); m_list = new QListWidget(); vertLayout->addWidget(m_list); m_buttons = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Open); m_buttons->setCenterButtons(true); vertLayout->addWidget(m_buttons); m_filePath = filePath; if (filter == "") { m_filteredList = fileList; } else { m_filteredList.clear(); for (int i = 0; i < fileList.size(); i++) { if (fileList.at(i).contains(filter)) { m_filteredList.append(fileList.at(i)); } } } m_list->addItems(m_filteredList); resize(500, 400); connect(m_buttons, SIGNAL(accepted()), this, SLOT(onOpen())); connect(m_list, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(onDoubleClick(QListWidgetItem *))); }
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); statusLebelL = new QLabel(); statusLabelR = new QLabel(); // setup UI ui.statusBar->addWidget(statusLebelL, 1); ui.statusBar->addWidget(statusLabelR, 0); // setup the docking widgets controlWidget = new ControlWidget(this); // register the menu's "AboutToShow" handlers connect(ui.menuEdit, SIGNAL(aboutToShow()), this, SLOT(onMenuEdit())); // register the menu's action handlers connect(ui.actionNew, SIGNAL(triggered()), this, SLOT(onNew())); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen())); connect(ui.actionSave, SIGNAL(triggered()), this, SLOT(onSave())); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionSelectAll, SIGNAL(triggered()), this, SLOT(onSelectAll())); connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(onUndo())); connect(ui.actionCut, SIGNAL(triggered()), this, SLOT(onCut())); connect(ui.actionDeleteEdge, SIGNAL(triggered()), this, SLOT(onDeleteEdge())); connect(ui.actionControlWidget, SIGNAL(triggered()), this, SLOT(onShowControlWidget())); // setup the GL widget glWidget = new GLWidget(this); setCentralWidget(glWidget); // setup the event filter glWidget->installEventFilter(this); controlWidget->installEventFilter(this); }
/** * @brief FoldableWidget::open */ void FoldableWidget::open() { down->hide(); up->show(); foldableObj->show(); emit onOpen(); }
/** * \brief Déplie l'éditeur */ void FoldableEditor::open(){ label->hide(); dropDown->hide(); editor->show(); dropUp->show(); this->repaint(); this->adjustSize(); opened = true; emit onOpen(); }
S32 LLPanelProfile::notifyParent(const LLSD& info) { std::string action = info["action"]; // lets update Picks list after Pick was saved if("save_new_pick" == action) { onOpen(info); return 1; } return LLPanel::notifyParent(info); }
void HTAppQt::makeConnections() { //setup qt signals/slots here to communicate to/from main GUI window connect(mQtGUI->ui.actionNew, SIGNAL(triggered()), this, SLOT(onNew())); connect(mQtGUI->ui.action_Open, SIGNAL(triggered()), this, SLOT(onOpen())); connect(mQtGUI->ui.action_Save, SIGNAL(triggered()), this, SLOT(onSave())); connect(mQtGUI->ui.action_Path_planning, SIGNAL(triggered(bool)), this, SLOT(onPathPlanning(bool))); connect(mQtGUI->formationGroup, SIGNAL(triggered(QAction*)), this, SLOT(onFormation(QAction*))); connect(mQtGUI->manoeuvreGroup, SIGNAL(triggered(QAction*)), this, SLOT(onManoeuvre(QAction*))); connect(mQtGUI, SIGNAL(unitSelected(QString)), this, SLOT(unitSelected(QString))); connect(mQtGUI->ui.action_Launch, SIGNAL(triggered()), this, SLOT(onLaunchHypotheses())); connect(mQtGUI->ui.action_Save_2, SIGNAL(triggered()), this, SLOT(onSaveAll())); }
void MainWindow::createActions() { openFileAct = new QAction(tr("&Open File"), this); openFileAct->setShortcut(QKeySequence::Open); connect(openFileAct, SIGNAL(triggered()), this, SLOT(onOpen())); exitAct = new QAction(tr("&Quit"), this); exitAct->setShortcut(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); }
void OpenFileWidget::onItemDoubleClicked(QListWidgetItem *item) { if(item->type() == QListWidgetItem::UserType) { setupPath(item); startTraverse(); } else { m_fileList->setCurrentItem(item); onOpen(); } }
void LLPanelMe::onSaveChangesClicked() { LLAvatarData data = LLAvatarData(); data.avatar_id = gAgent.getID(); data.image_id = mEditPanel->getChild<LLTextureCtrl>(PICKER_SECOND_LIFE)->getImageAssetID(); data.fl_image_id = mEditPanel->getChild<LLTextureCtrl>(PICKER_FIRST_LIFE)->getImageAssetID(); data.about_text = mEditPanel->getChild<LLUICtrl>("sl_description_edit")->getValue().asString(); data.fl_about_text = mEditPanel->getChild<LLUICtrl>("fl_description_edit")->getValue().asString(); data.profile_url = mEditPanel->getChild<LLUICtrl>("homepage_edit")->getValue().asString(); data.allow_publish = mEditPanel->getChild<LLUICtrl>("show_in_search_checkbox")->getValue(); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&data); togglePanel(mEditPanel); // close onOpen(getAvatarId()); }
// Loop to handle connection and recieve messages void UDPConnection::loop(){ std::unique_lock<std::mutex> recieveLock(_messageMutex, std::defer_lock); onOpen(); while(!_dead){ while(_messageQueue.size() > 0){ onMessage(_messageQueue.front()); recieveLock.lock(); _messageQueue.pop(); recieveLock.unlock(); } _cv.wait(recieveLock); recieveLock.unlock(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_logging(0), m_scene(new SceneModel), m_sceneTreeView(0) { m_logging=new LoggingWidget; QObject::connect(this, SIGNAL(logging(const QString &)), m_logging, SLOT(receive(const QString &))); QObject::connect(m_scene, SIGNAL(logging(const QString &)), m_logging, SLOT(receive(const QString &))); setupDock(m_logging, tr("Log"), Qt::BottomDockWidgetArea, Qt::BottomDockWidgetArea ); // tree view auto m_sceneTreeView=new SceneTreeWidget(m_scene); setupDock(m_sceneTreeView, tr("Scene"), Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea, Qt::LeftDockWidgetArea ); QObject::connect(m_sceneTreeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onSceneItemActivated(const QModelIndex &))); // OpenGL view auto glv=new GLView(m_scene); setCentralWidget(glv); QObject::connect(glv, SIGNAL(logging(const QString &)), m_logging, SLOT(receive(const QString &))); QObject::connect(m_scene, SIGNAL(repaint()), glv, SLOT(update())); // file menu auto file=menuBar()->addMenu(tr("&File")); auto open=new QAction("&Open", this); file->addAction(open); auto quit=new QAction("&Quit", this); file->addAction(quit); connect(quit, SIGNAL(triggered()), qApp, SLOT(quit())); QObject::connect(open, SIGNAL(triggered()), this, SLOT(onOpen())); }
/** * \brief Constructeur de DocumentEditorRow * \details Construit une ligne d'édition pour le DocumentEditor en construisant * un éditeur pliable et les boutons pour déplacer une note dans le document, * l'éditer directement dans la fenêtre principale ou la supprimer */ DocumentEditorRow::DocumentEditorRow(Note *n, QWidget *parent) : QWidget(parent) { editor = new FoldableEditor(NotesEditorFactory::getInstance().getNewNoteEditor(n, this), this); QObject::connect(editor, SIGNAL(onOpen()), this, SLOT(setSideBarVertical())); QObject::connect(editor, SIGNAL(onClose()), this, SLOT(setSideBarHorizontal())); moveUpBtn = new QPushButton(QIcon("moveUp.png"), "", this); moveUpBtn->setFixedSize(30, 30); QObject::connect(moveUpBtn, SIGNAL(clicked()), this, SLOT(moveUp())); moveDownBtn = new QPushButton(QIcon("moveDown.png"), "", this); moveDownBtn->setFixedSize(30, 30); QObject::connect(moveDownBtn, SIGNAL(clicked()), this, SLOT(moveDown())); editBtn = new QPushButton(QIcon("editer.png"), "", this); editBtn->setFixedSize(30, 30); QObject::connect(editBtn, SIGNAL(clicked()), this, SLOT(edit())); supressBtn = new QPushButton(QIcon("supprimer.png"), "", this); supressBtn->setFixedSize(30, 30); QObject::connect(supressBtn, SIGNAL(clicked()), this, SLOT(supress())); addBtn = new QPushButton("Ajouter une note existante"); QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(add())); createBtn = new QPushButton("Créer une note"); QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(create())); subLayout = new QBoxLayout(QBoxLayout::LeftToRight); subLayout->addWidget(moveUpBtn); subLayout->addWidget(moveDownBtn); subLayout->addWidget(editBtn); subLayout->addWidget(supressBtn); QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->addWidget(editor); hLayout->addLayout(subLayout); QHBoxLayout* addLayout = new QHBoxLayout(); addLayout->addWidget(addBtn); addLayout->addWidget(createBtn); layout = new QVBoxLayout(); layout->addLayout(hLayout); layout->addLayout(addLayout); this->setLayout(layout); }
// Loop to handle connection and recieve messages void TCPConnection::loop(){ const char *term=" \t\r\n"; std::string message = ""; char c; onOpen(); while(!_dead){ if(skt_recvN(_socket,&c,1) != 0){ fail(); // Connection failure } else if(strchr(term,c)){ if(c=='\r') continue; // will be CR/LF; wait for LF onMessage(message); message = ""; } else{ message+=c; // normal character } } }
void MainWindow::init() { ui->listWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); ui->listWidget->setResizeMode(QListWidget::Adjust); ui->refreshButton->setIconSize(QSize(16,16)); ui->refreshButton->setIcon(QIcon::fromTheme("view-refresh")); ui->formatButton->setIconSize(QSize(16,16)); ui->formatButton->setIcon(QIcon::fromTheme("format-text-direction-ltr")); QFont font; font.setFamily("Andale"); font.setFixedPitch(true); font.setPixelSize(12); font.setWeight(1); ui->contentEdit->setFont(font); ui->scrollArea->setWidgetResizable(true); ui->scrollArea->setPalette(QPalette(Qt::white)); // connect onTreeItemClicked connect(ui->treeWidget,SIGNAL(itemClicked(QTreeWidgetItem*,int)), this,SLOT(onTreeItemClicked(QTreeWidgetItem*,int))); // connect onTreeContextMenuRequested connect(ui->treeWidget,SIGNAL(customContextMenuRequested(QPoint)), this,SLOT(onTreeContextMenuRequested(QPoint))); // connect onContentEditChanged connect(ui->contentEdit,SIGNAL(textChanged()),this,SLOT(onContentEditChanged())); // connect onNameEditChanged connect(ui->nameEdit,SIGNAL(textChanged(QString)),this,SLOT(onNameEditChanged(QString))); // connect file menu actions connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(onOpen())); connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(onSave())); connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(onSaveAs())); }
void BaseEditor::actionOpen() { auto uiFramework = pImpl_->get<IUIFramework>(); TF_ASSERT(uiFramework != nullptr); if (!uiFramework) { return; } IDocument* doc = nullptr; auto path = uiFramework->showOpenFileDialog("Open", lastSaveFolder(), fileOpenFilter(), IUIFramework::None); if (!path.empty()) { auto editor = pImpl_->get<IEditor>(); TF_ASSERT(editor != nullptr); if (editor) { doc = editor->open(path.front().c_str()); if (doc == nullptr) { return; } bindDocument(doc); if (path.front() == doc->getFilePath()) { clearCheckoutState(); } } onOpen(path.front().c_str(), doc); auto editorCommon = pImpl_->get<IEditorCommon>(); TF_ASSERT(editorCommon != nullptr); if (editorCommon) { editorCommon->addToRecentFiles(path.front().c_str()); } } }
void Editor_menuEvent(int menuItem) { int highlightRowStep = getTrackData()->highlightRowStep; switch (menuItem) { case EDITOR_MENU_ENTER_CURRENT_V : case EDITOR_MENU_ROWS_UP : case EDITOR_MENU_ROWS_DOWN : case EDITOR_MENU_PREV_BOOKMARK : case EDITOR_MENU_NEXT_BOOKMARK : case EDITOR_MENU_PREV_KEY : case EDITOR_MENU_NEXT_KEY : case EDITOR_MENU_PLAY : { endEditing(); } } cancelEditing(); // If some internal control has focus we let it do its thing if (Emgui_hasKeyboardFocus()) { Editor_update(); return; } switch (menuItem) { // File case EDITOR_MENU_OPEN: onOpen(); break; case EDITOR_MENU_SAVE: onSave(); break; case EDITOR_MENU_SAVE_AS: onSaveAs(); break; case EDITOR_MENU_REMOTE_EXPORT : RemoteConnection_sendSaveCommand(); break; case EDITOR_MENU_RECENT_FILE_0: case EDITOR_MENU_RECENT_FILE_1: case EDITOR_MENU_RECENT_FILE_2: case EDITOR_MENU_RECENT_FILE_3: { Editor_loadRecentFile(menuItem - EDITOR_MENU_RECENT_FILE_0); break; } // Edit case EDITOR_MENU_UNDO : onUndo(); break; case EDITOR_MENU_REDO : onRedo(); break; case EDITOR_MENU_CANCEL_EDIT : onCancelEdit(); break; case EDITOR_MENU_DELETE_KEY : onDeleteKey(); break; case EDITOR_MENU_CUT : onCutAndCopy(true); break; case EDITOR_MENU_COPY : onCutAndCopy(false); break; case EDITOR_MENU_PASTE : onPaste(); break; case EDITOR_MENU_SELECT_TRACK : onSelectTrack(); break; case EDITOR_MENU_BIAS_P_001 : biasSelection(0.01f); break; case EDITOR_MENU_BIAS_P_01 : biasSelection(0.1f); break; case EDITOR_MENU_BIAS_P_1: biasSelection(1.0f); break; case EDITOR_MENU_BIAS_P_10: biasSelection(10.0f); break; case EDITOR_MENU_BIAS_P_100: biasSelection(100.0f); break; case EDITOR_MENU_BIAS_P_1000: biasSelection(1000.0f); break; case EDITOR_MENU_BIAS_N_001: biasSelection(-0.01f); break; case EDITOR_MENU_BIAS_N_01: biasSelection(-0.1f); break; case EDITOR_MENU_BIAS_N_1: biasSelection(-1.0f); break; case EDITOR_MENU_BIAS_N_10: biasSelection(-10.0f); break; case EDITOR_MENU_BIAS_N_100 : biasSelection(-100.0f); break; case EDITOR_MENU_BIAS_N_1000: biasSelection(-1000.0f); break; case EDITOR_MENU_INTERPOLATION : onInterpolation(); break; case EDITOR_MENU_ENTER_CURRENT_V : onEnterCurrentValue(); break; // View case EDITOR_MENU_PLAY : onPlay(); break; case EDITOR_MENU_ROWS_UP : onRowStep(-highlightRowStep , NO_SELECTION); break; case EDITOR_MENU_ROWS_DOWN : onRowStep(highlightRowStep , NO_SELECTION); break; case EDITOR_MENU_ROWS_2X_UP : onRowStep(-highlightRowStep * 2 , NO_SELECTION); break; case EDITOR_MENU_ROWS_2X_DOWN : onRowStep(highlightRowStep * 2 , NO_SELECTION); break; case EDITOR_MENU_PREV_BOOKMARK : onBookmarkDir(ARROW_UP, NO_SELECTION); break; case EDITOR_MENU_NEXT_BOOKMARK : onBookmarkDir(ARROW_DOWN, NO_SELECTION); break; case EDITOR_MENU_FIRST_TRACK : onTrackSide(ARROW_LEFT, true, NO_SELECTION); break; case EDITOR_MENU_LAST_TRACK : onTrackSide(ARROW_RIGHT, true, NO_SELECTION); break; case EDITOR_MENU_PREV_KEY : onPrevNextKey(true, NO_SELECTION); break; case EDITOR_MENU_NEXT_KEY : onPrevNextKey(false, NO_SELECTION); break; case EDITOR_MENU_FOLD_TRACK : onFoldTrack(true); break; case EDITOR_MENU_UNFOLD_TRACK : onFoldTrack(false); break; case EDITOR_MENU_FOLD_GROUP : onFoldGroup(true); break; case EDITOR_MENU_UNFOLD_GROUP : onFoldGroup(false); break; case EDITOR_MENU_TOGGLE_BOOKMARK : onToggleBookmark(); break; case EDITOR_MENU_CLEAR_BOOKMARKS : onClearBookmarks(); break; case EDITOR_MENU_TAB : onTab(); break; } Editor_update(); }
SyntroReview::SyntroReview(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); layoutWindow(); restoreWindowState(); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout())); connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int))); connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup())); connect(ui.actionCFSSelection, SIGNAL(triggered()), this, SLOT(onCFSSelection())); connect(ui.actionAudioSetup, SIGNAL(triggered()), this, SLOT(onAudioSetup())); ui.actionOpen->setEnabled(false); ui.actionClose->setEnabled(false); ui.actionCFSSelection->setEnabled(false); SyntroUtils::syntroAppInit(); m_audioSize = -1; m_audioRate = -1; m_audioChannels = -1; #if defined(Q_OS_OSX) || defined(Q_OS_WIN32) m_audioOut = NULL; m_audioOutDevice = NULL; #else m_audioOutIsOpen = false; #endif QSettings *settings = SyntroUtils::getSettings(); settings->beginGroup(AUDIO_GROUP); if (!settings->contains(AUDIO_OUTPUT_DEVICE)) #ifdef Q_OS_OSX settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE_MAC); #else #ifdef Q_OS_LINUX settings->setValue(AUDIO_OUTPUT_DEVICE, 0); if (!settings->contains(AUDIO_OUTPUT_CARD)) settings->setValue(AUDIO_OUTPUT_CARD, 0); #else settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE); #endif #endif if (!settings->contains(AUDIO_ENABLE)) settings->setValue(AUDIO_ENABLE, true); m_audioEnabled = settings->value(AUDIO_ENABLE).toBool(); settings->endGroup(); delete settings; m_client = new ReviewClient(this); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen())); connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(onClose())); connect(m_client, SIGNAL(newDirectory(QStringList)), this, SLOT(newDirectory(QStringList)), Qt::QueuedConnection); connect(m_client, SIGNAL(showImage(QImage, QByteArray, unsigned int, QDateTime)), this, SLOT(showImage(QImage, QByteArray, unsigned int, QDateTime)), Qt::QueuedConnection); connect(m_client, SIGNAL(newAudio(QByteArray, int, int, int)), this, SLOT(newAudio(QByteArray, int, int, int))); connect(m_client, SIGNAL(newCFSState(int)), this, SLOT(newCFSState(int)), Qt::QueuedConnection); connect(m_client, SIGNAL(newFileLength(unsigned int)), this, SLOT(newFileLength(unsigned int)), Qt::QueuedConnection); connect(this, SIGNAL(openFile(QString)), m_client, SLOT(openFile(QString)), Qt::QueuedConnection); connect(this, SIGNAL(closeFile()), m_client, SLOT(closeFile()), Qt::QueuedConnection); connect(this, SIGNAL(setPlayMode(int, bool)), m_client, SLOT(setPlayMode(int, bool)), Qt::QueuedConnection); connect(m_client, SIGNAL(newPlayMode(int)), this, SLOT(newPlayMode(int)), Qt::QueuedConnection); connect(this, SIGNAL(setFrameIndex(unsigned int, int, bool)), m_client, SLOT(setFrameIndex(unsigned int, int, bool)), Qt::QueuedConnection); connect(m_client, SIGNAL(dirResponse(QStringList)), this, SLOT(dirResponse(QStringList))); connect(this, SIGNAL(requestDir()), m_client, SLOT(requestDir())); connect(this, SIGNAL(newCFSList()), m_client, SLOT(newCFSList())); m_client->resumeThread(); m_statusTimer = startTimer(2000); m_directoryTimer = startTimer(10000); setWindowTitle(QString("%1 - %2") .arg(SyntroUtils::getAppType()) .arg(SyntroUtils::getAppName())); setDisabledPlayControls(); }
void ABoxDlg::onBmpOpen( wxMouseEvent& event ) { wxCommandEvent cmdEvent; onOpen(cmdEvent); }
MainWindow::MainWindow(MainController& ctrl, QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , mController(ctrl) , mCurrentBodyWidget(0) , mIsTerminated(false) { irr::IrrlichtDevice* device = 0; ui->setupUi(this); /* Configure Irrlicht */ mIrrlichtWidget = new IrrlichtWidget(mController.getConfiguration().getGraphicsConfiguration(), ui->irrlichtContainer); ui->irrlichtLayout->addWidget(mIrrlichtWidget); device = mIrrlichtWidget->getIrrlichtDevice(); Engine::PlanetariumEngine* engine = mController.createEngine(device); mIrrlichtWidget->setEngine(engine); onNewCamera(); /* Add label to the status bar */ mStatusLabel = new QLabel(ui->statusBar); ui->statusBar->addWidget(mStatusLabel); /* Set status bar message */ mStatusLabel->setText(tr("Uninitialized")); /* Set initial values */ ui->speedSpin->setValue(ctrl.getSpeed()); ui->stepSpin->setValue(ctrl.getStep()); ui->scaleSpinBox->setValue(ctrl.getEngine()->getScale()); /* Connect GUI to controller */ // menu actions connect(ui->quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(onPreferences())); connect(ui->openAction, SIGNAL(triggered()), this, SLOT(onOpen())); connect(ui->actionStart, SIGNAL(triggered()), this, SLOT(onPlayTriggered())); connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(onStopTriggered())); // spin buttons connect(ui->speedSpin, SIGNAL(valueChanged(double)), &ctrl, SLOT(setSpeed(double))); connect(ui->stepSpin, SIGNAL(valueChanged(double)), &ctrl, SLOT(setStep(double))); connect(ui->scaleSpinBox, SIGNAL(valueChanged(double)), ctrl.getEngine(), SLOT(setScale(double))); connect(ui->xCamPos, SIGNAL(valueChanged(double)), this, SLOT(onCameraPositionChanged(double))); connect(ui->yCamPos, SIGNAL(valueChanged(double)), this, SLOT(onCameraPositionChanged(double))); connect(ui->zCamPos, SIGNAL(valueChanged(double)), this, SLOT(onCameraPositionChanged(double))); // control buttons connect(ui->playButton, SIGNAL(clicked()), this, SLOT(onPlayTriggered())); connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(onStopTriggered())); // List connect(ui->objectList, SIGNAL(currentRowChanged(int)), this, SLOT(onListSelectionChanged(int))); /* Connect controller event */ connect(&ctrl, SIGNAL(simulationStateChanged()), this, SLOT(simulationStateChanged())); connect(&ctrl, SIGNAL(model_updated()), this, SLOT(onSimulationUpdate())); connect(engine, SIGNAL(newCamera()), this, SLOT(onNewCamera())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { //Create central widget and set main layout wgtMain_ = new QWidget(this); lytMain_ = new QGridLayout(wgtMain_); wgtMain_->setLayout(lytMain_); setCentralWidget(wgtMain_); //Crear el menu //Menu Archivo mnuArchivo_ = new QMenu("Archivo"); menuBar()->addMenu(mnuArchivo_); actAbrir_ = new QAction ("Abrir", this); mnuArchivo_ ->addAction(actAbrir_); mnuRecent_ = new QMenu ("Archivos Recientes", this); mnuArchivo_ ->addMenu(mnuRecent_); actStreaming_ = new QAction ("Reproducir Streaming", this); mnuArchivo_ ->addAction(actStreaming_); //Menu Ver mnuVer_ = new QMenu("Ver"); menuBar()->addMenu(mnuVer_); actFullScreen_ = new QAction ("Full Screen", this); mnuVer_ ->addAction(actFullScreen_); actMetaData_ = new QAction ("Metadata", this); mnuVer_ ->addAction(actMetaData_); //Initialize widgets mediaPlayer_ = new QMediaPlayer(this); playerSlider_ = new QSlider(Qt::Horizontal, this); videoWidget_ = new QVideoWidget(this); volumeSlider_ = new QSlider(Qt::Horizontal, this); btnOpen_ = new QToolButton(this); btnPlay_ = new QToolButton(this); btnPause_ = new QToolButton(this); btnStop_ = new QToolButton(this); //Setup widwgets videoWidget_->setMinimumSize(400, 400); mediaPlayer_->setVideoOutput(videoWidget_); mediaPlayer_->setVolume(75); videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio); volumeSlider_->setRange(0, 100); volumeSlider_->setSliderPosition(75); //Populate grid layout lytMain_->addWidget(videoWidget_, 0, 0, 1, 5); lytMain_->addWidget(playerSlider_, 1, 0, 1, 5); lytMain_->addWidget(btnOpen_, 2, 0, 1, 1); lytMain_->addWidget(btnPlay_, 2, 1, 1, 1); lytMain_->addWidget(btnPause_, 2, 2, 1, 1); lytMain_->addWidget(btnStop_, 2, 3, 1, 1); lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1); //Buttons icons btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png"))); btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png"))); btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png"))); btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png"))); //Connections connect(btnOpen_, SIGNAL(pressed()), this, SLOT(onOpen())); connect(btnPlay_, SIGNAL(pressed()), mediaPlayer_, SLOT(play())); connect(btnPause_, SIGNAL(pressed()), mediaPlayer_, SLOT(pause())); connect(btnStop_, SIGNAL(pressed()), mediaPlayer_, SLOT(stop())); connect(playerSlider_, SIGNAL(sliderReleased()), this, SLOT(onSeek())); connect(mediaPlayer_, SIGNAL(durationChanged(qint64)), this, SLOT(onDurationChanged(qint64))); connect(mediaPlayer_, SIGNAL(positionChanged(qint64)), this, SLOT(onPositionChanged(qint64))); connect(volumeSlider_, SIGNAL(sliderMoved(int)), this, SLOT(onVolumeChanged(int))); //***** connect(actAbrir_, SIGNAL(triggered()), this, SLOT(onOpen())); connect(actMetaData_ , SIGNAL(triggered()), this, SLOT(onMetaData())); connect(mnuRecent_, SIGNAL(triggered(QAction*)), this, SLOT(onRecentFiles(QAction*))); connect(actFullScreen_, SIGNAL(triggered()), this, SLOT(onFullScreen())); connect(actStreaming_, SIGNAL(triggered()), this, SLOT(onStreaming())); videoWidget_->installEventFilter(this); //Instalar el event filter a este widget }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { //Create central widget and set main layout wgtMain_ = new QWidget(this); lytMain_ = new QGridLayout(wgtMain_); wgtMain_->setLayout(lytMain_); setCentralWidget(wgtMain_); //Initialize widgets mediaPlayer_ = new QMediaPlayer(this); playerSlider_ = new QSlider(Qt::Horizontal, this); videoWidget_ = new QVideoWidget(this); //volumeSlider_ = new QSlider(Qt::Horizontal, this); volumeSlider_ = new QSlider(Qt::Vertical,this); btnOpen_ = new QToolButton(this); btnPlay_ = new QToolButton(this); btnPause_ = new QToolButton(this); btnStop_ = new QToolButton(this); btnMinimizar_ = new QToolButton(this); //botones nuevos para las tareas btnAleatoria_ = new QToolButton(this); btnBucle_ = new QToolButton(this); //Sliders para el brillo, contraste y saturación brightnessSlider_ = new QSlider(Qt::Vertical); contrastSlider_ = new QSlider(Qt::Vertical); saturavionSlider_ = new QSlider(Qt::Vertical); //Setup widwgets videoWidget_->setMinimumSize(600, 400); mediaPlayer_->setVideoOutput(videoWidget_); mediaPlayer_->setVolume(50); videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio); volumeSlider_->setRange(0, 100); volumeSlider_->setSliderPosition(100); //Populate grid layout lytMain_->addWidget(videoWidget_, 0, 0, 1, 5); lytMain_->addWidget(playerSlider_, 1, 0, 1, 5); lytMain_->addWidget(btnOpen_, 2, 0, 1, 1); lytMain_->addWidget(btnPlay_, 2, 1, 1, 1); lytMain_->addWidget(btnPause_, 2, 2, 1, 1); lytMain_->addWidget(btnStop_, 2, 3, 1, 1); lytMain_->addWidget(btnMinimizar_, 0, 5, 1, 1); //botones nuevos lytMain_->addWidget(btnAleatoria_, 2,4,1,1); lytMain_->addWidget(btnBucle_, 2,5,1,1); lytMain_->addWidget(volumeSlider_, 2, 6, 1, 1); //Buttons icons btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png"))); btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png"))); btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png"))); btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png"))); btnMinimizar_->setIcon(QIcon(QPixmap(":/icons/resources/minimizar.png"))); //Buttons nuevos tareas icons btnAleatoria_->setIcon(QIcon(QPixmap(":/icons/resources/aleatoria.jpg"))); btnBucle_->setIcon(QIcon(QPixmap(":/icons/resources/repetir.jpg"))); //menu principal main_menu_= new QMenuBar(this); menu_archivo_= new QMenu ("Archivo", this); main_menu_->addMenu(menu_archivo_); setMenuBar(main_menu_); menu_ver_ = new QMenu ("Ver", this); main_menu_->addMenu(menu_ver_); setMenuBar(main_menu_); //Abrir Abrir_ = new QAction("Abrir", this); menu_archivo_->addAction(Abrir_); //Recientes Recientes_ = new QAction("Reciente", this); menu_archivo_->addAction(Recientes_); lista_recientes_ = new QListWidget(); Cerrar_Recientes_ = new QAction("Cerrar Recientes", this); //rrecientes_ = new QMenu(tr("Recientes"),this); //rrecientes_->addAction(Recientes_); //menu_archivo_->addMenu(rrecientes_); menu_archivo_->addAction(Cerrar_Recientes_); Cargar_Lista_Reproduccion_ = new QAction("Cargar Lista",this); menu_archivo_->addAction(Cargar_Lista_Reproduccion_); this->setWindowIcon(QIcon(QPixmap(":/icons/resources/repro.png"))); playlist_ = new QMediaPlaylist(); //Ayuda Ayuda_ = new QAction("Ayuda", this); menu_archivo_->addAction(Ayuda_); menu_editar_ = new QMenu("Editar", this); main_menu_->addMenu(menu_editar_); Editar_ = new QAction("Imagen", this); menu_editar_->addAction(Editar_); //Ver pantalla completa Ver_pantalla_completa_ = new QAction("Ver_completa", this); Metadatas_ = new QAction("Metadata", this); menu_ver_->addAction(Ver_pantalla_completa_); menu_ver_->addAction(Metadatas_); // pantalla_completa_deshacer_ = new QAction(this); // pantalla_completa_deshacer_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); //salir de marcha Salir_ = new QAction("Salir", this); menu_archivo_->addAction(Salir_); //Connections connect(btnOpen_, SIGNAL(pressed()), this, SLOT(onOpen())); connect(btnPlay_, SIGNAL(pressed()), mediaPlayer_, SLOT(play())); connect(btnPause_, SIGNAL(pressed()), mediaPlayer_, SLOT(pause())); connect(btnStop_, SIGNAL(pressed()), mediaPlayer_, SLOT(stop())); connect(playerSlider_, SIGNAL(sliderReleased()), this, SLOT(onSeek())); connect(mediaPlayer_, SIGNAL(durationChanged(qint64)), this, SLOT(onDurationChanged(qint64))); connect(mediaPlayer_, SIGNAL(positionChanged(qint64)), this, SLOT(onPositionChanged(qint64))); connect(volumeSlider_, SIGNAL(sliderMoved(int)), this, SLOT(onVolumeChanged(int))); //Connections NEW BUTTONS connect(btnBucle_, SIGNAL(pressed()), this, SLOT(Bucle())); connect(btnAleatoria_, SIGNAL(pressed()), this, SLOT(Aleatoria())); //boton minimizado connect(btnMinimizar_, SIGNAL(pressed()), this, SLOT(Minimizar())); //SLIDERS CONTRASTE SATURACION y BRILLO connect(contrastSlider_, SIGNAL(sliderMoved(int)), videoWidget_, SLOT(setContrast(int))); connect(saturavionSlider_, SIGNAL(sliderMoved(int)), videoWidget_, SLOT(setSaturation(int))); connect(brightnessSlider_, SIGNAL(sliderMoved(int)), videoWidget_, SLOT(setBrightness(int))); connect(Editar_, SIGNAL(triggered()), this, SLOT(Ver_controles_edicion()) ); //menu archivo connect(Abrir_, SIGNAL(triggered()), this, SLOT(Abrir())); connect(Recientes_, SIGNAL(triggered()), this, SLOT(Recientes_leer())); connect(Cerrar_Recientes_, SIGNAL(triggered()), this, SLOT(Cerrar_Recientes())); connect(Cargar_Lista_Reproduccion_,SIGNAL(triggered()), this, SLOT(Cargar_lista_reproduccion())); connect(Salir_, SIGNAL(triggered()), this, SLOT(Salir())); //menu ver pantalla completa connect(Ver_pantalla_completa_, SIGNAL(triggered()), this, SLOT(Pantalla_completa())); //connect(pantalla_completa_deshacer_, SIGNAL(pressed()), this, SLOT(Deshacer_pantalla_completa())); //METADATA connect(Metadatas_, SIGNAL(triggered()), this, SLOT(Ver_metadatos())); }
/** Constructor @param parent */ QtSpacescapeMainWindow::QtSpacescapeMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::QtSpacescapeUI), mFilename(""), mLastExportDir(""), mLastOpenDir(""), mLastSaveDir(""), mRefreshing(false) { // setup the ui ui->setupUi(this); // set the property manager to a variant type (changable/editable - not read only) mPropertyManager = new QtVariantPropertyManager(); QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory(); ui->layerProperties->setFactoryForManager(mPropertyManager, variantFactory); ui->layerProperties->setPropertiesWithoutValueMarked(true); // we want the little arrows on root properties to indicate they're expandable ui->layerProperties->setRootIsDecorated(true); // set us as a progress listener ui->ogreWindow->setProgressListener(this); // add a signal for when properties are changed connect(mPropertyManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)), this, SLOT(valueChanged(QtProperty *, const QVariant &))); // add a signal to detect when layer items change so we can update status bar // with a tip connect(ui->layerProperties, SIGNAL(currentItemChanged(QtBrowserItem*)), this,SLOT(currentItemChanged(QtBrowserItem*))); // add a signal for when the open menu item is selected connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(onOpen())); // add a signal for when the save menu item is selected connect(ui->action_Save, SIGNAL(triggered()), this, SLOT(onSave())); // add a signal for when the save menu item is selected connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(onSaveAs())); // add a signal for when the about menu item is selected connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout())); mPropertyTitles["destBlendFactor"] = QString("Dest Blend Factor"); mPropertyTitles["ditherAmount"] = QString("Dither Amount"); mPropertyTitles["farColor"] = QString("Far Color"); mPropertyTitles["gain"] = QString("Gain"); mPropertyTitles["innerColor"] = QString("Inner Color"); mPropertyTitles["lacunarity"] = QString("Lacunarity"); mPropertyTitles["maskEnabled"] = QString("Mask Enabled"); mPropertyTitles["maskGain"] = QString("Mask Gain"); mPropertyTitles["maskInnerColor"] = QString("Mask Inner Color"); mPropertyTitles["maskLacunarity"] = QString("Mask Lacunarity"); mPropertyTitles["maskNoiseType"] = QString("Mask Noise Type"); mPropertyTitles["maskOffset"] = QString("Mask Offset"); mPropertyTitles["maskOctaves"] = QString("Mask Octaves"); mPropertyTitles["maskOuterColor"] = QString("Mask Outer Color"); mPropertyTitles["maskPower"] = QString("Mask Power"); mPropertyTitles["maskScale"] = QString("Mask Noise Scale"); mPropertyTitles["maskSeed"] = QString("Mask Random Seed"); mPropertyTitles["maskThreshold"] = QString("Mask Threshold"); mPropertyTitles["maxSize"] = QString("Max Billboard Size"); mPropertyTitles["minSize"] = QString("Min Billboard Size"); mPropertyTitles["name"] = QString("Layer Name"); mPropertyTitles["nearColor"] = QString("Near Color"); mPropertyTitles["noiseType"] = QString("Noise Type"); mPropertyTitles["numBillboards"] = QString("Number of Billboards"); mPropertyTitles["numPoints"] = QString("Number of Points"); mPropertyTitles["octaves"] = QString("Octaves"); mPropertyTitles["offset"] = QString("Noise Offset"); mPropertyTitles["outerColor"] = QString("Outer Color"); mPropertyTitles["pointSize"] = QString("Point Size"); mPropertyTitles["powerAmount"] = QString("Power"); mPropertyTitles["previewTextureSize"] = QString("Preview Texture Size"); mPropertyTitles["texture"] = QString("Billboard Texture"); mPropertyTitles["type"] = QString("Layer Type"); mPropertyTitles["scale"] = QString("Noise Scale"); mPropertyTitles["seed"] = QString("Random Seed"); mPropertyTitles["shelfAmount"] = QString("Threshold"); mPropertyTitles["sourceBlendFactor"] = QString("Source Blend Factor"); mPropertyTitles["visible"] = QString("Layer Visible"); }
// event methods virtual void onOpenRead() { onOpen(); }
void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key) { LLSD combined_key = key; combined_key[PARAM_SUB_PANEL_NAME] = panel_name; onOpen(combined_key); }
virtual void onOpenWrite() { onOpen(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { //Create central widget and set main layout wgtMain_ = new QWidget(this); lytMain_ = new QGridLayout(wgtMain_); wgtMain_->setLayout(lytMain_); setCentralWidget(wgtMain_); //Initialize widgets mediaPlayer_ = new QMediaPlayer(this); // Objeto que se encarga del video playerSlider_ = new QSlider(Qt::Horizontal, this); // Barra de tiempo de reproducción videoWidget_ = new QVideoWidget(this); // Recuadro negro de vídeo volumeSlider_ = new QSlider(Qt::Horizontal, this); // Barra de volumen btnOpen_ = new QToolButton(this); btnPlay_ = new QToolButton(this); btnPause_ = new QToolButton(this); btnStop_ = new QToolButton(this); //Setup widwgets videoWidget_->setMinimumSize(400, 400); mediaPlayer_->setVideoOutput(videoWidget_); // Añadir el recuadro al reproductor mediaPlayer_->setVolume(100); videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio); volumeSlider_->setRange(0, 100); volumeSlider_->setSliderPosition(100); //Populate grid layout lytMain_->addWidget(videoWidget_, 0, 0, 1, 5); lytMain_->addWidget(playerSlider_, 1, 0, 1, 5); lytMain_->addWidget(btnOpen_, 2, 0, 1, 1); lytMain_->addWidget(btnPlay_, 2, 1, 1, 1); lytMain_->addWidget(btnPause_, 2, 2, 1, 1); lytMain_->addWidget(btnStop_, 2, 3, 1, 1); lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1); //Buttons icons btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png"))); btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png"))); btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png"))); btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png"))); //Connections connect(btnOpen_, SIGNAL(pressed()), this, SLOT(onOpen())); connect(btnPlay_, SIGNAL(pressed()), mediaPlayer_, SLOT(play())); connect(btnPause_, SIGNAL(pressed()), mediaPlayer_, SLOT(pause())); connect(btnStop_, SIGNAL(pressed()), mediaPlayer_, SLOT(stop())); connect(playerSlider_, SIGNAL(sliderReleased()), this, SLOT(onSeek())); connect(mediaPlayer_, SIGNAL(durationChanged(qint64)), this, SLOT(onDurationChanged(qint64))); connect(mediaPlayer_, SIGNAL(positionChanged(qint64)), this, SLOT(onPositionChanged(qint64))); connect(volumeSlider_, SIGNAL(sliderMoved(int)), this, SLOT(onVolumeChanged(int))); // Inicializamos los elementos del menú mainMenu_ = new QMenuBar(this); mnuArchivo_ = new QMenu(tr("&Archivo"), this); mnuVer_ = new QMenu(tr("&Ver"), this); mnuAyuda_ = new QMenu(tr("&Ayuda"), this); mnuStreaming_ = new QMenu(tr("&Streaming"), this); // Añadimos los elementos al menú mainMenu_->addMenu(mnuArchivo_); mainMenu_->addMenu(mnuVer_); mainMenu_->addMenu(mnuAyuda_); mainMenu_->addMenu(mnuStreaming_); // Inicializamos acciones de los elementos del menú // Añadimos las acciones a los elementos // Añadimos los shortcuts correspondientes actArchivoAbrir_ = new QAction(tr("Abrir..."), this); actArchivoAbrir_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); mnuArchivo_->addAction(actArchivoAbrir_); mnuArchivoRecientes_ = new QMenu(tr("Recientes"), this); mnuArchivo_->addMenu(mnuArchivoRecientes_); actVerMetadatos_ = new QAction(tr("Metadatos"), this); mnuVer_->addAction(actVerMetadatos_); actVerPantallaCompleta_ = new QAction(tr("Pantalla completa"), this); actVerPantallaCompleta_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); mnuVer_->addAction(actVerPantallaCompleta_); actAyudaAcercaDe_ = new QAction(tr("Acerca de"), this); mnuAyuda_->addAction(actAyudaAcercaDe_); actStreamingReproducir_ = new QAction(tr("Reproducir fuente"), this); mnuStreaming_->addAction(actStreamingReproducir_); // Añadir barra de menús a la ventana setMenuBar(mainMenu_); // Conexiones del menú connect(actArchivoAbrir_, SIGNAL(triggered()), this, SLOT(onOpen())); connect(actVerPantallaCompleta_, SIGNAL(triggered()), this, SLOT(pantallaCompleta())); connect(actVerMetadatos_, SIGNAL(triggered()), this, SLOT(showMetadata())); connect(actAyudaAcercaDe_, SIGNAL(triggered()), this, SLOT(alAcercade())); connect(actStreamingReproducir_, SIGNAL(triggered()), this, SLOT(alStreaming())); // Hace que funcione el eventfilter videoWidget_->installEventFilter(this); // Mostramos el historial de recientes this->alRecientes(); // Inicializamos una fuente de streaming por defecto maximaFM_ = "http://208.92.53.87:80/MAXIMAFM"; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { //Create central widget and set main layout //Centra ventana wgtMain_ = new QWidget(this);//Estam la ventana principal lytMain_ = new QGridLayout(wgtMain_);//Permite dividir el espacio y añadir elementos (ver matriz) wgtMain_->setLayout(lytMain_); setCentralWidget(wgtMain_); //Initialize widgets mediaPlayer_ = new QMediaPlayer(this); playerSlider_ = new QSlider(Qt::Horizontal, this);//Indicamos si es vertical u horizontal videoWidget_ = new QVideoWidget(this); volumeSlider_ = new QSlider(Qt::Horizontal, this); btnOpen_ = new QToolButton(this); btnPlay_ = new QToolButton(this); btnPause_ = new QToolButton(this); btnStop_ = new QToolButton(this); //Setup widwgets videoWidget_->setMinimumSize(400, 400);//Cuadro negro definimos el tamaño para verlo mediaPlayer_->setVideoOutput(videoWidget_);//Objeto de decodificacion del video mediaPlayer_->setVolume(100); videoWidget_->setAspectRatioMode(Qt::KeepAspectRatio);//Redimensionar se establezca volumeSlider_->setRange(0, 100);//El volumen volumeSlider_->setSliderPosition(100);//Colocacion del slider //Populate grid layout lytMain_->addWidget(videoWidget_, 0, 0, 1, 5);//Coordenadas (ultimo fila y columna te espandes) lytMain_->addWidget(playerSlider_, 1, 0, 1, 5); lytMain_->addWidget(btnOpen_, 2, 0, 1, 1); lytMain_->addWidget(btnPlay_, 2, 1, 1, 1); lytMain_->addWidget(btnPause_, 2, 2, 1, 1); lytMain_->addWidget(btnStop_, 2, 3, 1, 1); lytMain_->addWidget(volumeSlider_, 2, 4, 1, 1); //Buttons icons btnOpen_->setIcon(QIcon(QPixmap(":/icons/resources/eject.png"))); btnPause_->setIcon(QIcon(QPixmap(":/icons/resources/pause.png"))); btnPlay_->setIcon(QIcon(QPixmap(":/icons/resources/play.png"))); btnStop_->setIcon(QIcon(QPixmap(":/icons/resources/stop.png"))); //Menu mainMenu_= new QMenuBar(this); //Archivo mnuArchivo_ = new QMenu (tr("&Archivo"), this);//Especificamos el texto del menu mainMenu_-> addMenu(mnuArchivo_); mnuArchivoRecientes_ = new QMenu (tr("&Recientes"), this); mnuArchivo_-> addMenu(mnuArchivoRecientes_); //abrir actArchivoAbrir_ = new QAction(QIcon(":/icons/resources/eject.png"),tr("&Abrir"),this); actArchivoAbrir_-> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A)); //Ver mnuVer_ = new QMenu(tr("&Ver"), this); mainMenu_-> addMenu(mnuVer_); //PantallaCompleta actVerCompleta_= new QAction (tr("&Pantalla Completa"),this); actVerCompleta_-> setShortcut(QKeySequence(Qt::ALT + Qt::Key_F)); //Metadatos actMetadatos_=new QAction(tr("&Metadados"),this); //Ayuda mnuAyuda_ = new QMenu(tr("&Ayuda"), this); mainMenu_->addMenu(mnuAyuda_); //Acercade actAyudaAcerca_=new QAction(tr("&Acerca de"), this); //add acciones mnuArchivo_->addAction(actArchivoAbrir_); mnuAyuda_->addAction(actAyudaAcerca_); mnuVer_->addAction(actVerCompleta_); mnuVer_->addAction(actMetadatos_); //Colocacion de elementos //le decimos donde colocarse la barra del menu y la de herramientas setMenuBar(mainMenu_); //Connections connect(btnOpen_, SIGNAL(pressed()), this, SLOT(onOpen())); connect(btnPlay_, SIGNAL(pressed()), mediaPlayer_, SLOT(play())); connect(btnPause_, SIGNAL(pressed()), mediaPlayer_, SLOT(pause())); connect(btnStop_, SIGNAL(pressed()), mediaPlayer_, SLOT(stop())); connect(playerSlider_, SIGNAL(sliderReleased()), this, SLOT(onSeek())); connect(mediaPlayer_, SIGNAL(durationChanged(qint64)), this, SLOT(onDurationChanged(qint64))); connect(mediaPlayer_, SIGNAL(positionChanged(qint64)), this, SLOT(onPositionChanged(qint64))); connect(volumeSlider_, SIGNAL(sliderMoved(int)), this, SLOT(onVolumeChanged(int))); connect(actArchivoAbrir_, SIGNAL(triggered()),this, SLOT (onOpen())); connect(actAyudaAcerca_, SIGNAL(triggered()), this, SLOT (acerca())); connect(actVerCompleta_,SIGNAL(triggered()),this,SLOT (pantallaCompleta())); connect(actMetadatos_,SIGNAL(triggered()),this,SLOT(metadatos())); }