void StudyAidController::openNewWindow() { StudyAid *window = new StudyAid(modelSignaller); window->setWindowTitle("StudyAid"); window->show(); connect(window, SIGNAL(requestNewWindow()), this, SLOT(openNewWindow())); }
int Assignment2::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: openNewWindow(); break; default: ; } _id -= 1; } return _id; }
//Do zrobienia(?): przerzuciæ obs³ugê slotów (open, close) do engine'u? MWindow::MWindow(){ #ifdef MYDEBUG qDebug() << "Startuje konstruktor MWindow()"; #endif //Tworzenie silnika engine = new MEngine; //Akcje do menu File openAction = new QAction(tr("&Otworz graf"), this); closeAction = new QAction(tr("&Zamknij graf"), this); saveOneAction = new QAction(tr("&Zapisz rezultat"), this); //saveAllAction = new QAction(tr("Sa&ve all"), this); newWindowAction = new QAction(tr("&Rysuj!"), this); //Tworzy nowe okienko exitAction = new QAction(tr("Wyjscie"), this); //Akcje do menu Algorithm BFSAction = new QAction(tr("BFS"), this); DFSAction = new QAction(tr("DFS"), this); transposeAction = new QAction(tr("Transponuj"), this); toUdirectedAction = new QAction(tr("Symetryzuj"), this); stronglyConnectedAction = new QAction(tr("Silnie spojne skladowe"), this); graphColoringAction = new QAction(tr("Kolorowanie wierzcholkowe"), this); //Akcje do menu About displayHelpAction = new QAction(tr("&Pomoc"), this); displayAuthorsAction = new QAction(tr("Autorzy"), this); displayAboutQtAction = new QAction(tr("Info o Qt"), this); // closeAction->setEnabled(false); saveOneAction->setEnabled(false); //saveAllAction->setEnabled(false); newWindowAction->setEnabled(false); BFSAction->setEnabled(false); DFSAction->setEnabled(false); transposeAction->setEnabled(false); toUdirectedAction->setEnabled(false); displayHelpAction->setEnabled(false); stronglyConnectedAction->setEnabled(false); graphColoringAction->setEnabled(false); // connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(closeAction, SIGNAL(triggered()), this , SLOT(closeGraph())); connect(saveOneAction, SIGNAL(triggered()), this, SLOT(save())); connect(newWindowAction, SIGNAL(triggered()), this, SLOT(openNewWindow())); connect(exitAction, SIGNAL(triggered()), this, SLOT(quit())); // connect(BFSAction, SIGNAL(triggered()), this, SLOT(BFS())); connect(DFSAction, SIGNAL(triggered()), this, SLOT(DFS())); connect(transposeAction, SIGNAL(triggered()), this, SLOT(transpose())); connect(toUdirectedAction, SIGNAL(triggered()), this, SLOT(toUndirected())); connect(stronglyConnectedAction, SIGNAL(triggered()), this, SLOT(stronglyConnected())); connect(graphColoringAction, SIGNAL(triggered()), this, SLOT(graphColoring())); //countOrderAction = new QAction(tr("Count order"), this); //checkAdjacencyAction = new QAction(tr("Check adjacency"), this); //isSubgraphAction = new QAction(tr("Is subgraph"), this); connect(displayAuthorsAction, SIGNAL(triggered()), this, SLOT(authors())); connect(displayAboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); // //Dodawanie akcji do MenuBar fileMenu = menuBar()->addMenu(tr("&Plik")); fileMenu->addAction(openAction); fileMenu->addAction(saveOneAction); fileMenu->addAction(newWindowAction); fileMenu->addAction(closeAction); //fileMenu->addAction(saveAllAction); fileMenu->addSeparator(); fileMenu->addAction(exitAction); algorithmMenu = menuBar()->addMenu(tr("Algorytmy")); //algorithmMenu->addAction(countOrderAction); algorithmMenu->addAction(BFSAction); algorithmMenu->addAction(DFSAction); algorithmMenu->addSeparator(); algorithmMenu->addAction(transposeAction); algorithmMenu->addAction(toUdirectedAction); //algorithmMenu->addAction(stronglyConnectedAction); algorithmMenu->addSeparator(); algorithmMenu->addAction(graphColoringAction); //algorithmMenu->addAction(checkAdjacencyAction); //algorithmMenu->addAction(isSubgraphAction); aboutMenu = menuBar()->addMenu(tr("O programie")); aboutMenu->addAction(displayHelpAction); aboutMenu->addAction(displayAuthorsAction); aboutMenu->addAction(displayAboutQtAction); // statusBarPtr = statusBar();// Ustawia pasek stanu statusBarPtr->showMessage(tr("Gotowy")); //POPRACOWAÆ NAD TYM NP DODAÆ WID¯ET QPROGRESSBAR LUB QLABEL // centralWidgetPtr = new MCentral; setCentralWidget(centralWidgetPtr); // secondWindow = NULL; //Inicjalizacja wskaŸnika na nowe okno // msgBox.setWindowTitle("Autor"); msgBox.setText(tr("Autor: \nKamil Burzynski.\nAlgorytmy na Grafach 2012\nUKSW")); // applicationName = tr("AGR v 0.4"); setWindowTitle(applicationName); setMinimumSize(400, 400); // opened = 0; // options = NULL; #ifdef MYDEBUG qDebug() << "Konczy konstruktor MWindow()"; #endif }
void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) { ASSERT(item->type() == ActionType || item->type() == CheckableActionType); if (item->action() >= ContextMenuItemBaseApplicationTag) { m_client->contextMenuItemSelected(item, m_contextMenu.get()); return; } if (item->action() >= ContextMenuItemBaseCustomTag) { ASSERT(m_menuProvider); m_menuProvider->contextMenuItemSelected(item); return; } HitTestResult result = m_contextMenu->hitTestResult(); Frame* frame = result.innerNonSharedNode()->document()->frame(); if (!frame) return; switch (item->action()) { case ContextMenuItemTagOpenLinkInNewWindow: openNewWindow(result.absoluteLinkURL(), frame); break; case ContextMenuItemTagDownloadLinkToDisk: // FIXME: Some day we should be able to do this from within WebCore. m_client->downloadURL(result.absoluteLinkURL()); break; case ContextMenuItemTagCopyLinkToClipboard: frame->editor()->copyURL(result.absoluteLinkURL(), result.textContent()); break; case ContextMenuItemTagOpenImageInNewWindow: openNewWindow(result.absoluteImageURL(), frame); break; case ContextMenuItemTagDownloadImageToDisk: // FIXME: Some day we should be able to do this from within WebCore. m_client->downloadURL(result.absoluteImageURL()); break; case ContextMenuItemTagCopyImageToClipboard: // FIXME: The Pasteboard class is not written yet // For now, call into the client. This is temporary! frame->editor()->copyImage(result); break; case ContextMenuItemTagOpenMediaInNewWindow: openNewWindow(result.absoluteMediaURL(), frame); break; case ContextMenuItemTagCopyMediaLinkToClipboard: frame->editor()->copyURL(result.absoluteMediaURL(), result.textContent()); break; case ContextMenuItemTagToggleMediaControls: result.toggleMediaControlsDisplay(); break; case ContextMenuItemTagToggleMediaLoop: result.toggleMediaLoopPlayback(); break; case ContextMenuItemTagEnterVideoFullscreen: result.enterFullscreenForVideo(); break; case ContextMenuItemTagMediaPlayPause: result.toggleMediaPlayState(); break; case ContextMenuItemTagMediaMute: result.toggleMediaMuteState(); break; case ContextMenuItemTagOpenFrameInNewWindow: { DocumentLoader* loader = frame->loader()->documentLoader(); if (!loader->unreachableURL().isEmpty()) openNewWindow(loader->unreachableURL(), frame); else openNewWindow(loader->url(), frame); break; } case ContextMenuItemTagCopy: frame->editor()->copy(); break; case ContextMenuItemTagGoBack: if (Page* page = frame->page()) page->goBackOrForward(-1); break; case ContextMenuItemTagGoForward: if (Page* page = frame->page()) page->goBackOrForward(1); break; case ContextMenuItemTagStop: frame->loader()->stop(); break; case ContextMenuItemTagReload: frame->loader()->reload(); break; case ContextMenuItemTagCut: frame->editor()->cut(); break; case ContextMenuItemTagPaste: frame->editor()->paste(); break; #if PLATFORM(GTK) case ContextMenuItemTagDelete: frame->editor()->performDelete(); break; case ContextMenuItemTagSelectAll: frame->editor()->command("SelectAll").execute(); break; #endif case ContextMenuItemTagSpellingGuess: ASSERT(frame->editor()->selectedText().length()); if (frame->editor()->shouldInsertText(item->title(), frame->selection()->toNormalizedRange().get(), EditorInsertActionPasted)) { Document* document = frame->document(); RefPtr<ReplaceSelectionCommand> command = ReplaceSelectionCommand::create(document, createFragmentFromMarkup(document, item->title(), ""), true, false, true); applyCommand(command); frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); } break; case ContextMenuItemTagIgnoreSpelling: frame->editor()->ignoreSpelling(); break; case ContextMenuItemTagLearnSpelling: frame->editor()->learnSpelling(); break; case ContextMenuItemTagSearchWeb: m_client->searchWithGoogle(frame); break; case ContextMenuItemTagLookUpInDictionary: // FIXME: Some day we may be able to do this from within WebCore. m_client->lookUpInDictionary(frame); break; case ContextMenuItemTagOpenLink: if (Frame* targetFrame = result.targetFrame()) targetFrame->loader()->loadFrameRequest(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(), frame->loader()->outgoingReferrer())), false, false, 0, 0, SendReferrer); else openNewWindow(result.absoluteLinkURL(), frame); break; case ContextMenuItemTagBold: frame->editor()->command("ToggleBold").execute(); break; case ContextMenuItemTagItalic: frame->editor()->command("ToggleItalic").execute(); break; case ContextMenuItemTagUnderline: frame->editor()->toggleUnderline(); break; case ContextMenuItemTagOutline: // We actually never enable this because CSS does not have a way to specify an outline font, // which may make this difficult to implement. Maybe a special case of text-shadow? break; case ContextMenuItemTagStartSpeaking: { ExceptionCode ec; RefPtr<Range> selectedRange = frame->selection()->toNormalizedRange(); if (!selectedRange || selectedRange->collapsed(ec)) { Document* document = result.innerNonSharedNode()->document(); selectedRange = document->createRange(); selectedRange->selectNode(document->documentElement(), ec); } m_client->speak(plainText(selectedRange.get())); break; } case ContextMenuItemTagStopSpeaking: m_client->stopSpeaking(); break; case ContextMenuItemTagDefaultDirection: frame->editor()->setBaseWritingDirection(NaturalWritingDirection); break; case ContextMenuItemTagLeftToRight: frame->editor()->setBaseWritingDirection(LeftToRightWritingDirection); break; case ContextMenuItemTagRightToLeft: frame->editor()->setBaseWritingDirection(RightToLeftWritingDirection); break; case ContextMenuItemTagTextDirectionDefault: frame->editor()->command("MakeTextWritingDirectionNatural").execute(); break; case ContextMenuItemTagTextDirectionLeftToRight: frame->editor()->command("MakeTextWritingDirectionLeftToRight").execute(); break; case ContextMenuItemTagTextDirectionRightToLeft: frame->editor()->command("MakeTextWritingDirectionRightToLeft").execute(); break; #if PLATFORM(MAC) case ContextMenuItemTagSearchInSpotlight: m_client->searchWithSpotlight(); break; #endif case ContextMenuItemTagShowSpellingPanel: frame->editor()->showSpellingGuessPanel(); break; case ContextMenuItemTagCheckSpelling: frame->editor()->advanceToNextMisspelling(); break; case ContextMenuItemTagCheckSpellingWhileTyping: frame->editor()->toggleContinuousSpellChecking(); break; #ifndef BUILDING_ON_TIGER case ContextMenuItemTagCheckGrammarWithSpelling: frame->editor()->toggleGrammarChecking(); break; #endif #if PLATFORM(MAC) case ContextMenuItemTagShowFonts: frame->editor()->showFontPanel(); break; case ContextMenuItemTagStyles: frame->editor()->showStylesPanel(); break; case ContextMenuItemTagShowColors: frame->editor()->showColorPanel(); break; #endif #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) case ContextMenuItemTagMakeUpperCase: frame->editor()->uppercaseWord(); break; case ContextMenuItemTagMakeLowerCase: frame->editor()->lowercaseWord(); break; case ContextMenuItemTagCapitalize: frame->editor()->capitalizeWord(); break; case ContextMenuItemTagShowSubstitutions: frame->editor()->showSubstitutionsPanel(); break; case ContextMenuItemTagSmartCopyPaste: frame->editor()->toggleSmartInsertDelete(); break; case ContextMenuItemTagSmartQuotes: frame->editor()->toggleAutomaticQuoteSubstitution(); break; case ContextMenuItemTagSmartDashes: frame->editor()->toggleAutomaticDashSubstitution(); break; case ContextMenuItemTagSmartLinks: frame->editor()->toggleAutomaticLinkDetection(); break; case ContextMenuItemTagTextReplacement: frame->editor()->toggleAutomaticTextReplacement(); break; case ContextMenuItemTagCorrectSpellingAutomatically: frame->editor()->toggleAutomaticSpellingCorrection(); break; case ContextMenuItemTagChangeBack: frame->editor()->changeBackToReplacedString(result.replacedString()); break; #endif #if ENABLE(INSPECTOR) case ContextMenuItemTagInspectElement: if (Page* page = frame->page()) page->inspectorController()->inspect(result.innerNonSharedNode()); break; #endif default: break; } }