void Window_Shop::onCloseClick(){ closeWindow(); }
void Widget::initUI() { this->setFixedSize(900, 600);//设定尺寸 this->setWindowTitle(tr("Chaos"));//设定标题 this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute(Qt::WA_QuitOnClose,true); this->setWindowIcon(QIcon(":/mainico")); //创建托盘 QSystemTrayIcon *system_tray = new QSystemTrayIcon(); system_tray ->setIcon(QIcon(":/mainico")); system_tray->setToolTip("chaos"); //创建托盘菜单 QMenu *contexmenu=new QMenu(this); //注意右键菜单的父对象,在窗口销毁后要把菜单也销毁掉 QAction *shut=new QAction("quit",this); shut->setIcon(QIcon(":/close.ico")); //菜单中动作 contexmenu->addAction(shut); system_tray->setContextMenu(contexmenu); //显示托盘 system_tray->show(); connect(shut,SIGNAL(triggered()),this,SLOT(closeWindow()));//右击退出程序 connect(system_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(showWindow(QSystemTrayIcon::ActivationReason))); //背景图片 QPixmap pixmap = QPixmap(":/bc.jpg").scaled(this->size()); QPalette palette(this->palette()); palette.setBrush(QPalette::Background, QBrush(pixmap)); this->setPalette(palette); //播放按钮 btn1=new QPushButton(this); btn1->setText("playvideo"); btn1->move(700,50); btn1->setObjectName("mainbtn"); connect(btn1, SIGNAL(clicked()), this, SLOT(playVideo()));//建造一个button 并初始化click事件 //关闭按钮 btn2=new QPushButton(this); btn2->setText("close"); btn2->move(btn1->x(),btn1->y()+50); btn2->setObjectName("mainbtn"); connect(btn2, SIGNAL(clicked()), this, SLOT(closeWindow()));//建造一个button 并初始化click事件 //最小化到托盘 btn3=new QPushButton(this); btn3->setText("minimize"); btn3->move(btn2->x(),btn2->y()+50); btn3->setObjectName("mainbtn"); connect(btn3, SIGNAL(clicked()), this, SLOT(hideWindow()));//建造一个button 并初始化click事件 bar1=new QProgressBar(this); bar1->setObjectName("mybar"); bar1->move(this->x()+100,this->height()-100); bar1->setValue(50); list1=new QListView(this); list1->move(50,100); list1->setObjectName("mylist"); QStringList user; user += "first"; user +="second"; QStringListModel *model = new QStringListModel(user); list1->setModel(model); //useList是个QListView user += "third"; model->setStringList(user); vdo=new videowidget();//实例化弹出窗口 }
bool PopupWindow::onProcessMessage(Message* msg) { switch (msg->type()) { case kCloseMessage: stopFilteringMessages(); break; case kMouseLeaveMessage: if (m_hotRegion.isEmpty() && !isMoveable()) closeWindow(NULL); break; case kKeyDownMessage: if (m_filtering) { KeyMessage* keymsg = static_cast<KeyMessage*>(msg); KeyScancode scancode = keymsg->scancode(); if (scancode == kKeyEsc || scancode == kKeyEnter || scancode == kKeyEnterPad) { closeWindow(NULL); } // If we are filtering messages we don't propagate key-events // to other widgets. As we're a popup window and we're // filtering messages, the user shouldn't be able to start // other actions pressing keyboard shortcuts. return false; } break; case kMouseDownMessage: if (m_filtering) { gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position(); switch (m_clickBehavior) { // If the user click outside the window, we have to close // the tooltip window. case kCloseOnClickInOtherWindow: { Widget* picked = pick(mousePos); if (!picked || picked->getRoot() != this) { closeWindow(NULL); } break; } case kCloseOnClickOutsideHotRegion: if (!m_hotRegion.contains(mousePos)) { closeWindow(NULL); } break; } } break; case kMouseMoveMessage: if (!isMoveable() && !m_hotRegion.isEmpty() && getManager()->getCapture() == NULL) { gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position(); // If the mouse is outside the hot-region we have to close the // window. if (!m_hotRegion.contains(mousePos)) closeWindow(NULL); } break; } return Window::onProcessMessage(msg); }
/** * Display a message box with buttons. * This function displays the specified message in a text box * centered in the screen and waits until a button is pressed. * @param p The text to be displayed * @param b NULL-terminated list of button labels */ int AgiEngine::selectionBox(const char *m, const char **b) { int numButtons = 0; int x, y, i, s; int key, active = 0; int rc = -1; int bx[5], by[5]; _noSaveLoadAllowed = true; _sprites->eraseBoth(); blitTextbox(m, -1, -1, -1); x = _game.window.x1 + 5 * CHAR_COLS / 2; y = _game.window.y2 - 5 * CHAR_LINES / 2; s = _game.window.x2 - _game.window.x1 + 1 - 5 * CHAR_COLS; debugC(3, kDebugLevelText, "selectionBox(): s = %d", s); // Automatically position buttons for (i = 0; b[i]; i++) { numButtons++; s -= CHAR_COLS * strlen(b[i]); } if (i > 1) { debugC(3, kDebugLevelText, "selectionBox(): s / %d = %d", i - 1, s / (i - 1)); s /= (i - 1); } else { x += s / 2; } for (i = 0; b[i]; i++) { bx[i] = x; by[i] = y; x += CHAR_COLS * strlen(b[i]) + s; } _sprites->blitBoth(); clearKeyQueue(); AllowSyntheticEvents on(this); debugC(4, kDebugLevelText, "selectionBox(): waiting..."); while (!(shouldQuit() || _restartGame)) { for (i = 0; b[i]; i++) _gfx->drawCurrentStyleButton(bx[i], by[i], b[i], i == active, false, i == 0); pollTimer(); key = doPollKeyboard(); switch (key) { case KEY_ENTER: rc = active; goto press; case KEY_ESCAPE: rc = -1; goto getout; case KEY_RIGHT: active++; if (active >= numButtons) active = 0; break; case KEY_LEFT: active--; if (active < 0) active = numButtons - 1; break; case BUTTON_LEFT: for (i = 0; b[i]; i++) { if (_gfx->testButton(bx[i], by[i], b[i])) { rc = active = i; goto press; } } break; case 0x09: // Tab debugC(3, kDebugLevelText, "selectionBox(): Focus change"); active++; active %= i; break; } _gfx->doUpdate(); } press: debugC(4, kDebugLevelText, "selectionBox(): Button pressed: %d", rc); getout: closeWindow(); debugC(2, kDebugLevelText, "selectionBox(): Result = %d", rc); _noSaveLoadAllowed = false; return rc; }
EnvironmentCoreApplication::~EnvironmentCoreApplication() { delete m_pCameraManager; delete m_pScene; delete m_pChSystem; closeWindow(); }
ApplicationWindow::ApplicationWindow() : QMainWindow( 0, "example application main window", WDestructiveClose ) { int id; QPixmap openIcon, saveIcon; fileTools = new QToolBar( this, "file operations" ); addToolBar( fileTools, tr( "File Operations" ), Top, TRUE ); openIcon = QPixmap( fileopen ); QToolButton * fileOpen = new QToolButton( openIcon, "Open File", QString::null, this, SLOT(load()), fileTools, "open file" ); saveIcon = QPixmap( filesave ); QToolButton * fileSave = new QToolButton( saveIcon, "Save File", QString::null, this, SLOT(save()), fileTools, "save file" ); #ifndef QT_NO_PRINTER printer = new QPrinter; QPixmap printIcon; printIcon = QPixmap( fileprint ); QToolButton * filePrint = new QToolButton( printIcon, "Print File", QString::null, this, SLOT(print()), fileTools, "print file" ); QWhatsThis::add( filePrint, filePrintText ); #endif (void)QWhatsThis::whatsThisButton( fileTools ); QWhatsThis::add( fileOpen, fileOpenText ); QWhatsThis::add( fileSave, fileSaveText ); QPopupMenu * file = new QPopupMenu( this ); menuBar()->insertItem( "&File", file ); file->insertItem( "&New", this, SLOT(newDoc()), CTRL+Key_N ); id = file->insertItem( openIcon, "&Open", this, SLOT(load()), CTRL+Key_O ); file->setWhatsThis( id, fileOpenText ); id = file->insertItem( saveIcon, "&Save", this, SLOT(save()), CTRL+Key_S ); file->setWhatsThis( id, fileSaveText ); id = file->insertItem( "Save &as...", this, SLOT(saveAs()) ); file->setWhatsThis( id, fileSaveText ); #ifndef QT_NO_PRINTER file->insertSeparator(); id = file->insertItem( printIcon, "&Print", this, SLOT(print()), CTRL+Key_P ); file->setWhatsThis( id, filePrintText ); #endif file->insertSeparator(); file->insertItem( "&Close", this, SLOT(closeWindow()), CTRL+Key_W ); file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); windowsMenu = new QPopupMenu( this ); windowsMenu->setCheckable( TRUE ); connect( windowsMenu, SIGNAL( aboutToShow() ), this, SLOT( windowsMenuAboutToShow() ) ); menuBar()->insertItem( "&Windows", windowsMenu ); menuBar()->insertSeparator(); QPopupMenu * help = new QPopupMenu( this ); menuBar()->insertItem( "&Help", help ); help->insertItem( "&About", this, SLOT(about()), Key_F1); help->insertItem( "About &Qt", this, SLOT(aboutQt())); help->insertSeparator(); help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1); QVBox* vb = new QVBox( this ); vb->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); ws = new QWorkspace( vb ); setCentralWidget( vb ); statusBar()->message( "Ready", 2000 ); }
void close(){ closeWindow(); }
void onCancel() { closeWindow(NULL); }
void GameEndBuy::onCloseClicked(CCObject* sender){ DoVoidEvent(m_lose_listener, m_lose_selector); closeWindow(); }
ossimQtSingleImageWindow::ossimQtSingleImageWindow(QWidget* parent, const char* name, Qt::WFlags f) : QMainWindow(parent, name, f), ossimConnectableObject(), ossimConnectableDisplayListener(), theImageWidget(0), theLastOpenedDirectory(), theResolutionLevelMenu(0) { ossimReferenced::ref(); setCaption("iview"); QSize size(DEFAULT_WIDTH, DEFAULT_HEIGHT); setBaseSize(size); // This set the window's widget size. setGeometry(0,0,DEFAULT_WIDTH-1,DEFAULT_HEIGHT-1); // Create the image widget parenting it to this. theImageWidget = new ossimQtScrollingImageWidget(this, "image_widget"); // This will clear out any initial garbage in the widget. theImageWidget->refresh(); // Disable random caching scheme. theImageWidget->setRandomPriorityQueueEnabledFlag(false); // Set the the width and height of the window. theImageWidget->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // Make the image widget the centralized widget. setCentralWidget(theImageWidget); // Make the "File" pull down menu. QMenu* file = new QMenu( this ); menuBar()->insertItem( "&File", file ); file->insertItem( "&Open Image", this, SLOT(openImage()), Qt::CTRL+Qt::Key_O ); file->insertItem( "&Close Image", this, SLOT(closeImage()), Qt::CTRL+Qt::Key_C ); file->insertItem( "&Export", this, SLOT(exportImage()), Qt::CTRL+Qt::Key_E ); file->insertItem( "&Quit", this, SLOT(closeWindow()), Qt::CTRL+Qt::Key_Q ); // Make the "Edit" pull down menu. QMenu* edit = new QMenu( this ); menuBar()->insertItem( "&Edit", edit ); edit->insertItem( "Image Chain", this, SLOT(editImageChain())); // Make the "Utilities" pull down menu. QMenu* utilities = new QMenu( this ); menuBar()->insertItem( "&Utilities", utilities ); utilities->insertItem( "Refresh", this, SLOT(refreshDisplay())); // Make the "Resolution_Level" pull down menu. theResolutionLevelMenu = new QMenu( this ); menuBar()->insertItem( "&Resolution_Level", theResolutionLevelMenu); QAction* rsetAct = new QAction(QString("0"), this); rsetAct->setCheckable(true); rsetAct->setChecked(true); rsetAct->setData(0); rsetAct->setEnabled(false); theResolutionLevelMenu->addAction( rsetAct ); // Connect the activated signal to the changeResolutionLevel slot. connect( theResolutionLevelMenu, SIGNAL( triggered( QAction * ) ), this, SLOT ( changeResolutionLevel( QAction * ) ) ); // Make the "Help" pull down menu. QMenu* help = new QMenu( this ); menuBar()->insertItem( "&Help", help ); help->insertItem( "&About", this, SLOT(about()), Qt::CTRL+Qt::Key_A ); // Connect up the slot to capture mouse events. connect(theImageWidget, SIGNAL(scrollingImageWidgetMouseEvent(ossimQtMouseEvent*)), this, SLOT(trackImageWidget(ossimQtMouseEvent*))); // Add us in as a listener for display events like refresh. addListener((ossimConnectableDisplayListener*)this); //--- // Connect this display up to "theImageWidget" so that event propagation // comes up the chain to us. //--- connectMyInputTo(theImageWidget); // Send a dummy message to make the status bar show. statusBar()->message( QString(" ") ); //--- // Set the last open directory to the current working dir so the open image // dialog will come up where you started. //--- theLastOpenedDirectory = getenv("PWD"); }
void onImport() { // The user don't select a sheet yet. if (!m_document) { Alert::show("Import Sprite Sheet<<Select a sprite first.||&Close"); return; } // The list of frames imported from the sheet std::vector<Image*> animation; try { Sprite* sprite = m_document->getSprite(); FrameNumber currentFrame = m_context->getActiveLocation().frame(); // As first step, we cut each tile and add them into "animation" list. for (int y=m_rect.y; y<sprite->getHeight(); y += m_rect.h) { for (int x=m_rect.x; x<sprite->getWidth(); x += m_rect.w) { base::UniquePtr<Image> resultImage(Image::create(sprite->getPixelFormat(), m_rect.w, m_rect.h)); // Clear the image with mask color. image_clear(resultImage, 0); // Render the portion of sheet. sprite->render(resultImage, -x, -y, currentFrame); animation.push_back(resultImage); resultImage.release(); } } if (animation.size() == 0) { Alert::show("Import Sprite Sheet" "<<The specified rectangle does not create any tile." "<<Select a rectangle inside the sprite region." "||&OK"); return; } // The following steps modify the sprite, so we wrap all // operations in a undo-transaction. ContextWriter writer(m_context); UndoTransaction undoTransaction(writer.context(), "Import Sprite Sheet", undo::ModifyDocument); DocumentApi api = m_document->getApi(); // Add the layer in the sprite. LayerImage* resultLayer = api.newLayer(sprite); // Add all frames+cels to the new layer for (size_t i=0; i<animation.size(); ++i) { int indexInStock; // Add the image into the sprite's stock indexInStock = api.addImageInStock(sprite, animation[i]); animation[i] = NULL; // Create the cel. base::UniquePtr<Cel> resultCel(new Cel(FrameNumber(i), indexInStock)); // Add the cel in the layer. api.addCel(resultLayer, resultCel); resultCel.release(); } // Copy the list of layers (because we will modify it in the iteration). LayerList layers = sprite->getFolder()->getLayersList(); // Remove all other layers for (LayerIterator it=layers.begin(), end=layers.end(); it!=end; ++it) { if (*it != resultLayer) api.removeLayer(*it); } // Change the number of frames api.setTotalFrames(sprite, FrameNumber(animation.size())); // Set the size of the sprite to the tile size. api.setSpriteSize(sprite, m_rect.w, m_rect.h); undoTransaction.commit(); } catch (...) { for (size_t i=0; i<animation.size(); ++i) delete animation[i]; throw; } update_screen_for_document(m_document); closeWindow(NULL); }
bool ColorShades::onProcessMessage(ui::Message* msg) { switch (msg->type()) { case ui::kOpenMessage: if (m_click == DragAndDropEntries) { // TODO This connection should be in the ContextBar m_conn = ColorBar::instance()->ChangeSelection.connect( base::Bind<void>(&ColorShades::onChangeColorBarSelection, this)); } break; case ui::kSetCursorMessage: if (hasCapture()) { ui::set_mouse_cursor(ui::kMoveCursor); return true; } else if (m_click == ClickEntries && m_hotIndex >= 0 && m_hotIndex < int(m_shade.size())) { ui::set_mouse_cursor(ui::kHandCursor); return true; } break; case ui::kMouseEnterMessage: case ui::kMouseLeaveMessage: if (!hasCapture()) m_hotIndex = -1; invalidate(); break; case ui::kMouseDownMessage: if (m_hotIndex >= 0 && m_hotIndex < int(m_shade.size())) { switch (m_click) { case ClickEntries: Click(); m_hotIndex = -1; invalidate(); break; case DragAndDropEntries: m_dragIndex = m_hotIndex; m_dropBefore = false; captureMouse(); break; } } break; case ui::kMouseUpMessage: { if (m_click == ClickWholeShade) { setSelected(true); Click(); closeWindow(); } if (m_dragIndex >= 0) { ASSERT(m_dragIndex < int(m_shade.size())); auto color = m_shade[m_dragIndex]; m_shade.erase(m_shade.begin()+m_dragIndex); if (m_hotIndex >= 0) m_shade.insert(m_shade.begin()+m_hotIndex, color); m_dragIndex = -1; invalidate(); // Relayout the context bar if we have removed an entry. if (m_hotIndex < 0) parent()->parent()->layout(); } if (hasCapture()) releaseMouse(); break; } case ui::kMouseMoveMessage: { ui::MouseMessage* mouseMsg = static_cast<ui::MouseMessage*>(msg); gfx::Point mousePos = mouseMsg->position() - bounds().origin(); gfx::Rect bounds = clientBounds(); int hot = -1; bounds.shrink(3*ui::guiscale()); if (bounds.contains(mousePos)) { int count = size(); hot = (mousePos.x - bounds.x) / (m_boxSize*ui::guiscale()); hot = MID(0, hot, count-1); } if (m_hotIndex != hot) { m_hotIndex = hot; invalidate(); } bool dropBefore = (hot >= 0 && mousePos.x < (bounds.x+m_boxSize*ui::guiscale()*hot)+m_boxSize*ui::guiscale()/2); if (m_dropBefore != dropBefore) { m_dropBefore = dropBefore; invalidate(); } break; } } return Widget::onProcessMessage(msg); }
void KCommonDecoration::menuButtonReleased() { if(closing) closeWindow(); }
void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString& s, bool isLeft) { if (s.length() > 0) { for (unsigned n=0; n < s.length(); n++) { KCommonDecorationButton *btn = 0; switch (s[n]) { case 'M': // Menu button if (!m_button[MenuButton]){ btn = createButton(MenuButton); if (!btn) break; btn->setTipText(i18n("Menu") ); btn->setRealizeButtons(LeftButton|RightButton); connect(btn, SIGNAL(pressed()), SLOT(menuButtonPressed())); connect(btn, SIGNAL(released()), this, SLOT(menuButtonReleased())); m_button[MenuButton] = btn; } break; case 'S': // OnAllDesktops button if (!m_button[OnAllDesktopsButton]){ btn = createButton(OnAllDesktopsButton); if (!btn) break; const bool oad = isOnAllDesktops(); btn->setTipText(oad?i18n("Not on all desktops"):i18n("On all desktops") ); btn->setToggleButton(true); btn->setOn( oad ); connect(btn, SIGNAL(clicked()), SLOT(toggleOnAllDesktops())); m_button[OnAllDesktopsButton] = btn; } break; case 'H': // Help button if ((!m_button[HelpButton]) && providesContextHelp()){ btn = createButton(HelpButton); if (!btn) break; btn->setTipText(i18n("Help") ); connect(btn, SIGNAL(clicked()), SLOT(showContextHelp())); m_button[HelpButton] = btn; } break; case 'I': // Minimize button if ((!m_button[MinButton]) && isMinimizable()){ btn = createButton(MinButton); if (!btn) break; btn->setTipText(i18n("Minimize") ); connect(btn, SIGNAL(clicked()), SLOT(minimize())); m_button[MinButton] = btn; } break; case 'A': // Maximize button if ((!m_button[MaxButton]) && isMaximizable()){ btn = createButton(MaxButton); if (!btn) break; btn->setRealizeButtons(LeftButton|MidButton|RightButton); const bool max = maximizeMode()==MaximizeFull; btn->setTipText(max?i18n("Restore"):i18n("Maximize") ); btn->setToggleButton(true); btn->setOn( max ); connect(btn, SIGNAL(clicked()), SLOT(slotMaximize())); m_button[MaxButton] = btn; } break; case 'X': // Close button if ((!m_button[CloseButton]) && isCloseable()){ btn = createButton(CloseButton); if (!btn) break; btn->setTipText(i18n("Close") ); connect(btn, SIGNAL(clicked()), SLOT(closeWindow())); m_button[CloseButton] = btn; } break; case 'F': // AboveButton button if (!m_button[AboveButton]){ btn = createButton(AboveButton); if (!btn) break; bool above = keepAbove(); btn->setTipText(above?i18n("Do not keep above others"):i18n("Keep above others") ); btn->setToggleButton(true); btn->setOn( above ); connect(btn, SIGNAL(clicked()), SLOT(slotKeepAbove())); m_button[AboveButton] = btn; } break; case 'B': // BelowButton button if (!m_button[BelowButton]){ btn = createButton(BelowButton); if (!btn) break; bool below = keepBelow(); btn->setTipText(below?i18n("Do not keep below others"):i18n("Keep below others") ); btn->setToggleButton(true); btn->setOn( below ); connect(btn, SIGNAL(clicked()), SLOT(slotKeepBelow())); m_button[BelowButton] = btn; } break; case 'L': // Shade button if ((!m_button[ShadeButton]) && isShadeable()){ btn = createButton(ShadeButton); if (!btn) break; bool shaded = isSetShade(); btn->setTipText(shaded?i18n("Unshade"):i18n("Shade") ); btn->setToggleButton(true); btn->setOn( shaded ); connect(btn, SIGNAL(clicked()), SLOT(slotShade())); m_button[ShadeButton] = btn; } break; case '_': // Spacer item btnContainer.append(0); } if (btn) { btn->setLeft(isLeft); btn->setSize(QSize(layoutMetric(LM_ButtonWidth, true, btn),layoutMetric(LM_ButtonHeight, true, btn)) ); btn->show(); btnContainer.append(btn); } } } }
void BaseApp::toggleFullscreen() { closeWindow(false, true); config.setBool("Fullscreen", !fullscreen); }
void SupplierManageWindow::closeWindow() { emit closeWindow(this); }
void KviMainWindow::childWindowCloseRequest(KviWindow * wnd) { closeWindow(wnd); }
void SupplierManageWindow::init() { m_model = new QSqlRelationalTableModel(0, core->database()->database()); bool r = core->databaseQuery()->suppliers(m_model); if(!r) { errorHandling(DATABASE_ERROR, core->databaseQuery()->lastErrorNumber()); return; } // int areaSize = m_model->relationModel(idArea)->rowCount(); if(!areaSize) { QMessageBox::critical(0, trUtf8("Datos incompletos"), trUtf8("Debe ingresar al menos un Rubro en:\n" "Panel General -> Rubros")); tb_add->setEnabled(false); } areaUpdateCombo(false); // proxyModel->setSourceModel(m_model); tv_supplier->setModel(proxyModel); tv_supplier->verticalHeader()->hide(); tv_supplier->horizontalHeader()->setResizeMode(Email, QHeaderView::Stretch); m_model->setHeaderData(Name, Qt::Horizontal, trUtf8("Nombre")); m_model->setHeaderData(idArea, Qt::Horizontal, trUtf8("Rubro")); m_model->setHeaderData(Address, Qt::Horizontal, trUtf8("Dirección")); m_model->setHeaderData(Location, Qt::Horizontal, trUtf8("Localidad")); m_model->setHeaderData(Phone, Qt::Horizontal, trUtf8("Teléfono")); m_model->setHeaderData(Fax, Qt::Horizontal, trUtf8("Fax")); m_model->setHeaderData(Email, Qt::Horizontal, trUtf8("Mail")); m_model->setHeaderData(ContactName, Qt::Horizontal, trUtf8("Nom. Contacto")); m_model->setHeaderData(ContactPhone, Qt::Horizontal, trUtf8("Tel. Contacto")); tv_supplier->setColumnHidden(id, true); if(m_model->rowCount() == 0) { tb_edit->setEnabled(false); tb_remove->setEnabled(false); } connect(tb_add, SIGNAL(clicked()), this, SLOT(addSupplier())); connect(tb_remove, SIGNAL(clicked()), this, SLOT(removeSupplier())); connect(tb_edit, SIGNAL(clicked()), this, SLOT(editSupplier())); connect(tv_supplier, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(editSupplier())); connect(tb_close, SIGNAL(clicked()), this, SLOT(closeWindow())); connect(le_filter, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged(const QString &))); connect(le_filter, SIGNAL(returnPressed()), this, SLOT(filterReturnPressed())); connect(tb_areaUpdateCombo, SIGNAL(clicked()), this, SLOT(areaUpdate())); connect(cb_area, SIGNAL(currentIndexChanged(int)), this, SLOT(areaComboChanged(int))); le_filter->setFocus(); }
manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrument, QWidget * _parent, vestigeInstrument * m_vi2 ) : InstrumentView( _instrument, _parent ) { m_vi = m_vi2; m_vi->m_scrollArea = new QScrollArea( this ); widget = new QWidget(this); l = new QGridLayout( this ); m_vi->m_subWindow = engine::mainWindow()->workspace()->addSubWindow(new QMdiSubWindow, Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ); m_vi->m_subWindow->setFixedWidth( 960 ); m_vi->m_subWindow->setMinimumHeight( 300 ); m_vi->m_subWindow->setWidget(m_vi->m_scrollArea); m_vi->m_subWindow->setWindowTitle( m_vi->instrumentTrack()->name() + tr( " - VST plugin control" ) ); m_vi->m_subWindow->setWindowIcon( PLUGIN_NAME::getIconPixmap( "logo" ) ); //m_vi->m_subWindow->setAttribute(Qt::WA_DeleteOnClose); l->setContentsMargins( 20, 10, 10, 10 ); l->setVerticalSpacing( 10 ); l->setHorizontalSpacing( 23 ); m_syncButton = new QPushButton( tr( "VST Sync" ), this ); connect( m_syncButton, SIGNAL( clicked() ), this, SLOT( syncPlugin() ) ); m_syncButton->setWhatsThis( tr( "Click here if you want to synchronize all parameters with VST plugin." ) ); l->addWidget( m_syncButton, 0, 0, 1, 2, Qt::AlignLeft ); m_displayAutomatedOnly = new QPushButton( tr( "Automated" ), this ); connect( m_displayAutomatedOnly, SIGNAL( clicked() ), this, SLOT( displayAutomatedOnly() ) ); m_displayAutomatedOnly->setWhatsThis( tr( "Click here if you want to display automated parameters only." ) ); l->addWidget( m_displayAutomatedOnly, 0, 1, 1, 2, Qt::AlignLeft ); m_closeButton = new QPushButton( tr( " Close " ), widget ); connect( m_closeButton, SIGNAL( clicked() ), this, SLOT( closeWindow() ) ); m_closeButton->setWhatsThis( tr( "Close VST plugin knob-controller window." ) ); l->addWidget( m_closeButton, 0, 2, 1, 7, Qt::AlignLeft ); for( int i = 0; i < 10; i++ ) { l->addItem( new QSpacerItem( 68, 45, QSizePolicy::Fixed, QSizePolicy::Fixed ), 0, i ); } const QMap<QString, QString> & dump = m_vi->m_plugin->parameterDump(); m_vi->paramCount = dump.size(); bool isVstKnobs = true; if (m_vi->vstKnobs == NULL) { m_vi->vstKnobs = new knob *[ m_vi->paramCount ]; isVstKnobs = false; } if (m_vi->knobFModel == NULL) { m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ]; } char paramStr[35]; QStringList s_dumpValues; if (isVstKnobs == false) { for( int i = 0; i < m_vi->paramCount; i++ ) { sprintf( paramStr, "param%d", i); s_dumpValues = dump[ paramStr ].split( ":" ); m_vi->vstKnobs[ i ] = new knob( knobBright_26, this, s_dumpValues.at( 1 ) ); m_vi->vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" ); m_vi->vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) ); sprintf( paramStr, "%d", i); m_vi->knobFModel[ i ] = new FloatModel( (s_dumpValues.at( 2 )).toFloat(), 0.0f, 1.0f, 0.01f, castModel<vestigeInstrument>(), tr( paramStr ) ); connect( m_vi->knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) ); m_vi->vstKnobs[i] ->setModel( m_vi->knobFModel[i] ); } } int i = 0; for( int lrow = 1; lrow < ( int( m_vi->paramCount / 10 ) + 1 ) + 1; lrow++ ) { for( int lcolumn = 0; lcolumn < 10; lcolumn++ ) { if( i < m_vi->paramCount ) { l->addWidget( m_vi->vstKnobs[i], lrow, lcolumn, Qt::AlignCenter ); } i++; } } l->setRowStretch( ( int( m_vi->paramCount / 10) + 1), 1 ); l->setColumnStretch( 10, 1 ); widget->setLayout(l); widget->setAutoFillBackground(true); m_vi->m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); m_vi->m_scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_vi->m_scrollArea->setPalette( QApplication::palette( m_vi->m_scrollArea ) ); m_vi->m_scrollArea->setMinimumHeight( 64 ); m_vi->m_scrollArea->setWidget( widget ); m_vi->m_subWindow->show(); }
void HoleModeResult::onRestart(cocos2d::CCObject *sender){ closeWindow(); DoVoidEvent(m_restartListener, m_restartSelector); }
int displayStats(char *filename) { Bool done = False; XEvent curEvent; char c; long event_mask = 0xFFFFFFFF; long nBuf = 2; int i; /* Load data */ FILE *fp = fopen(filename,"r"); if (!fp) { printf("Nothing to draw\n"); return; } fscanf(fp, "numR=%d\n", &numR); r = malloc(sizeof(float)*numR); mean_elongation = malloc(sizeof(float)*numR); mean_polarization = malloc(sizeof(float)*numR); std_elongation = malloc(sizeof(float)*numR); std_polarization = malloc(sizeof(float)*numR); for (i=0; i < numR; i++) fscanf(fp,"r=%f,mean_elongation=%f,std_elongation=%f,mean_polarization=%f,std_polarization=%f\n", &r[i],&mean_elongation[i],&std_elongation[i], &mean_polarization[i],&std_polarization[i]); fclose(fp); minr = min(r,numR); maxr = max(r,numR); minElongation = min(mean_elongation,numR); maxElongation = max(mean_elongation,numR); minPolarization = min(mean_polarization,numR); maxPolarization = max(mean_polarization,numR); /* initialize the window */ initWindow( 600, 400 ); drawFigure(); while(!done) { /** Draw stuff here **/ /* if (mode == MOVIE_MODE) { t2 = get_time_sec(); if (t2-t1 > secondsPerFrame && file->curFrame < file->numFrames) { readFrame(Px,Py,Vx,Vy,file); drawFigure(); t1 = t2; } } */ usleep( 33 ); // sleep a little // check for events if(XCheckWindowEvent(curDisplay, curWindow, event_mask, &curEvent)) { switch (curEvent.type) { case KeyPress: /* access string using XLookupString(*event,*char,numChars,NULL,NULL) */ if(XLookupString((XKeyEvent *)&curEvent, &c, 1, NULL, NULL) == 1) { switch(c) { case 'q': // quit done = True; break; default: break; } } break; case Expose: refreshWindow(); break; default: break; } // end switch over event type } // end if event } // end while closeWindow(nBuf); cleanup(); return(0); } // end displayStats
void TaskbarProxy::showMenu (const QString& widStr, int x, int y) { auto& w = Util::XWrapper::Instance (); const auto& wid = widStr.toULong (); const auto state = w.GetWindowState (wid); const auto actions = w.GetWindowActions (wid); auto menu = new QMenu; menu->setAttribute (Qt::WA_DeleteOnClose); { auto minimizeAct = menu->addAction (tr ("Minimize")); minimizeAct->setCheckable (true); if (state & Util::WinStateFlag::Hidden) minimizeAct->setChecked (true); else minimizeAct->setEnabled (actions & Util::AllowedActionFlag::Minimize); minimizeAct->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this, state] (const QString& wid) { state & Util::WinStateFlag::Hidden ? raiseWindow (wid) : minimizeWindow (wid); })); } { auto maximizeAct = menu->addAction (tr ("Maximize")); maximizeAct->setCheckable (true); const bool isMaximized = state & Util::WinStateFlag::MaximizedHorz || state & Util::WinStateFlag::MaximizedVert; if (isMaximized) maximizeAct->setChecked (true); else maximizeAct->setEnabled (actions & Util::AllowedActionFlag::MaximizeHorz || actions & Util::AllowedActionFlag::MaximizeVert); maximizeAct->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this, isMaximized] (const QString& wid) { isMaximized ? unmaximizeWindow (wid) : maximizeWindow (wid); })); } auto moreMenu = menu->addMenu (tr ("More")); { auto keepAbove = moreMenu->addAction (tr ("Keep above others")); keepAbove->setEnabled (actions & Util::AllowedActionFlag::MoveToTop); keepAbove->setCheckable (true); const bool isTop = state & Util::WinStateFlag::OnTop; keepAbove->setChecked (isTop); keepAbove->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this, isTop] (const QString& wid) { moveWindowTo (wid, isTop ? "normal" : "top"); })); keepAbove->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("go-top")); } { auto keepBelow = moreMenu->addAction (tr ("Keep below others")); keepBelow->setEnabled (actions & Util::AllowedActionFlag::MoveToBottom); keepBelow->setCheckable (true); const bool isBottom = state & Util::WinStateFlag::OnBottom; keepBelow->setChecked (isBottom); keepBelow->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this, isBottom] (const QString& wid) { moveWindowTo (wid, isBottom ? "normal" : "bottom"); })); keepBelow->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("go-bottom")); } { auto shadeAct = moreMenu->addAction (tr ("Shade")); shadeAct->setEnabled (actions & Util::AllowedActionFlag::Shade); shadeAct->setCheckable (true); shadeAct->setChecked (state & Util::WinStateFlag::Shaded); shadeAct->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this] (const QString& wid) { toggleShadeWindow (wid); })); } QMenu *desksMenu = 0; { const auto numDesks = w.GetDesktopCount (); if (numDesks > 1) { desksMenu = menu->addMenu (tr ("Move to desktop")); const auto winDesk = w.GetWindowDesktop (wid); auto addAct = [this, actions, winDesk, desksMenu] (int num, const QString& name) { auto act = desksMenu->addAction (name); act->setEnabled (actions & Util::AllowedActionFlag::ChangeDesktop); act->setCheckable (true); act->setChecked (winDesk == num); act->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this, num] (const QString& wid) { moveToDesktop (wid, num); })); }; const auto& deskNames = w.GetDesktopNames (); for (int i = 0; i < numDesks; ++i) addAct (i, deskNames.value (i, QString::number (i))); desksMenu->addSeparator (); addAct (0xFFFFFFFF, tr ("All desktops")); } } menu->addSeparator (); { auto closeAct = menu->addAction (tr ("Close")); closeAct->setEnabled (actions & Util::AllowedActionFlag::Close); closeAct->setProperty ("Actor", QVariant::fromValue<Actor_f> ([this] (const QString& wid) { closeWindow (wid); })); closeAct->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("window-close")); } auto allActions = menu->actions () + moreMenu->actions (); if (desksMenu) allActions += desksMenu->actions (); for (auto act : allActions) { act->setProperty ("WID", widStr); connect (act, SIGNAL (triggered ()), this, SLOT (handleAction ())); } menu->popup ({ x, y }); }
int AgiEngine::print(const char *p, int lin, int col, int len) { if (p == NULL) return 0; debugC(4, kDebugLevelText, "print(): lin = %d, col = %d, len = %d", lin, col, len); if (col == 0 && lin == 0 && len == 0) lin = col = -1; if (len == 0) len = 30; blitTextbox(p, lin, col, len); if (getflag(fOutputMode)) { // non-blocking window setflag(fOutputMode, false); return 1; } // blocking _noSaveLoadAllowed = true; if (_game.vars[vWindowReset] == 0) { int k; setvar(vKey, 0); k = waitKey(); closeWindow(); _noSaveLoadAllowed = false; return k; } // timed window debugC(3, kDebugLevelText, "f15==0, v21==%d => timed", getvar(21)); _game.msgBoxTicks = getvar(vWindowReset) * 10; setvar(vKey, 0); _menuSelected = false; do { if (getflag(fRestoreJustRan)) break; if (_menuSelected) break; mainCycle(); if (_game.keypress == KEY_ENTER) { debugC(4, kDebugLevelText, "KEY_ENTER"); setvar(vWindowReset, 0); _game.keypress = 0; break; } } while (_game.msgBoxTicks > 0 && !(shouldQuit() || _restartGame)); setvar(vWindowReset, 0); closeWindow(); _noSaveLoadAllowed = false; return 0; }
void MainMenu::init() { #define ADD_ACTION(name, menu, icon, trName, slot, shortcut) \ action = menu->addAction(icon, trName); \ action->setShortcut(QKeySequence(QSL(shortcut))); \ connect(action, SIGNAL(triggered()), this, slot); \ m_actions[QSL(name)] = action #define ADD_CHECKABLE_ACTION(name, menu, icon, trName, slot, shortcut) \ action = menu->addAction(icon, trName); \ action->setShortcut(QKeySequence(QSL(shortcut))); \ action->setCheckable(true); \ connect(action, SIGNAL(triggered(bool)), this, slot); \ m_actions[QSL(name)] = action // Standard actions - needed on Mac to be placed correctly in "application" menu QAction* action = new QAction(QIcon::fromTheme(QSL("help-about")), tr("&About QupZilla"), this); action->setMenuRole(QAction::AboutRole); connect(action, SIGNAL(triggered()), this, SLOT(showAboutDialog())); m_actions[QSL("Standard/About")] = action; action = new QAction(IconProvider::settingsIcon(), tr("Pr&eferences"), this); action->setMenuRole(QAction::PreferencesRole); action->setShortcut(QKeySequence(QKeySequence::Preferences)); connect(action, SIGNAL(triggered()), this, SLOT(showPreferences())); m_actions[QSL("Standard/Preferences")] = action; action = new QAction(QIcon::fromTheme(QSL("application-exit")), tr("Quit"), this); action->setMenuRole(QAction::QuitRole); // shortcut set from browserwindow connect(action, SIGNAL(triggered()), this, SLOT(quitApplication())); m_actions[QSL("Standard/Quit")] = action; // File menu m_menuFile = new QMenu(tr("&File")); connect(m_menuFile, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu())); connect(m_menuFile, SIGNAL(aboutToHide()), this, SLOT(aboutToHideFileMenu())); ADD_ACTION("File/NewTab", m_menuFile, IconProvider::newTabIcon(), tr("New Tab"), SLOT(newTab()), "Ctrl+T"); ADD_ACTION("File/NewWindow", m_menuFile, IconProvider::newWindowIcon(), tr("&New Window"), SLOT(newWindow()), "Ctrl+N"); ADD_ACTION("File/NewPrivateWindow", m_menuFile, IconProvider::privateBrowsingIcon(), tr("New &Private Window"), SLOT(newPrivateWindow()), "Ctrl+Shift+P"); ADD_ACTION("File/OpenLocation", m_menuFile, QIcon::fromTheme(QSL("document-open-remote")), tr("Open Location"), SLOT(openLocation()), "Ctrl+L"); ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O"); ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W"); m_menuFile->addSeparator(); ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S"); ADD_ACTION("File/SavePageScreen", m_menuFile, QIcon::fromTheme(QSL("image-loading")), tr("Save Page Screen"), SLOT(savePageScreen()), "Ctrl+Shift+S"); ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), ""); ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P"); m_menuFile->addSeparator(); ADD_CHECKABLE_ACTION("File/WorkOffline", m_menuFile, QIcon(), tr("Work &Offline"), SLOT(toggleOfflineMode()), ""); m_menuFile->addSeparator(); m_menuFile->addAction(m_actions[QSL("Standard/Quit")]); // Edit menu m_menuEdit = new QMenu(tr("&Edit")); connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu())); connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu())); ADD_ACTION("Edit/Undo", m_menuEdit, QIcon::fromTheme(QSL("edit-undo")), tr("&Undo"), SLOT(editUndo()), "Ctrl+Z"); ADD_ACTION("Edit/Redo", m_menuEdit, QIcon::fromTheme(QSL("edit-redo")), tr("&Redo"), SLOT(editRedo()), "Ctrl+Shift+Z"); m_menuEdit->addSeparator(); ADD_ACTION("Edit/Cut", m_menuEdit, QIcon::fromTheme(QSL("edit-cut")), tr("&Cut"), SLOT(editCut()), "Ctrl+X"); ADD_ACTION("Edit/Copy", m_menuEdit, QIcon::fromTheme(QSL("edit-copy")), tr("C&opy"), SLOT(editCopy()), "Ctrl+C"); ADD_ACTION("Edit/Paste", m_menuEdit, QIcon::fromTheme(QSL("edit-paste")), tr("&Paste"), SLOT(editPaste()), "Ctrl+V"); m_menuEdit->addSeparator(); ADD_ACTION("Edit/SelectAll", m_menuEdit, QIcon::fromTheme(QSL("edit-select-all")), tr("Select &All"), SLOT(editSelectAll()), "Ctrl+A"); ADD_ACTION("Edit/Find", m_menuEdit, QIcon::fromTheme(QSL("edit-find")), tr("&Find"), SLOT(editFind()), "Ctrl+F"); m_menuEdit->addSeparator(); // View menu m_menuView = new QMenu(tr("&View")); connect(m_menuView, SIGNAL(aboutToShow()), this, SLOT(aboutToShowViewMenu())); connect(m_menuView, SIGNAL(aboutToHide()), this, SLOT(aboutToHideViewMenu())); QMenu* toolbarsMenu = new QMenu(tr("Toolbars")); connect(toolbarsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolbarsMenu())); QMenu* sidebarMenu = new QMenu(tr("Sidebar")); connect(sidebarMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSidebarsMenu())); QMenu* encodingMenu = new QMenu(tr("Character &Encoding")); connect(encodingMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEncodingMenu())); // Create menus to make shortcuts available even before first showing the menu m_window->createToolbarsMenu(toolbarsMenu); m_window->createSidebarsMenu(sidebarMenu); m_menuView->addMenu(toolbarsMenu); m_menuView->addMenu(sidebarMenu); ADD_CHECKABLE_ACTION("View/ShowStatusBar", m_menuView, QIcon(), tr("Sta&tus Bar"), SLOT(showStatusBar()), ""); m_menuView->addSeparator(); ADD_ACTION("View/Stop", m_menuView, QIcon::fromTheme(QSL("process-stop")), tr("&Stop"), SLOT(stop()), "Esc"); ADD_ACTION("View/Reload", m_menuView, QIcon::fromTheme(QSL("view-refresh")), tr("&Reload"), SLOT(reload()), "F5"); m_menuView->addSeparator(); ADD_ACTION("View/ZoomIn", m_menuView, QIcon::fromTheme(QSL("zoom-in")), tr("Zoom &In"), SLOT(zoomIn()), "Ctrl++"); ADD_ACTION("View/ZoomOut", m_menuView, QIcon::fromTheme(QSL("zoom-out")), tr("Zoom &Out"), SLOT(zoomOut()), "Ctrl+-"); ADD_ACTION("View/ZoomReset", m_menuView, QIcon::fromTheme(QSL("zoom-original")), tr("Reset"), SLOT(zoomReset()), "Ctrl+0"); m_menuView->addSeparator(); ADD_CHECKABLE_ACTION("View/CaretBrowsing", m_menuView, QIcon(), tr("&Caret Browsing"), SLOT(toggleCaretBrowsing()), "F7"); m_menuView->addMenu(encodingMenu); m_menuView->addSeparator(); ADD_ACTION("View/PageSource", m_menuView, QIcon::fromTheme(QSL("text-html")), tr("&Page Source"), SLOT(showPageSource()), "Ctrl+U"); ADD_CHECKABLE_ACTION("View/FullScreen", m_menuView, QIcon(), tr("&FullScreen"), SLOT(showFullScreen()), "F11"); // Tools menu m_menuTools = new QMenu(tr("&Tools")); connect(m_menuTools, SIGNAL(aboutToShow()), this, SLOT(aboutToShowToolsMenu())); connect(m_menuTools, SIGNAL(aboutToHide()), this, SLOT(aboutToHideToolsMenu())); ADD_ACTION("Tools/WebSearch", m_menuTools, QIcon(), tr("&Web Search"), SLOT(webSearch()), "Ctrl+K"); ADD_ACTION("Tools/SiteInfo", m_menuTools, QIcon::fromTheme(QSL("dialog-information")), tr("Site &Info"), SLOT(showSiteInfo()), "Ctrl+I"); m_menuTools->addSeparator(); ADD_ACTION("Tools/DownloadManager", m_menuTools, QIcon(), tr("&Download Manager"), SLOT(showDownloadManager()), "Ctrl+Y"); ADD_ACTION("Tools/CookiesManager", m_menuTools, QIcon(), tr("&Cookies Manager"), SLOT(showCookieManager()), ""); ADD_ACTION("Tools/AdBlock", m_menuTools, QIcon(), tr("&AdBlock"), SLOT(showAdBlockDialog()), ""); ADD_ACTION("Tools/RssReader", m_menuTools, QIcon(), tr("RSS &Reader"), SLOT(showRssManager()), ""); ADD_ACTION("Tools/WebInspector", m_menuTools, QIcon(), tr("Web In&spector"), SLOT(showWebInspector()), "Ctrl+Shift+I"); ADD_ACTION("Tools/ClearRecentHistory", m_menuTools, QIcon::fromTheme(QSL("edit-clear")), tr("Clear Recent &History"), SLOT(showClearRecentHistoryDialog()), "Ctrl+Shift+Del"); m_menuTools->addSeparator(); // Help menu m_menuHelp = new QMenu(tr("&Help")); #ifndef Q_OS_MAC ADD_ACTION("Help/AboutQt", m_menuHelp, QIcon(QSL(":/icons/menu/qt.png")), tr("About &Qt"), SLOT(aboutQt()), ""); m_menuHelp->addAction(m_actions[QSL("Standard/About")]); m_menuHelp->addSeparator(); #endif ADD_ACTION("Help/InfoAboutApp", m_menuHelp, QIcon::fromTheme(QSL("help-contents")), tr("Information about application"), SLOT(showInfoAboutApp()), ""); ADD_ACTION("Help/ConfigInfo", m_menuHelp, QIcon(), tr("Configuration Information"), SLOT(showConfigInfo()), ""); ADD_ACTION("Help/ReportIssue", m_menuHelp, QIcon(), tr("Report &Issue"), SLOT(reportIssue()), ""); m_actions[QSL("Help/InfoAboutApp")]->setShortcut(QKeySequence(QKeySequence::HelpContents)); // History menu m_menuHistory = new HistoryMenu(); m_menuHistory->setMainWindow(m_window); // Bookmarks menu m_menuBookmarks = new BookmarksMenu(); m_menuBookmarks->setMainWindow(m_window); // Other actions action = new QAction(QIcon::fromTheme(QSL("user-trash")), tr("Restore &Closed Tab"), this); action->setShortcut(QKeySequence(QSL("Ctrl+Shift+T"))); connect(action, SIGNAL(triggered()), this, SLOT(restoreClosedTab())); m_actions[QSL("Other/RestoreClosedTab")] = action; #ifdef Q_OS_MAC m_actions[QSL("View/FullScreen")]->setShortcut(QKeySequence(QSL("F11"))); // Add standard actions to File Menu (as it won't be ever cleared) and Mac menubar should move them to "Application" menu m_menuFile->addAction(m_actions[QSL("Standard/About")]); m_menuFile->addAction(m_actions[QSL("Standard/Preferences")]); #endif #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) m_menuEdit->addAction(m_actions[QSL("Standard/Preferences")]); #elif !defined(Q_OS_MAC) m_menuTools->addAction(m_actions[QSL("Standard/Preferences")]); #endif #ifndef QTWEBKIT_FROM_2_3 m_actions[QSL("View/CaretBrowsing")]->setVisible(false); #endif // Menus are hidden by default aboutToHideFileMenu(); aboutToHideViewMenu(); aboutToHideEditMenu(); aboutToHideToolsMenu(); addActionsToWindow(); }
void Window_Ability::onCloseClick(){ setTocuhEnable(false); m_info_bg->runAction(CCFadeOut::create(0.2f)); m_info_bg->runAction(Sequence::create(CCMoveTo::create(0.2f, Point(-334,-58)),CallFunc::create([&](){closeWindow();}), NULL)); m_black_block_1->runAction(ScaleTo::create(0.1f, 0.1f, 1.0f)); m_black_block_2->runAction(ScaleTo::create(0.1f, 0.1f, 1.0f)); }
manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls * m_vi ) : m_effect( _eff ) { m_vi2 = m_vi; widget = new QWidget(); m_vi->m_scrollArea = new QScrollArea( widget ); l = new QGridLayout( widget ); m_vi->m_subWindow = gui->mainWindow()->addWindowedWidget(NULL, Qt::SubWindow | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); m_vi->m_subWindow->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); m_vi->m_subWindow->setFixedSize( 960, 300); m_vi->m_subWindow->setWidget(m_vi->m_scrollArea); m_vi->m_subWindow->setWindowTitle( _eff->m_plugin->name() + tr( " - VST parameter control" ) ); m_vi->m_subWindow->setWindowIcon( PLUGIN_NAME::getIconPixmap( "logo" ) ); m_vi->m_subWindow->setAttribute(Qt::WA_DeleteOnClose, false); l->setContentsMargins( 20, 10, 10, 10 ); l->setVerticalSpacing( 10 ); l->setHorizontalSpacing( 23 ); m_syncButton = new QPushButton( tr( "VST sync" ), widget ); connect( m_syncButton, SIGNAL( clicked() ), this, SLOT( syncPlugin() ) ); l->addWidget( m_syncButton, 0, 0, 1, 2, Qt::AlignLeft ); m_displayAutomatedOnly = new QPushButton( tr( "Automated" ), widget ); connect( m_displayAutomatedOnly, SIGNAL( clicked() ), this, SLOT( displayAutomatedOnly() ) ); l->addWidget( m_displayAutomatedOnly, 0, 1, 1, 2, Qt::AlignLeft ); m_closeButton = new QPushButton( tr( " Close " ), widget ); connect( m_closeButton, SIGNAL( clicked() ), this, SLOT( closeWindow() ) ); l->addWidget( m_closeButton, 0, 2, 1, 7, Qt::AlignLeft ); for( int i = 0; i < 10; i++ ) { l->addItem( new QSpacerItem( 68, 45, QSizePolicy::Fixed, QSizePolicy::Fixed ), 0, i ); } const QMap<QString, QString> & dump = m_effect->m_plugin->parameterDump(); m_vi->paramCount = dump.size(); vstKnobs = new Knob *[ m_vi->paramCount ]; bool hasKnobModel = true; if (m_vi->knobFModel == NULL) { m_vi->knobFModel = new FloatModel *[ m_vi->paramCount ]; hasKnobModel = false; } char paramStr[35]; QStringList s_dumpValues; for( int i = 0; i < m_vi->paramCount; i++ ) { sprintf( paramStr, "param%d", i); s_dumpValues = dump[ paramStr ].split( ":" ); vstKnobs[ i ] = new Knob( knobBright_26, widget, s_dumpValues.at( 1 ) ); vstKnobs[ i ]->setHintText( s_dumpValues.at( 1 ) + ":", "" ); vstKnobs[ i ]->setLabel( s_dumpValues.at( 1 ).left( 15 ) ); if( !hasKnobModel ) { sprintf( paramStr, "%d", i); m_vi->knobFModel[ i ] = new FloatModel( ( s_dumpValues.at( 2 ) ).toFloat(), 0.0f, 1.0f, 0.01f, _eff, tr( paramStr ) ); } connect( m_vi->knobFModel[ i ], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) ); vstKnobs[ i ] ->setModel( m_vi->knobFModel[ i ] ); } int i = 0; for( int lrow = 1; lrow < ( int( m_vi->paramCount / 10 ) + 1 ) + 1; lrow++ ) { for( int lcolumn = 0; lcolumn < 10; lcolumn++ ) { if( i < m_vi->paramCount ) { l->addWidget( vstKnobs[i], lrow, lcolumn, Qt::AlignCenter ); } i++; } } l->setRowStretch( ( int( m_vi->paramCount / 10 ) + 1 ), 1 ); l->setColumnStretch( 10, 1 ); widget->setLayout(l); widget->setAutoFillBackground(true); m_vi->m_scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); m_vi->m_scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_vi->m_scrollArea->setPalette( QApplication::palette( m_vi->m_scrollArea ) ); m_vi->m_scrollArea->setMinimumHeight( 64 ); m_vi->m_scrollArea->setWidget( widget ); m_vi->m_subWindow->show(); }
bool AgiEngine::predictiveDialog() { int key = 0, active = -1, lastactive = 0; bool rc = false; uint8 x; int y; int bx[17], by[17]; Common::String prefix; char temp[MAXWORDLEN + 1], repeatcount[MAXWORDLEN]; AgiBlock tmpwindow; bool navigationwithkeys = false; bool processkey; const char *buttonStr[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; const char *buttons[] = { "(1)'-.&", "(2)abc", "(3)def", "(4)ghi", "(5)jkl", "(6)mno", "(7)pqrs", "(8)tuv", "(9)wxyz", "(#)next", "add", "<", "Cancel", "OK", "Pre", "(0) ", NULL }; const int colors[] = { 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 12, 15, 12, 15, 0, 15, 0, 15, 0, 14, 0, 15, 0, 0, 0 }; const char *modes[] = { "(*)Pre", "(*)123", "(*)Abc" }; // FIXME: Move this to a more appropriate place. if (!_predictiveDictText) { loadDict(); if (!_predictiveDictText) return false; } _predictiveDictActLine = NULL; uint8 numMatchingWords = 0; _predictiveDialogRunning = true; _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, true); memset(repeatcount, 0, sizeof(repeatcount)); // show the predictive dialog. // if another window is already in display, save its state into tmpwindow memset(&tmpwindow, 0, sizeof(tmpwindow)); tmpwindow.active = false; if (_game.window.active) memcpy(&tmpwindow, &(_game.window), sizeof(AgiBlock)); drawWindow(50, 40, 269, 159); _gfx->drawRectangle(62, 54, 249, 66, MSG_BOX_TEXT); _gfx->flushBlock(62, 54, 249, 66); bx[15] = 73; // Zero/space by[15] = 120; bx[9] = 110; // next by[9] = 120; bx[10] = 172; // add by[10] = 120; bx[14] = 200; // Mode by[14] = 120; bx[11] = 252; // Backspace by[11] = 57; bx[12] = 180; // Cancel by[12] = 140; bx[13] = 240; // OK by[13] = 140; x = 73; y = 75; for (int i = 0; i < 9; i++) { bx[i] = x; by[i] = y; x += 60; if (i % 3 == 2) { y += 15; x = 73; } } clearKeyQueue(); prefix.clear(); _currentCode.clear(); _currentWord.clear(); _wordNumber = 0; int mode = kModePre; bool needRefresh = true; for (;;) { if (needRefresh) { for (int i = 0; buttons[i]; i++) { int color1 = colors[i * 2]; int color2 = colors[i * 2 + 1]; if (i == 9 && !((mode != kModeAbc && _predictiveDictActLine && numMatchingWords > 1) || (mode == kModeAbc && _currentWord.size() && _currentWord.lastChar() != ' '))) { // Next color2 = 7; } // needs fixing, or remove it! bool _addIsActive = false; // FIXME: word adding is not implemented if (i == 10 && !_addIsActive) { // Add color2 = 7; } if (i == 14) { _gfx->drawDefaultStyleButton(bx[i], by[i], modes[mode], i == active, 0, color1, color2); } else { _gfx->drawDefaultStyleButton(bx[i], by[i], buttons[i], i == active, 0, color1, color2); } } Common::strlcpy(temp, prefix.c_str(), sizeof(temp)); Common::strlcat(temp, _currentWord.c_str(), sizeof(temp)); for (int i = prefix.size() + _currentCode.size(); i < MAXWORDLEN; i++) temp[i] = ' '; temp[MAXWORDLEN] = 0; printText(temp, 0, 8, 7, MAXWORDLEN, 15, 0); _gfx->flushBlock(62, 54, 249, 66); if (active >= 0 && !navigationwithkeys) { // provide visual feedback only when not navigating with the arrows // so that the user can see the active button. active = -1; needRefresh = true; } else needRefresh = false; _gfx->doUpdate(); } pollTimer(); key = doPollKeyboard(); processkey = false; switch (key) { case KEY_ENTER: if (navigationwithkeys) { // when the user has utilized arrow key navigation, // interpret enter as 'click' on the active button active = lastactive; } else { // else it is a shortcut for 'Ok' active = 13; } processkey = true; break; case KEY_ESCAPE: rc = false; goto getout; case BUTTON_LEFT: navigationwithkeys = false; for (int i = 0; buttons[i]; i++) { if (_gfx->testButton(bx[i], by[i], buttons[i])) { active = i; processkey = true; break; } } break; case KEY_BACKSPACE: active = 11; processkey = true; break; case '#': active = 9; processkey = true; break; case '*': active = 14; processkey = true; break; case 0x09: // Tab navigationwithkeys = true; debugC(3, kDebugLevelText, "Focus change"); lastactive = active = lastactive + 1; active %= ARRAYSIZE(buttons) - 1; needRefresh = true; break; case KEY_LEFT: navigationwithkeys = true; if (lastactive == 0 || lastactive == 3 || lastactive == 6) active = lastactive + 2; else if (lastactive == 9) active = 15; else if (lastactive == 11) active = 11; else if (lastactive == 12) active = 13; else if (lastactive == 14) active = 10; else active = lastactive - 1; lastactive = active; needRefresh = true; break; case KEY_RIGHT: navigationwithkeys = true; if (lastactive == 2 || lastactive == 5 || lastactive == 8) active = lastactive - 2; else if (lastactive == 10) active = 14; else if (lastactive == 11) active = 11; else if (lastactive == 13) active = 12; else if (lastactive == 15) active = 9; else active = lastactive + 1; lastactive = active; needRefresh = true; break; case KEY_UP: navigationwithkeys = true; if (lastactive <= 2) active = 11; else if (lastactive == 9 || lastactive == 10) active = lastactive - 2; else if (lastactive == 11) active = 13; else if (lastactive == 14) active = 8; else if (lastactive == 15) active = 6; else active = lastactive - 3; lastactive = active; needRefresh = true; break; case KEY_DOWN: navigationwithkeys = true; if (lastactive == 6) active = 15; else if (lastactive == 7 || lastactive == 8) active = lastactive + 2; else if (lastactive == 11) active = 0; else if (lastactive == 12 || lastactive == 13) active = 11; else if (lastactive == 14 || lastactive == 15) active = lastactive - 2; else active = lastactive + 3; lastactive = active; needRefresh = true; break; default: // handle numeric buttons if (key >= '1' && key <= '9') { active = key - '1'; processkey = true; } else if (key == '0') { active = 15; processkey = true; } break; } if (processkey) { if (active >= 0) { needRefresh = true; lastactive = active; if (active == 15 && mode != kModeNum) { // Space // bring MRU word at the top of the list when changing words if (mode == kModePre && _predictiveDictActLine && numMatchingWords > 1 && _wordNumber != 0) bringWordtoTop(_predictiveDictActLine, _wordNumber); strncpy(temp, _currentWord.c_str(), _currentCode.size()); temp[_currentCode.size()] = 0; prefix += temp; prefix += " "; _currentCode.clear(); _currentWord.clear(); numMatchingWords = 0; memset(repeatcount, 0, sizeof(repeatcount)); } else if (active < 9 || active == 11 || active == 15) { // number or backspace if (active == 11) { // backspace if (_currentCode.size()) { repeatcount[_currentCode.size() - 1] = 0; _currentCode.deleteLastChar(); } else { if (prefix.size()) prefix.deleteLastChar(); } } else if (prefix.size() + _currentCode.size() < MAXWORDLEN - 1) { // don't overflow the dialog line if (active == 15) { // zero _currentCode += buttonStr[9]; } else { _currentCode += buttonStr[active]; } } switch (mode) { case kModeNum: _currentWord = _currentCode; break; case kModePre: if (!matchWord() && _currentCode.size()) { _currentCode.deleteLastChar(); matchWord(); } numMatchingWords = countWordsInString(_predictiveDictActLine); break; case kModeAbc: for (x = 0; x < _currentCode.size(); x++) if (_currentCode[x] >= '1') temp[x] = buttons[_currentCode[x] - '1'][3 + repeatcount[x]]; temp[_currentCode.size()] = 0; _currentWord = temp; } } else if (active == 9) { // next if (mode == kModePre) { if (_predictiveDictActLine && numMatchingWords > 1) { _wordNumber = (_wordNumber + 1) % numMatchingWords; char tmp[MAXLINELEN]; strncpy(tmp, _predictiveDictActLine, MAXLINELEN); tmp[MAXLINELEN - 1] = 0; char *tok = strtok(tmp, " "); for (uint8 i = 0; i <= _wordNumber; i++) tok = strtok(NULL, " "); _currentWord = Common::String(tok, _currentCode.size()); } } else if (mode == kModeAbc){ x = _currentCode.size(); if (x) { if (_currentCode.lastChar() == '1' || _currentCode.lastChar() == '7' || _currentCode.lastChar() == '9') repeatcount[x - 1] = (repeatcount[x - 1] + 1) % 4; else repeatcount[x - 1] = (repeatcount[x - 1] + 1) % 3; if (_currentCode.lastChar() >= '1') _currentWord.setChar(buttons[_currentCode[x - 1] - '1'][3 + repeatcount[x - 1]], x-1); } } } else if (active == 10) { // add debug(0, "add"); } else if (active == 13) { // Ok // bring MRU word at the top of the list when ok'ed out of the dialog if (mode == kModePre && _predictiveDictActLine && numMatchingWords > 1 && _wordNumber != 0) bringWordtoTop(_predictiveDictActLine, _wordNumber); rc = true; goto press; } else if (active == 14) { // Mode mode++; if (mode > kModeAbc) mode = kModePre; // truncate current input at mode change strncpy(temp, _currentWord.c_str(), _currentCode.size()); temp[_currentCode.size()] = 0; prefix += temp; _currentCode.clear(); _currentWord.clear(); memset(repeatcount, 0, sizeof(repeatcount)); } else { goto press; } } } } press: Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult)); Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult)); getout: // if another window was shown, bring it up again if (!tmpwindow.active) closeWindow(); else { _gfx->restoreBlock(_game.window.x1, _game.window.y1, _game.window.x2, _game.window.y2, _game.window.buffer); free(_game.window.buffer); memcpy(&(_game.window), &tmpwindow, sizeof(AgiBlock)); _gfx->doUpdate(); } _system->setFeatureState(OSystem::kFeatureDisableKeyFiltering, false); _predictiveDialogRunning = false; return rc; }
bool BaseApp::onKey(const uint key, const bool pressed) { //#if defined(DEBUG) && defined(WIN32) #ifdef WIN32 if (pressed && key == KEY_F12) { if (OpenClipboard(hwnd)) { EmptyClipboard(); char str[256]; int len = sprintf(str, "camPos = vec3(%.15ff, %.15ff, %.15ff);\r\nwx = %.15ff;\r\nwy = %.15ff;\r\n", camPos.x, camPos.y, camPos.z, wx, wy); HGLOBAL handle = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len + 1); char *mem = (char *) GlobalLock(handle); if (mem != NULL) { strcpy(mem, str); GlobalUnlock(handle); SetClipboardData(CF_TEXT, handle); } CloseClipboard(); } } #endif if (pressed && key == screenshotKey) { if (!saveScreenshot()) { ErrorMsg("Couldn't save screenshot"); } return true; } if (pressed && key == benchmarkKey) { if (benchMarkFile) { fclose(benchMarkFile); benchMarkFile = NULL; } else { benchMarkFile = fopen("Benchmark.xls", "w"); fprintf(benchMarkFile, "Frames/s\n"); } return true; } bool processed = false; if (!mouseCaptured) { if (widgets.goToFirst()) { do { Widget *widget = widgets.getCurrent(); if (widget->isVisible() || widget->isCapturing()) { widgets.moveCurrentToTop(); processed = widget->onKey(key, pressed); break; } } while (widgets.goToNext()); } } if (!processed) { if (pressed) { processed = true; if (key == KEY_ESCAPE) { if (!mouseCaptured || (fullscreen && mouseCaptured)) { closeWindow(true, true); } else { captureMouse(false); } } else if (key == fpsKey) { showFPS = !showFPS; } else if (key == resetKey) { resetCamera(); } else if (key == optionsKey) { if (configDialog->isVisible()) { configDialog->setVisible(false); if (keysDialog) keysDialog->setVisible(false); if (joystickDialog) joystickDialog->setVisible(false); } else { captureMouse(false); configDialog->setVisible(true); if (keysDialog) keysDialog->setVisible(true); if (joystickDialog) joystickDialog->setVisible(true); } } else { processed = false; } } } if (key < elementsOf(keys)) keys[key] = pressed; return processed; }
/*! Remove all analog signals associated with this widget. */ void UiAnalogGenerator::removeAllSignals() { QList<QMdiSubWindow*> list = mWinArea->subWindowList(); foreach(QMdiSubWindow* win, list) { closeWindow(win, true); }
void GcWindow::_closeWindow() { emit closeWindow(this); }