// Another instance of this application has started, noticed this application is already running, // placed a set of startup parameters in shared memory and asked this instance of the application // to deal with them void mainContext::newAppRequest( const QString& message ) { qDebug() << message; // Get the shared memory if( !share.attach() ) { qDebug() << "Could not attach"; return; } // Lock the shared memory if( !share.lock() ) { qDebug() << "Could not lock shared menory"; return; } // Extract parameters from a serial copy of the parameters params.getSharedParams( share.data() ); // Release the shared memory if( !share.unlock() ) return; // Release the shared memory share.detach(); // Create the main window. qDebug() << "Creating an new window"; newWindow(); }
void Lobby::onItemClicked(QModelIndex index) { QString raw = ui->tableWidget->item(index.row(), ROOM_ID)->data(Qt::DisplayRole).toString(); QStringList data = raw.split(QStringLiteral(")")); int roomId; if(data.size()>1){ roomId = data[1].toInt(); } else{ roomId = raw.toInt(); } RoomListResponse_RoomInfo room = rooms[roomId]; network::EnterRoomRequest *enter= new network::EnterRoomRequest(); if(room.has_password()){ QString pwd = QInputDialog::getText(this, QStringLiteral("切,结界么?"), QStringLiteral("大声告诉我你知道的秘密:"), QLineEdit::Normal); if(!pwd.isEmpty()) enter->set_password(pwd.toStdString()); } ui->tableWidget->setEnabled(false); newWindow(room.max_player(), room.silence()); enter->set_room_id(room.room_id()); logic->getClient()->sendMessage(network::MSG_ENTER_ROOM_REQ, enter); }
void Lobby::onOpenRoom(){ int playerNum = roomSet->getPlayerNum(); int seatOrder = roomSet->getSeatOrder(); int roleSelectionStrategy = roomSet->getRoleSelection(); bool firstExtension = roomSet->getFirstExtension(); bool secondExtension = roomSet->getSecondExtension(); bool spmodao = roomSet->getspMoDao(); bool allowGuest = roomSet->getAllowGuest(); std::string password = roomSet->getPassword().toStdString(); std::string roomName = roomSet->getRoomName().toStdString(); bool slience = roomSet->getSilence(); network::CreateRoomRequest* create = new network::CreateRoomRequest(); create->set_role_strategy((network::ROLE_STRATEGY)roleSelectionStrategy); create->set_max_player(playerNum); create->set_seat_mode(seatOrder); create->set_first_extension(firstExtension); create->set_second_extension(secondExtension); create->set_sp_mo_dao(spmodao); create->set_allow_guest(allowGuest); create->set_password(password); create->set_room_name(roomName); create->set_silence(slience); logic->getClient()->sendMessage(network::MSG_CREATE_ROOM_REQ, create); roomSet->close();//注意此时调用onBackToLobby() newWindow(playerNum, slience);//打开游戏界面 }
// Read the startup parameters from a new instance of the application. // The new instance wants this old instance to do the work. // It has passed on the startup parameters and will now exit void instanceManager::readParams() { QByteArray ba(client->readAll()); startupParams params; params.getSharedParams( ba ); newWindow( params ); }
void PopupWindowsStack::showNewMessage(Contact * from, const QString & to, const QDateTime &dateTime) { qDebug() << Q_FUNC_INFO; PopupWindow* p = newWindow(); p->setMessageReceived(from->email(), from->nickname(), to, dateTime); connect(p, SIGNAL(activated()), this, SLOT(slotPopupWindowActivated())); p->show(); }
void PopupWindowsStack::showLettersUnread(const quint32 cnt) { qDebug() << Q_FUNC_INFO; PopupWindow* p = newWindow(); p->setUnreadLettersText(cnt); connect(p, SIGNAL(activated()), this, SLOT(slotPopupWindowActivated())); p->show(); }
void WorkTabMgr::initialize(const QStringList &openFiles, const QString& session) { m_session_mgr = new SessionMgr(this); newWindow(openFiles); if(!session.isEmpty() || (openFiles.isEmpty() && sConfig.get(CFG_BOOL_LOAD_LAST_SESSION))) m_session_mgr->loadSession(session, true); }
void PopupWindowsStack::showNewLetter(const QString & from, const QString & subject, const QDateTime &dateTime) { qDebug() << Q_FUNC_INFO; PopupWindow* p = newWindow(); p->setLetterReceived(from, subject, dateTime); connect(p, SIGNAL(activated()), this, SLOT(slotPopupWindowActivated())); p->show(); }
void WebRenderMainWindow::newTab() { // You must make the webview based connections here, because this is the birthplace of new BrowserView BrowserView *newView = new BrowserView(0,isIncognitoMode()); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); }
void WebRenderMainWindow::newTab(QUrl url) { BrowserView *newView = new BrowserView(0,isIncognitoMode()); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); newView->getWebView()->load(url); }
void ToListWorks::on_pushButton_clicked() { QString text = ui->comboBox_4->currentText(); QString text1 = ui->comboBox_3->currentText(); QString text2 = ui->comboBox_2->currentText(); QString text3 = ui->comboBox->currentText(); listWorks->setNGr(text, text1, text2, text3); listWorks->update(); emit newWindow(listWorks); }
void WorkTables::on_pushButton_clicked() { QSqlQueryModel *mod1 = new QSqlQueryModel(); // mod1->setQuery("select semes from plan GROUP BY semes;"); QSqlQueryModel *mod2 = new QSqlQueryModel(); mod2->setQuery("select n_spec from specialty;"); toPlan->Init(mod1, mod2); emit newWindow(toPlan); }
void WorkTables::on_pushButton_2_clicked() { QSqlQueryModel *mod1 = new QSqlQueryModel(); // mod1->setQuery("select semes from sostavgr GROUP BY semes;"); QSqlQueryModel *mod2 = new QSqlQueryModel(); mod2->setQuery("select n_gr from gruppa;"); toCompGroup->Init(mod1, mod2); emit newWindow(toCompGroup); }
//*************************************************************************** int Kwave::App::newInstance(const QStringList &args, const QString &dir) { int retval = 0; Q_UNUSED(dir); Q_ASSERT(m_cmdline); if (!m_cmdline) return -EINVAL; m_cmdline->parse(args); static bool first_time = true; if (first_time) { first_time = false; // open the log file if given on the command line if (m_cmdline->isSet(_("logfile"))) { if (!Kwave::Logger::open(m_cmdline->value(_("logfile")))) exit(-1); } Kwave::Splash::showMessage(i18n("Reading configuration...")); readConfig(); // close when the last window closed connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit())); } QStringList params = m_cmdline->positionalArguments(); // only one parameter -> open with empty window if (params.isEmpty()) { retval = newWindow(QUrl()); } else { // open a window for each file specified in the // command line an load it foreach (const QString &name, params) { retval = newWindow(QUrl::fromUserInput(name)); } }
void WorkTabMgr::instanceMessage(const QString &message) { QStringList parts = message.split("|"); if(parts.size() < 2) return; if(parts[0] == "newWindow") { MainWindow *w = newWindow(parts[1].split(";")); w->activateWindow(); w->raise(); } }
void TMyApp::handleEvent(TEvent& event) { TApplication::handleEvent(event); // act like base! if( event.what == evCommand ) { switch( event.message.command ) { case cmMyNewWin: // but respond to additional commands newWindow(); // define action for cmMyNewWin // command break; default: return; } clearEvent( event ); // clear event after handling } }
void WorkTables::on_pushButton_3_clicked() { QSqlQueryModel *mod1 = new QSqlQueryModel(); mod1->setQuery("select data from link3 GROUP BY data;"); QSqlQueryModel *mod2 = new QSqlQueryModel(); mod2->setQuery("select n_dis from disciplina;"); QSqlQueryModel *mod3 = new QSqlQueryModel(); mod3->setQuery("select n_trab from typerabot;"); QSqlQueryModel *mod4 = new QSqlQueryModel(); mod4->setQuery("select n_gr from gruppa;"); toVisit->Init(mod1, mod2, mod3, mod4); emit newWindow(toVisit); }
void WorkTables::on_pushButton_4_clicked() { QSqlQueryModel *mod1 = new QSqlQueryModel(); // mod1->setQuery("select semes from link1 GROUP BY semes;"); QSqlQueryModel *mod2 = new QSqlQueryModel(); mod2->setQuery("select n_spec from specialty;"); QSqlQueryModel *mod3 = new QSqlQueryModel(); mod3->setQuery("select n_dis from disciplina;"); QSqlQueryModel *mod4 = new QSqlQueryModel(); mod4->setQuery("select n_trab from typerabot;"); tolistWorks->Init(mod1, mod2, mod3, mod4); emit newWindow(tolistWorks); }
bool HelpWindow::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setBackwardAvailable((bool)static_QUType_bool.get(_o+1)); break; case 1: setForwardAvailable((bool)static_QUType_bool.get(_o+1)); break; case 2: sourceChanged((const QString&)static_QUType_QString.get(_o+1)); break; case 3: about(); break; case 4: aboutQt(); break; case 5: openFile(); break; case 6: newWindow(); break; case 7: print(); break; case 8: pathSelected((const QString&)static_QUType_QString.get(_o+1)); break; case 9: histChosen((int)static_QUType_int.get(_o+1)); break; case 10: bookmChosen((int)static_QUType_int.get(_o+1)); break; case 11: addBookmark(); break; default: return QMainWindow::qt_invoke( _id, _o ); } return TRUE; }
void TMyApp::handleEvent(TEvent& event) { TApplication::handleEvent(event); if( event.what == evCommand ) { switch( event.message.command ) { case cmMyNewWin: newWindow(); break; case cmNewDialog: newDialog(); break; default: return; } clearEvent( event ); // clear event after handling } }
void WebRenderMainWindow::setUpMenus() { webrenderMainMenu = new QWidget; ui_MainMenu = new Ui::MainMenu; ui_MainMenu->setupUi(webrenderMainMenu); webrenderMainMenu->setLayout(ui_MainMenu->verticalLayout); ui_MainMenu->verticalLayout->setSizeConstraint(QLayout::SetFixedSize); webrenderMainMenu->setWindowFlags(Qt::FramelessWindowHint | Qt::Popup); connect(menuButton,SIGNAL(clicked()),this,SLOT(popupMenu())); connect(ui_MainMenu->quitButton,SIGNAL(clicked()),qApp,SLOT(quit())); connect(ui_MainMenu->newTabButton,SIGNAL(clicked()),this,SLOT(newTab())); connect(ui_MainMenu->cutButton,SIGNAL(clicked()),this,SLOT(cut())); connect(ui_MainMenu->copyButton,SIGNAL(clicked()),this,SLOT(copy())); connect(ui_MainMenu->pasteButton,SIGNAL(clicked()),this,SLOT(paste())); connect(ui_MainMenu->openPushButton,SIGNAL(clicked()),this,SLOT(open())); connect(ui_MainMenu->savePushButton,SIGNAL(clicked()),this,SLOT(save())); connect(ui_MainMenu->newWindowButton,SIGNAL(clicked()),this,SLOT(newWindow())); connect(ui_MainMenu->newIncognitoWindowButton,SIGNAL(clicked()),this,SLOT(newIncognitoWindow())); connect(ui_MainMenu->horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(zoom(int))); connect(ui_MainMenu->aboutButton,SIGNAL(clicked()),this,SLOT(aboutWebRender())); }
void LauncherApp::RefsReceived(BMessage* message) { if (!m_initialized) { delete m_launchRefsMessage; m_launchRefsMessage = new BMessage(*message); return; } entry_ref ref; for (int32 i = 0; message->FindRef("refs", i, &ref) == B_OK; i++) { BEntry entry(&ref, true); if (!entry.Exists()) continue; BPath path; if (entry.GetPath(&path) != B_OK) continue; BString url; url << path.Path(); newWindow(url); } }
void kdvi::dropEvent( KDNDDropZone * dropZone ) { QStrList & list = dropZone->getURLList(); char *s; for ( s = list.first(); s != 0L; s = list.next() ) { // Load the first file in this window if ( s == list.getFirst() ) { QString n = s; if ( n.left(5) == "file:" ) openFile( n.mid( 5, n.length() ) ); } else { QString n = s; if ( n.left(5) == "file:" ) newWindow( n.mid( 5, n.length() ) ); } } }
dp::Int dpMain( dp::Args & _args ) { dp::Utf32 title; if( _args.size() >= 2 ) { title = _args[ 1 ]; } std::mutex mutex; std::condition_variable cond; dp::Bool ended = false; auto windowUnique = dp::unique( newWindow( title , mutex , cond , ended ) ); if( windowUnique.get() == nullptr ) { std::printf( "ウィンドウの生成に失敗\n" ); return 1; } waitEnd( mutex , cond , ended ); return 0; }
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() { readHistory(); readBookmarks(); browser = new QTextBrowser( this ); browser->mimeSourceFactory()->setFilePath( _path ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); setCentralWidget( browser ); if ( !home_.isEmpty() ) browser->setSource( home_ ); connect( browser, SIGNAL( highlighted( const QString&) ), statusBar(), SLOT( message( const QString&)) ); resize( 640,700 ); QPopupMenu* file = new QPopupMenu( this ); file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N ); file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O ); file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P ); // The same three icons are used twice each. QIconSet icon_back( QPixmap("textdrawing/previous.png") ); QIconSet icon_forward( QPixmap("textdrawing/next.png") ); QIconSet icon_home( QPixmap("textdrawing/home.png") ); QPopupMenu* go = new QPopupMenu( this ); backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left ); forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right ); go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) ); hist = new QPopupMenu( this ); QStringList::Iterator it = history.begin(); for ( ; it != history.end(); ++it ) mHistory[ hist->insertItem( *it ) ] = *it; connect( hist, SIGNAL( activated( int ) ), this, SLOT( histChosen( int ) ) ); bookm = new QPopupMenu( this ); bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); bookm->insertSeparator(); QStringList::Iterator it2 = bookmarks.begin(); for ( ; it2 != bookmarks.end(); ++it2 ) mBookmarks[ bookm->insertItem( *it2 ) ] = *it2; connect( bookm, SIGNAL( activated( int ) ), this, SLOT( bookmChosen( int ) ) ); menuBar()->insertItem( tr("&File"), file ); menuBar()->insertItem( tr("&Go"), go ); menuBar()->insertItem( tr( "History" ), hist ); menuBar()->insertItem( tr( "Bookmarks" ), bookm ); menuBar()->setItemEnabled( forwardId, FALSE); menuBar()->setItemEnabled( backwardId, FALSE); connect( browser, SIGNAL( backwardAvailable( bool ) ), this, SLOT( setBackwardAvailable( bool ) ) ); connect( browser, SIGNAL( forwardAvailable( bool ) ), this, SLOT( setForwardAvailable( bool ) ) ); QToolBar* toolbar = new QToolBar( this ); addToolBar( toolbar, "Toolbar"); QToolButton* button; button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar ); connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar ); connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) ); button->setEnabled( FALSE ); button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar ); toolbar->addSeparator(); pathCombo = new QComboBox( TRUE, toolbar ); connect( pathCombo, SIGNAL( activated( const QString & ) ), this, SLOT( pathSelected( const QString & ) ) ); toolbar->setStretchableWidget( pathCombo ); setRightJustification( TRUE ); setDockEnabled( DockLeft, FALSE ); setDockEnabled( DockRight, FALSE ); pathCombo->insertItem( home_ ); browser->setFocus(); }
int main(int argc, char *argv[]) { uiInitOptions o; int i; const char *err; uiWindow *w; uiBox *page2, *page3, *page4, *page5; uiBox *page6, *page7, *page8, *page9, *page10; uiBox *page11, *page12, *page13; uiTab *page14; uiBox *page15; uiBox *page16; uiTab *outerTab; uiTab *innerTab; int nomenus = 0; int startspaced = 0; int steps = 0; newhbox = uiNewHorizontalBox; newvbox = uiNewVerticalBox; memset(&o, 0, sizeof (uiInitOptions)); for (i = 1; i < argc; i++) if (strcmp(argv[i], "nomenus") == 0) nomenus = 1; else if (strcmp(argv[i], "startspaced") == 0) startspaced = 1; else if (strcmp(argv[i], "swaphv") == 0) { newhbox = uiNewVerticalBox; newvbox = uiNewHorizontalBox; } else if (strcmp(argv[i], "steps") == 0) steps = 1; else { fprintf(stderr, "%s: unrecognized option %s\n", argv[0], argv[i]); return 1; } err = uiInit(&o); if (err != NULL) { fprintf(stderr, "error initializing ui: %s\n", err); uiFreeInitError(err); return 1; } if (!nomenus) initMenus(); w = newWindow("Main Window", 320, 240, 1); uiWindowOnClosing(w, onClosing, NULL); printf("main window %p\n", (void *) w); uiOnShouldQuit(onShouldQuit, w); mainBox = newHorizontalBox(); uiWindowSetChild(w, uiControl(mainBox)); outerTab = newTab(); uiBoxAppend(mainBox, uiControl(outerTab), 1); mainTab = newTab(); uiTabAppend(outerTab, "Pages 1-5", uiControl(mainTab)); // page 1 uses page 2's uiGroup page2 = makePage2(); makePage1(w); uiTabAppend(mainTab, "Page 1", uiControl(page1)); uiTabAppend(mainTab, "Page 2", uiControl(page2)); uiTabAppend(mainTab, "Empty Page", uiControl(uiNewHorizontalBox())); page3 = makePage3(); uiTabAppend(mainTab, "Page 3", uiControl(page3)); page4 = makePage4(); uiTabAppend(mainTab, "Page 4", uiControl(page4)); page5 = makePage5(w); uiTabAppend(mainTab, "Page 5", uiControl(page5)); innerTab = newTab(); uiTabAppend(outerTab, "Pages 6-10", uiControl(innerTab)); page6 = makePage6(); uiTabAppend(innerTab, "Page 6", uiControl(page6)); page7 = makePage7(); uiTabAppend(innerTab, "Page 7", uiControl(page7)); /* page8 = makePage8(); uiTabAppend(innerTab, "Page 8", uiControl(page8)); page9 = makePage9(); uiTabAppend(innerTab, "Page 9", uiControl(page9)); page10 = makePage10(); uiTabAppend(innerTab, "Page 10", uiControl(page10)); */ innerTab = newTab(); uiTabAppend(outerTab, "Pages 11-15", uiControl(innerTab)); // page11 = makePage11(); // uiTabAppend(innerTab, "Page 11", uiControl(page11)); page12 = makePage12(); uiTabAppend(innerTab, "Page 12", uiControl(page12)); page13 = makePage13(); uiTabAppend(innerTab, "Page 13", uiControl(page13)); page14 = makePage14(); uiTabAppend(innerTab, "Page 14", uiControl(page14)); page15 = makePage15(w); uiTabAppend(innerTab, "Page 15", uiControl(page15)); innerTab = newTab(); uiTabAppend(outerTab, "Pages 16-?", uiControl(innerTab)); page16 = makePage16(); uiTabAppend(innerTab, "Page 16", uiControl(page16)); if (startspaced) setSpaced(1); uiControlShow(uiControl(w)); if (!steps) uiMain(); else { uiMainSteps(); while (uiMainStep(1)) ; } printf("after uiMain()\n"); freePage16(); uiUninit(); printf("after uiUninit()\n"); return 0; }
void KateMainWindow::setupActions() { KAction *a; actionCollection()->addAction( KStandardAction::New, "file_new", m_viewManager, SLOT(slotDocumentNew()) ) ->setWhatsThis(i18n("Create a new document")); actionCollection()->addAction( KStandardAction::Open, "file_open", m_viewManager, SLOT(slotDocumentOpen()) ) ->setWhatsThis(i18n("Open an existing document for editing")); fileOpenRecent = KStandardAction::openRecent (m_viewManager, SLOT(openUrl(KUrl)), this); actionCollection()->addAction(fileOpenRecent->objectName(), fileOpenRecent); fileOpenRecent->setWhatsThis(i18n("This lists files which you have opened recently, and allows you to easily open them again.")); a = actionCollection()->addAction( "file_save_all" ); a->setIcon( KIcon("document-save-all") ); a->setText( i18n("Save A&ll") ); a->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_L) ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(saveAll()) ); a->setWhatsThis(i18n("Save all open, modified documents to disk.")); a = actionCollection()->addAction( "file_reload_all" ); a->setText( i18n("&Reload All") ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(reloadAll()) ); a->setWhatsThis(i18n("Reload all open documents.")); a = actionCollection()->addAction( "file_close_orphaned" ); a->setText( i18n("Close Orphaned") ); connect( a, SIGNAL(triggered()), KateDocManager::self(), SLOT(closeOrphaned()) ); a->setWhatsThis(i18n("Close all documents in the file list that could not be reopened, because they are not accessible anymore.")); actionCollection()->addAction( KStandardAction::Close, "file_close", m_viewManager, SLOT(slotDocumentClose()) ) ->setWhatsThis(i18n("Close the current document.")); a = actionCollection()->addAction( "file_close_other" ); a->setText( i18n( "Close Other" ) ); connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()) ); a->setWhatsThis(i18n("Close other open documents.")); a = actionCollection()->addAction( "file_close_all" ); a->setText( i18n( "Clos&e All" ) ); connect( a, SIGNAL(triggered()), this, SLOT(slotDocumentCloseAll()) ); a->setWhatsThis(i18n("Close all open documents.")); a = actionCollection()->addAction( KStandardAction::Quit, "file_quit" ); // Qt::QueuedConnection: delay real shutdown, as we are inside menu action handling (bug #185708) connect( a, SIGNAL(triggered()), this, SLOT(slotFileQuit()), Qt::QueuedConnection ); a->setWhatsThis(i18n("Close this window")); a = actionCollection()->addAction( "view_new_view" ); a->setIcon( KIcon("window-new") ); a->setText( i18n("&New Window") ); connect( a, SIGNAL(triggered()), this, SLOT(newWindow()) ); a->setWhatsThis(i18n("Create a new Kate view (a new window with the same document list).")); KToggleAction* showFullScreenAction = KStandardAction::fullScreen( 0, 0, this, this); actionCollection()->addAction( showFullScreenAction->objectName(), showFullScreenAction ); connect( showFullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotFullScreen(bool))); documentOpenWith = new KActionMenu(i18n("Open W&ith"), this); actionCollection()->addAction("file_open_with", documentOpenWith); documentOpenWith->setWhatsThis(i18n("Open the current document using another application registered for its file type, or an application of your choice.")); connect(documentOpenWith->menu(), SIGNAL(aboutToShow()), this, SLOT(mSlotFixOpenWithMenu())); connect(documentOpenWith->menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotOpenWithMenuAction(QAction*))); a = KStandardAction::keyBindings(this, SLOT(editKeys()), actionCollection()); a->setWhatsThis(i18n("Configure the application's keyboard shortcut assignments.")); a = KStandardAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection()); a->setWhatsThis(i18n("Configure which items should appear in the toolbar(s).")); QAction* settingsConfigure = KStandardAction::preferences(this, SLOT(slotConfigure()), actionCollection()); settingsConfigure->setWhatsThis(i18n("Configure various aspects of this application and the editing component.")); // tip of the day :-) actionCollection()->addAction( KStandardAction::TipofDay, this, SLOT(tipOfTheDay()) ) ->setWhatsThis(i18n("This shows useful tips on the use of this application.")); if (KatePluginManager::self()->pluginList().count() > 0) { a = actionCollection()->addAction( "help_plugins_contents" ); a->setText( i18n("&Plugins Handbook") ); connect( a, SIGNAL(triggered()), this, SLOT(pluginHelp()) ); a->setWhatsThis(i18n("This shows help files for various available plugins.")); } a = actionCollection()->addAction( "help_about_editor" ); a->setText( i18n("&About Editor Component") ); connect( a, SIGNAL(triggered()), this, SLOT(aboutEditor()) ); connect(m_viewManager, SIGNAL(viewChanged()), m_mainWindow, SIGNAL(viewChanged())); connect(m_viewManager, SIGNAL(viewCreated(KTextEditor::View*)), m_mainWindow, SIGNAL(viewCreated(KTextEditor::View*))); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotWindowActivated())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateOpenWith())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateBottomViewBar())); connect(m_viewManager, SIGNAL(viewChanged()), this, SLOT(slotUpdateTopViewBar())); slotWindowActivated (); // session actions a = actionCollection()->addAction( "sessions_new" ); a->setIcon( KIcon("document-new") ); a->setText( i18nc("Menu entry Session->New", "&New") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionNew()), Qt::QueuedConnection ); a = actionCollection()->addAction( "sessions_open" ); a->setIcon( KIcon("document-open") ); a->setText( i18n("&Open Session") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionOpen()), Qt::QueuedConnection ); a = actionCollection()->addAction( "sessions_save" ); a->setIcon( KIcon("document-save") ); a->setText( i18n("&Save Session") ); connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSave()) ); a = actionCollection()->addAction( "sessions_save_as" ); a->setIcon( KIcon("document-save-as") ); a->setText( i18n("Save Session &As...") ); connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionSaveAs()) ); a = actionCollection()->addAction( "sessions_manage" ); a->setIcon( KIcon("view-choose") ); a->setText( i18n("&Manage Sessions...") ); // Qt::QueuedConnection to avoid deletion of code that is executed when reducing the amount of mainwindows. (bug #227008) connect( a, SIGNAL(triggered()), KateSessionManager::self(), SLOT(sessionManage()), Qt::QueuedConnection ); // quick open menu ;) a = new KateSessionsAction (i18n("&Quick Open Session"), this); actionCollection()->addAction("sessions_list", a); }
MainWindow::MainWindow(const QUrl& url) { progress = 0; QFile file; file.setFileName(":/jquery.min.js"); file.open(QIODevice::ReadOnly); jQuery = file.readAll(); jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };"); file.close(); //! [1] QNetworkProxyFactory::setUseSystemConfiguration(true); //! [2] view = new QWebView(this); view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); locationEdit = new QLineEdit(this); locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy()); connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); QToolBar *toolBar = addToolBar(tr("导航")); toolBar->addAction(view->pageAction(QWebPage::Back)); toolBar->addAction(view->pageAction(QWebPage::Forward)); toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); //! [2] QMenu *fileMenu = menuBar()->addMenu(tr("文件(&F)")); QAction *newWindowAction = new QAction(tr("新建窗口"),this); connect(newWindowAction, SIGNAL(triggered()),SLOT(newWindow())); fileMenu->addAction(newWindowAction); QAction *closeWindowAction = new QAction(tr("关闭窗口"),this); connect(closeWindowAction, SIGNAL(triggered()),SLOT(closeWindow())); fileMenu->addAction(closeWindowAction); QMenu *viewMenu = menuBar()->addMenu(tr("查看(&V)")); QAction* viewSourceAction = new QAction(tr("页面源代码"), this); connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource())); viewMenu->addAction(view->pageAction(QWebPage::Stop)); viewMenu->addAction(view->pageAction(QWebPage::Reload)); viewMenu->addSeparator(); viewMenu->addAction(viewSourceAction); //! [3] QMenu *historyMenu = menuBar()->addMenu(tr("历史(&H)")); historyMenu->addAction(view->pageAction(QWebPage::Back)); historyMenu->addAction(view->pageAction(QWebPage::Forward)); QMenu *effectMenu = menuBar()->addMenu(tr("效果(&E)")); effectMenu->addAction(tr("高亮所有链接"), this, SLOT(highlightAllLinks())); rotateAction = new QAction(this); rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView)); rotateAction->setCheckable(true); rotateAction->setText(tr("倒转图像")); connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool))); effectMenu->addAction(rotateAction); QMenu *toolsMenu = menuBar()->addMenu(tr("工具(&T)")); toolsMenu->addAction(tr("移除 GIF 动画"), this, SLOT(removeGifImages())); toolsMenu->addAction(tr("移除所有内联框架"), this, SLOT(removeInlineFrames())); toolsMenu->addAction(tr("移除所有对象元素"), this, SLOT(removeObjectElements())); toolsMenu->addAction(tr("移除所有嵌入元素"), this, SLOT(removeEmbeddedElements())); QMenu *helpMenu = menuBar()->addMenu(tr("帮助(&H)")); helpMenu->addAction(tr("关于 Looplorer"), this, SLOT(aboutLooplorer())); setCentralWidget(view); setUnifiedTitleAndToolBarOnMac(true); view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); clickLink(); windowNum++; }
/* In the constructor, we just pass the standard parameters on to QWidget. The menu uses a single slot to simplify the process of adding more items to the options menu. */ ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags ) : QWidget( parent, name, wFlags ), conversion_flags( PreferDither ), helpmsg( 0 ) { pickx = -1; picky = -1; clickx = -1; clicky = -1; alloc_context = 0; menubar = new QMenuBar(this); menubar->setSeparator( QMenuBar::InWindowsStyle ); QStrList fmt = QImage::outputFormats(); saveimage = new QPopupMenu( menubar ); savepixmap = new QPopupMenu( menubar ); for (const char* f = fmt.first(); f; f = fmt.next()) { saveimage->insertItem( f ); savepixmap->insertItem( f ); } connect( saveimage, SIGNAL(activated(int)), this, SLOT(saveImage(int)) ); connect( savepixmap, SIGNAL(activated(int)), this, SLOT(savePixmap(int)) ); file = new QPopupMenu( menubar ); menubar->insertItem( "&File", file ); file->insertItem( "&New window", this, SLOT(newWindow()), CTRL+Key_N ); file->insertItem( "&Open...", this, SLOT(openFile()), CTRL+Key_O ); si = file->insertItem( "Save image", saveimage ); sp = file->insertItem( "Save pixmap", savepixmap ); file->insertSeparator(); file->insertItem( "E&xit", qApp, SLOT(quit()), CTRL+Key_Q ); edit = new QPopupMenu( menubar ); menubar->insertItem( "&Edit", edit ); edit->insertItem("&Copy", this, SLOT(copy()), CTRL+Key_C); edit->insertItem("&Paste", this, SLOT(paste()), CTRL+Key_V); edit->insertSeparator(); edit->insertItem("&Horizontal flip", this, SLOT(hFlip()), ALT+Key_H); edit->insertItem("&Vertical flip", this, SLOT(vFlip()), ALT+Key_V); edit->insertItem("&Rotate 180", this, SLOT(rot180()), ALT+Key_R); edit->insertSeparator(); edit->insertItem("&Text...", this, SLOT(editText())); edit->insertSeparator(); t1 = edit->insertItem( "Convert to &1 bit", this, SLOT(to1Bit()) ); t8 = edit->insertItem( "Convert to &8 bit", this, SLOT(to8Bit()) ); t32 = edit->insertItem( "Convert to &32 bit", this, SLOT(to32Bit()) ); options = new QPopupMenu( menubar ); menubar->insertItem( "&Options", options ); ac = options->insertItem( "AutoColor" ); co = options->insertItem( "ColorOnly" ); mo = options->insertItem( "MonoOnly" ); options->insertSeparator(); fd = options->insertItem( "DiffuseDither" ); bd = options->insertItem( "OrderedDither" ); td = options->insertItem( "ThresholdDither" ); options->insertSeparator(); ta = options->insertItem( "ThresholdAlphaDither" ); ba = options->insertItem( "OrderedAlphaDither" ); fa = options->insertItem( "DiffuseAlphaDither" ); options->insertSeparator(); ad = options->insertItem( "PreferDither" ); dd = options->insertItem( "AvoidDither" ); options->insertSeparator(); ss = options->insertItem( "Smooth scaling" ); cc = options->insertItem( "Use color context" ); if ( QApplication::colorSpec() == QApplication::ManyColor ) options->setItemEnabled( cc, FALSE ); options->setCheckable( TRUE ); setMenuItemFlags(); menubar->insertSeparator(); QPopupMenu* help = new QPopupMenu( menubar ); menubar->insertItem( "&Help", help ); help->insertItem( "Help!", this, SLOT(giveHelp()), CTRL+Key_H ); connect( options, SIGNAL(activated(int)), this, SLOT(doOption(int)) ); status = new QLabel(this); status->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); status->setFixedHeight( fontMetrics().height() + 4 ); setMouseTracking( TRUE ); }
void LLPanelMainInventory::onCustomAction(const LLSD& userdata) { if (!isActionEnabled(userdata)) return; const std::string command_name = userdata.asString(); if (command_name == "new_window") { newWindow(); } if (command_name == "sort_by_name") { const LLSD arg = "name"; setSortBy(arg); } if (command_name == "sort_by_recent") { const LLSD arg = "date"; setSortBy(arg); } if (command_name == "show_filters") { toggleFindOptions(); } if (command_name == "reset_filters") { resetFilters(); } if (command_name == "close_folders") { closeAllFolders(); } if (command_name == "empty_trash") { const std::string notification = "ConfirmEmptyTrash"; gInventory.emptyFolderType(notification, LLFolderType::FT_TRASH); } if (command_name == "empty_lostnfound") { const std::string notification = "ConfirmEmptyLostAndFound"; gInventory.emptyFolderType(notification, LLFolderType::FT_LOST_AND_FOUND); } if (command_name == "save_texture") { saveTexture(userdata); } // This doesn't currently work, since the viewer can't change an assetID an item. if (command_name == "regenerate_link") { LLInventoryPanel *active_panel = getActivePanel(); LLFolderViewItem* current_item = active_panel->getRootFolder()->getCurSelectedItem(); if (!current_item) { return; } const LLUUID item_id = current_item->getListener()->getUUID(); LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) { item->regenerateLink(); } active_panel->setSelection(item_id, TAKE_FOCUS_NO); } if (command_name == "find_original") { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { return; } current_item->getListener()->performAction(getActivePanel()->getModel(), "goto"); } if (command_name == "find_links") { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) { return; } const LLUUID& item_id = current_item->getListener()->getUUID(); const std::string &item_name = current_item->getListener()->getName(); mFilterSubString = item_name; LLInventoryFilter *filter = mActivePanel->getFilter(); filter->setFilterSubString(item_name); mFilterEditor->setText(item_name); mFilterEditor->setFocus(TRUE); filter->setFilterUUID(item_id); filter->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); filter->setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS); } }