KstApp::KstApp(QWidget *parent, const char* name) : KMainWindow(parent, name) { clearWFlags(WDestructiveClose); stopping = false; config = kapp->config(); initStatusBar(); initDocument(); initView(); /* create dialogs */ debugDialog = new KstDebugDialogI(this); plotDialog = new KstPlotDialogI(doc, this); dataManager = new KstDataManagerI(doc, this); filterListEditor = new FilterListEditor(this); viewScalarsDialog = new KstViewScalarsDialogI(this); viewVectorsDialog = new KstViewVectorsDialogI(this); changeFileDialog = new KstChangeFileDialogI(this); changeNptsDialog = new KstChangeNptsDialogI(this); quickCurvesDialog = new KstQuickCurvesDialogI(this); quickPSDDialog = new KstQuickPSDDialogI(this); graphFileDialog = new KstGraphFileDialogI(this); vectorSaveDialog = new VectorSaveDialog(this); connect(KstVectorDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstCurveDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstEqDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstHsDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstPsdDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstPluginDialogI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); connect(KstEventMonitorI::globalInstance(), SIGNAL(modified()), doc, SLOT(wasModified())); initActions(); readOptions(); _updateThread = new UpdateThread(doc); _updateThread->setUpdateTime(KstSettings::globalSettings()->plotUpdateTimer); _updateThread->start(); connect(doc, SIGNAL(newFrameMsg(int)), this, SLOT(slotUpdateFrameMsg(int))); connect(view, SIGNAL(newStatusMsg(const QString &)), this, SLOT(slotUpdateStatusMsg(const QString &))); connect(view, SIGNAL(newDataMsg(const QString &)), this, SLOT(slotUpdateDataMsg(const QString &))); /*** Plot Dialog signals */ connect(changeFileDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(changeNptsDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(quickCurvesDialog,SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(quickPSDDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(filterListEditor, SIGNAL(docChanged()), this, SLOT(registerDocChange())); connect(graphFileDialog, SIGNAL(graphFileReq(const QString &,int,int)), view, SLOT(printToGraphicsFile(const QString &,int,int))); /*** label dialog ***/ connect(view->labelDialog, SIGNAL(applied()), this, SLOT(registerDocChange())); /*** plot dialog ***/ connect(plotDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange())); /*** ***/ connect(doc, SIGNAL(dataChanged()), this, SLOT(updateDialogs())); connect(dataManager, SIGNAL(editDataVector(const QString &)), KstVectorDialogI::globalInstance(), SLOT(show_I(const QString &))); connect(dataManager->OpenPlotDialog, SIGNAL(clicked()), this, SLOT(showPlotDialog())); setAutoSaveSettings("KST-KMainWindow", true); _dcopIface = new KstIfaceImpl(doc, this); view->forceUpdate(); connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged())); QTimer::singleShot(0, this, SLOT(updateActions())); // Load any extensions ExtensionMgr *mgr = ExtensionMgr::self(); mgr->setWindow(this); KService::List sl = KServiceType::offers("Kst Extension"); for (KService::List::ConstIterator it = sl.begin(); it != sl.end(); ++it) { KService::Ptr service = *it; QString name = service->property("Name").toString(); if (!mgr->enabled(name) && !service->property("X-Kst-Enabled").toBool()) { continue; } mgr->loadExtension(service); } }
void RichTextEditor::on_qteRichText_cursorPositionChanged() { updateActions(); }
Private(ContactListAccountMenu* menu, ContactListAccountGroup* _account) : QObject(0) , account(_account) , menu_(menu) { connect(menu, SIGNAL(aboutToShow()), SLOT(updateActions())); connect(account->account(), SIGNAL(updatedActivity()), SLOT(updateActions())); connect(account->account(), SIGNAL(updatedAccount()), SLOT(updateActions())); statusMenu_ = new StatusMenu(0); statusMenu_->setTitle(tr("&Status")); connect(statusMenu_, SIGNAL(statusChanged(XMPP::Status::Type)), SLOT(statusChanged(XMPP::Status::Type))); moodAction_ = new QAction(tr("Mood"), this); connect(moodAction_, SIGNAL(triggered()), SLOT(setMood())); setAvatarAction_ = new QAction(tr("Set Avatar"), this); connect(setAvatarAction_, SIGNAL(triggered()), SLOT(setAvatar())); unsetAvatarAction_ = new QAction(tr("Unset Avatar"), this); connect(unsetAvatarAction_, SIGNAL(triggered()), SLOT(unsetAvatar())); bookmarksManageAction_ = new QAction(tr("Manage..."), this); connect(bookmarksManageAction_, SIGNAL(triggered()), SLOT(bookmarksManage())); addContactAction_ = new IconAction(tr("&Add a Contact"), this, "psi/addContact"); connect(addContactAction_, SIGNAL(triggered()), SLOT(addContact())); serviceDiscoveryAction_ = new IconAction(tr("Service &Discovery"), this, "psi/disco"); connect(serviceDiscoveryAction_, SIGNAL(triggered()), SLOT(serviceDiscovery())); newMessageAction_ = new IconAction(tr("New &Blank Message"), this, "psi/sendMessage"); connect(newMessageAction_, SIGNAL(triggered()), SLOT(newMessage())); xmlConsoleAction_ = new IconAction(tr("&XML Console"), this, "psi/xml"); connect(xmlConsoleAction_, SIGNAL(triggered()), SLOT(xmlConsole())); modifyAccountAction_ = new IconAction(tr("&Modify Account..."), this, "psi/account"); connect(modifyAccountAction_, SIGNAL(triggered()), SLOT(modifyAccount())); adminOnlineUsersAction_ = new IconAction(tr("Online Users"), this, "psi/disco"); connect(adminOnlineUsersAction_, SIGNAL(triggered()), SLOT(adminOnlineUsers())); adminSendServerMessageAction_ = new IconAction(tr("Send Server Message"), this, "psi/sendMessage"); connect(adminSendServerMessageAction_, SIGNAL(triggered()), SLOT(adminSendServerMessage())); adminSetMotdAction_ = new QAction(tr("Set MOTD"), this); connect(adminSetMotdAction_, SIGNAL(triggered()), SLOT(adminSetMotd())); adminUpdateMotdAction_ = new QAction(tr("Update MOTD"), this); connect(adminUpdateMotdAction_, SIGNAL(triggered()), SLOT(adminUpdateMotd())); adminDeleteMotdAction_ = new IconAction(tr("Delete MOTD"), this, "psi/remove"); connect(adminDeleteMotdAction_, SIGNAL(triggered()), SLOT(adminDeleteMotd())); menu->addMenu(statusMenu_); menu->addAction(moodAction_); avatarMenu_ = menu->addMenu(tr("Avatar")); avatarMenu_->addAction(setAvatarAction_); avatarMenu_->addAction(unsetAvatarAction_); bookmarksMenu_ = menu->addMenu(tr("Bookmarks")); bookmarksMenu_->addAction(bookmarksManageAction_); menu->addSeparator(); menu->addAction(addContactAction_); menu->addAction(serviceDiscoveryAction_); menu->addAction(newMessageAction_); menu->addSeparator(); menu->addAction(xmlConsoleAction_); menu->addSeparator(); menu->addAction(modifyAccountAction_); adminMenu_ = menu->addMenu("&Admin"); adminMenu_->addAction(adminOnlineUsersAction_); adminMenu_->addAction(adminSendServerMessageAction_); adminMenu_->addAction(adminSetMotdAction_); adminMenu_->addAction(adminUpdateMotdAction_); adminMenu_->addAction(adminDeleteMotdAction_); updateActions(); }
void TransfersContentsWidget::updateTransfer(Transfer *transfer) { const int row(findTransfer(transfer)); if (row < 0) { return; } QString remainingTime; if (transfer->getState() == Transfer::RunningState) { if (!m_speeds.contains(transfer)) { m_speeds[transfer] = QQueue<qint64>(); } m_speeds[transfer].enqueue(transfer->getSpeed()); if (m_speeds[transfer].count() > 10) { m_speeds[transfer].dequeue(); } if (transfer->getBytesTotal() > 0) { qint64 speedSum(0); const QList<qint64> speeds(m_speeds[transfer]); for (int i = 0; i < speeds.count(); ++i) { speedSum += speeds.at(i); } speedSum /= (speeds.count()); remainingTime = Utils::formatTime(qreal(transfer->getBytesTotal() - transfer->getBytesReceived()) / speedSum); } } else { m_speeds.remove(transfer); } QIcon icon; switch (transfer->getState()) { case Transfer::RunningState: icon = ThemesManager::getIcon(QLatin1String("task-ongoing")); break; case Transfer::FinishedState: icon = ThemesManager::getIcon(QLatin1String("task-complete")); break; default: icon = ThemesManager::getIcon(QLatin1String("task-reject")); break; } m_model->item(row, 0)->setIcon(icon); m_model->item(row, 1)->setText(QFileInfo(transfer->getTarget()).fileName()); m_model->item(row, 2)->setText(Utils::formatUnit(transfer->getBytesTotal(), false, 1)); m_model->item(row, 3)->setText((transfer->getBytesTotal() > 0) ? QString::number(qFloor((static_cast<qreal>(transfer->getBytesReceived()) / transfer->getBytesTotal()) * 100), 'f', 0) : QString()); m_model->item(row, 4)->setText(remainingTime); m_model->item(row, 5)->setText((transfer->getState() == Transfer::RunningState) ? Utils::formatUnit(transfer->getSpeed(), true, 1) : QString()); m_model->item(row, 6)->setText(transfer->getTimeStarted().toString(QLatin1String("yyyy-MM-dd HH:mm:ss"))); m_model->item(row, 7)->setText(transfer->getTimeFinished().toString(QLatin1String("yyyy-MM-dd HH:mm:ss"))); const QString tooltip(tr("<div style=\"white-space:pre;\">Source: %1\nTarget: %2\nSize: %3\nDownloaded: %4\nProgress: %5</div>").arg(transfer->getSource().toDisplayString().toHtmlEscaped()).arg(transfer->getTarget().toHtmlEscaped()).arg(Utils::formatUnit(transfer->getBytesTotal(), false, 1, true)).arg(Utils::formatUnit(transfer->getBytesReceived(), false, 1, true)).arg(QStringLiteral("%1%").arg(((transfer->getBytesTotal() > 0) ? ((static_cast<qreal>(transfer->getBytesReceived()) / transfer->getBytesTotal()) * 100) : 0.0), 0, 'f', 1))); for (int i = 0; i < m_model->columnCount(); ++i) { m_model->item(row, i)->setToolTip(tooltip); } if (m_ui->transfersViewWidget->selectionModel()->hasSelection()) { updateActions(); } const bool isRunning(transfer && transfer->getState() == Transfer::RunningState); if (isRunning != m_isLoading) { if (isRunning) { m_isLoading = true; emit loadingStateChanged(WindowsManager::OngoingLoadingState); } else { const QList<Transfer*> transfers(TransfersManager::getTransfers()); bool hasRunning(false); for (int i = 0; i < transfers.count(); ++i) { if (transfers.at(i) && transfers.at(i)->getState() == Transfer::RunningState) { hasRunning = true; break; } } if (!hasRunning) { m_isLoading = false; emit loadingStateChanged(WindowsManager::FinishedLoadingState); } } } }
ProjectsTree::ProjectsTree(TTCP *ttcp, QWidget *parent) : QMainWindow(parent) { setupUi(this); setWindowFlags( windowFlags() & ~Qt::WindowMinimizeButtonHint ); recentMenuClean = true; readSettings(); recentMenu = new QMenu(this); alignmentGroup = new QActionGroup(this); recentMenu->setTitle(tr("projects")); recentMenu->setObjectName("project menu"); recentMenu->setTearOffEnabled(true); TreeModel *model = new TreeModel(this); createActions(); createViewActions(); this->ttcp = ttcp; #if defined TRAYPROJECT trayIcon = new QSystemTrayIcon(); trayIconMenu = new QMenu(); QIcon icon = QIcon(":/pics/active-icon-0.xpm"); trayIconMenu->addAction(selectCurrentAction); trayIconMenu->addAction(timeEditAction); trayIconMenu->addAction(minimizeAction); trayIconMenu->addAction(maximizeAction); trayIconMenu->addAction(restoreAction); trayIconMenu->addAction(quitAction); trayIcon->setIcon(icon); trayIcon->setContextMenu(trayIconMenu); trayIcon->show(); #endif QStringList headers; headers << tr("Title") << tr("Description"); view->setModel(model); view->resizeColumnToContents(0); QHeaderView *header = view->header(); header->moveSection(0, 1); view->setColumnWidth(1, 100); view->hideColumn(2); header->setMovable(false); /*! \sa * MyTreeView::popMenu() * ProjectsTree::itemMenu() */ connect(ttcp, SIGNAL(error(const QString &)), this, SLOT(p_error(const QString &))); connect(ttcp, SIGNAL(recentprojects(QList<int>&)), this, SLOT(updateRecentMenu(QList<int>&))); connect(view, SIGNAL(popMenu()), this, SLOT(itemMenu())); connect(view, SIGNAL(projPopMenu(int)), this, SLOT(projItemMenu(int))); connect(model, SIGNAL(get_time(int)), ttcp, SLOT(gettime(int))); connect(this, SIGNAL(changeProjectTo(int)), ttcp, SLOT(setProject(int))); connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(view, SIGNAL(expanded(QModelIndex)), model, SLOT(expanded(QModelIndex))); connect(view, SIGNAL(collapsed(QModelIndex)), model, SLOT(collapsed(QModelIndex))); connect(ttcp, SIGNAL(disconnected()), view, SLOT(disable())); connect(ttcp, SIGNAL(connected()), view, SLOT(enable())); connect(ttcp, SIGNAL(add_entry(QString,int,int,QTime,QTime)), model, SLOT(add_entry(QString,int,int,QTime,QTime))); connect(ttcp, SIGNAL(current(int)), this, SLOT(setCurrent(int))); //! Unselect the view connect(ttcp, SIGNAL(current(int)), view, SLOT(clearSelection())); connect(ttcp, SIGNAL(current(int)), model, SLOT(set_current(int))); connect(ttcp, SIGNAL(settime(int, QTime, QTime)), model, SLOT(update_time(int, QTime, QTime))); connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(updateActions())); #if defined TRAYPROJECT connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); #endif #if defined (Q_WS_X11) x11(); #endif updateActions(); addNoteW = new Notes(ttcp, this); connect(ttcp, SIGNAL(accept_note(const QString &)), addNoteW, SLOT(notesDone(const QString &))); addTaskW = new AddProject(ttcp, this); connect(ttcp, SIGNAL(accept_project(const QString &)), addTaskW, SLOT(done(const QString &))); addAutoSelW = new AddAuto(ttcp, this); connect(ttcp, SIGNAL(accept_select(const QString &)), addAutoSelW, SLOT(autoDone(const QString &))); errorWin = new ErrorWindow(this); timeEditWin = new TimeEdit(ttcp, this); connect(timeEditAction, SIGNAL(triggered()), timeEditWin, SLOT(myShow())); // timeEditWin->myShow(); }
VirtualConsole::VirtualConsole(QWidget* parent, Doc* doc) : QWidget(parent) , m_doc(doc) , m_editAction(EditNone) , m_toolbar(NULL) , m_addActionGroup(NULL) , m_editActionGroup(NULL) , m_bgActionGroup(NULL) , m_fgActionGroup(NULL) , m_fontActionGroup(NULL) , m_frameActionGroup(NULL) , m_stackingActionGroup(NULL) , m_addButtonAction(NULL) , m_addButtonMatrixAction(NULL) , m_addSliderAction(NULL) , m_addSliderMatrixAction(NULL) , m_addSpeedDialAction(NULL) , m_addXYPadAction(NULL) , m_addCueListAction(NULL) , m_addFrameAction(NULL) , m_addSoloFrameAction(NULL) , m_addLabelAction(NULL) , m_toolsSettingsAction(NULL) , m_editCutAction(NULL) , m_editCopyAction(NULL) , m_editPasteAction(NULL) , m_editDeleteAction(NULL) , m_editPropertiesAction(NULL) , m_editRenameAction(NULL) , m_bgColorAction(NULL) , m_bgImageAction(NULL) , m_bgDefaultAction(NULL) , m_fgColorAction(NULL) , m_fgDefaultAction(NULL) , m_fontAction(NULL) , m_resetFontAction(NULL) , m_frameSunkenAction(NULL) , m_frameRaisedAction(NULL) , m_frameNoneAction(NULL) , m_stackingRaiseAction(NULL) , m_stackingLowerAction(NULL) , m_customMenu(NULL) , m_editMenu(NULL) , m_addMenu(NULL) , m_dockArea(NULL) , m_contentsLayout(NULL) , m_scrollArea(NULL) , m_contents(NULL) , m_tapModifierDown(false) { Q_ASSERT(s_instance == NULL); s_instance = this; Q_ASSERT(doc != NULL); /* Main layout */ new QHBoxLayout(this); layout()->setMargin(1); layout()->setSpacing(1); initActions(); initDockArea(); m_contentsLayout = new QVBoxLayout; layout()->addItem(m_contentsLayout); initMenuBar(); initContents(); // Propagate mode changes to all widgets connect(m_doc, SIGNAL(modeChanged(Doc::Mode)), this, SLOT(slotModeChanged(Doc::Mode))); // Use the initial mode slotModeChanged(m_doc->mode()); // Nothing is selected updateActions(); }
KEBApp::KEBApp(const QString &bookmarksFile, bool readonly, const QString &address, bool browser, const QString &caption) : KMainWindow(), m_dcopIface(0), m_bookmarksFilename(bookmarksFile), m_caption(caption), m_readOnly(readonly), m_browser(browser) { m_cmdHistory = new CmdHistory(actionCollection()); s_topLevel = this; int h = 20; QSplitter *vsplitter = new QSplitter(this); KToolBar *quicksearch = new KToolBar(vsplitter, "search toolbar"); KAction *resetQuickSearch = new KAction(i18n("Reset Quick Search"), QApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0, actionCollection(), "reset_quicksearch"); resetQuickSearch->setWhatsThis( i18n("<b>Reset Quick Search</b><br>" "Resets the quick search so that all bookmarks are shown again.")); resetQuickSearch->plug(quicksearch); QLabel *lbl = new QLabel(i18n("Se&arch:"), quicksearch, "kde toolbar widget"); KListViewSearchLine *searchLineEdit = new KEBSearchLine(quicksearch, 0, "KListViewSearchLine"); quicksearch->setStretchableWidget(searchLineEdit); lbl->setBuddy(searchLineEdit); connect(resetQuickSearch, SIGNAL(activated()), searchLineEdit, SLOT(clear())); connect(searchLineEdit, SIGNAL(searchUpdated()), SLOT(updateActions())); ListView::createListViews(vsplitter); ListView::self()->initListViews(); searchLineEdit->setListView(static_cast< KListView * >(ListView::self()->widget())); ListView::self()->setSearchLine(searchLineEdit); m_bkinfo = new BookmarkInfoWidget(vsplitter); vsplitter->setOrientation(QSplitter::Vertical); vsplitter->setSizes(QValueList< int >() << h << 380 << m_bkinfo->sizeHint().height()); setCentralWidget(vsplitter); resize(ListView::self()->widget()->sizeHint().width(), vsplitter->sizeHint().height()); createActions(); if(m_browser) createGUI(); else createGUI("keditbookmarks-genui.rc"); m_dcopIface = new KBookmarkEditorIface(); connect(kapp->clipboard(), SIGNAL(dataChanged()), SLOT(slotClipboardDataChanged())); ListView::self()->connectSignals(); KGlobal::locale()->insertCatalogue("libkonq"); m_canPaste = false; construct(); ListView::self()->setCurrent(ListView::self()->getItemAtAddress(address), true); setCancelFavIconUpdatesEnabled(false); setCancelTestsEnabled(false); updateActions(); }
ManageAlertsDialog::ManageAlertsDialog( int folderId ) : InformationDialog( NULL, Qt::Window ), m_model( NULL ), m_selectedAlertId( 0 ), m_selectedEditable( false ) { m_emailEnabled = dataManager->setting( "email_enabled" ).toInt(); if ( folderId != 0 ) m_canEditPublic = FolderEntity::isAdmin( folderId ); else m_canEditPublic = dataManager->currentUserAccess() == AdminAccess; QAction* action; action = new QAction( IconLoader::icon( "alert-new" ), tr( "&Add Alert..." ), this ); action->setShortcut( QKeySequence::New ); connect( action, SIGNAL( triggered() ), this, SLOT( addAlert() ) ); setAction( "addAlert", action ); if ( m_canEditPublic ) { action = new QAction( IconLoader::overlayedIcon( "alert-new", "overlay-public" ), tr( "Add &Public Alert..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( addPublicAlert() ) ); setAction( "addPublicAlert", action ); } action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Alert" ), this ); action->setShortcut( QKeySequence::Delete ); connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ) ); setAction( "editDelete", action ); if ( m_emailEnabled ) { action = new QAction( IconLoader::icon( "edit-modify" ), tr( "&Modify Alert..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( editModify() ) ); setAction( "editModify", action ); setDefaultMenuAction( "menuAlert", "editModify" ); } loadXmlUiFile( ":/resources/managealertsdialog.xml" ); XmlUi::Builder* builder = new XmlUi::Builder( this ); builder->addClient( this ); setWindowTitle( tr( "Manage Alerts" ) ); setPromptPixmap( IconLoader::pixmap( "configure-alerts", 22 ) ); QVBoxLayout* layout = new QVBoxLayout(); layout->setSpacing( 4 ); XmlUi::ToolStrip* strip = new XmlUi::ToolStrip( this ); builder->registerToolStrip( "stripAlerts", strip ); layout->addWidget( strip ); m_list = new QTreeView( this ); layout->addWidget( m_list ); TreeViewHelper helper( m_list ); helper.initializeView( TreeViewHelper::NotSortable ); connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( doubleClicked( const QModelIndex& ) ) ); connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( listContextMenu( const QPoint& ) ) ); setContentLayout( layout, false ); setDialogSizeKey( "ManageAlertsDialog" ); resize( 680, 400 ); updateActions(); }
void ViewController::respondOnUpdate(const UpdateEvent& event) { updateActions(event); }
BookmarksPluginRunData::BookmarksPluginRunData() : m_bookmarkFilter(&m_bookmarkManager) , m_bookmarkViewFactory(&m_bookmarkManager) { ActionContainer *mtools = ActionManager::actionContainer(Core::Constants::M_TOOLS); ActionContainer *touchBar = ActionManager::actionContainer(Core::Constants::TOUCH_BAR); ActionContainer *mbm = ActionManager::createMenu(Id(BOOKMARKS_MENU)); mbm->menu()->setTitle(BookmarksPlugin::tr("&Bookmarks")); mtools->addMenu(mbm); const Context editorManagerContext(Core::Constants::C_EDITORMANAGER); // Toggle Command *cmd = ActionManager::registerAction(&m_toggleAction, BOOKMARKS_TOGGLE_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? BookmarksPlugin::tr("Meta+M") : BookmarksPlugin::tr("Ctrl+M"))); cmd->setTouchBarIcon(Utils::Icons::MACOS_TOUCHBAR_BOOKMARK.icon()); mbm->addAction(cmd); touchBar->addAction(cmd, Core::Constants::G_TOUCHBAR_EDITOR); mbm->addSeparator(); // Previous m_prevAction.setIcon(Utils::Icons::PREV_TOOLBAR.icon()); m_prevAction.setIconVisibleInMenu(false); cmd = ActionManager::registerAction(&m_prevAction, BOOKMARKS_PREV_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? BookmarksPlugin::tr("Meta+,") : BookmarksPlugin::tr("Ctrl+,"))); mbm->addAction(cmd); // Next m_nextAction.setIcon(Utils::Icons::NEXT_TOOLBAR.icon()); m_nextAction.setIconVisibleInMenu(false); cmd = ActionManager::registerAction(&m_nextAction, BOOKMARKS_NEXT_ACTION, editorManagerContext); cmd->setDefaultKeySequence(QKeySequence(useMacShortcuts ? BookmarksPlugin::tr("Meta+.") : BookmarksPlugin::tr("Ctrl+."))); mbm->addAction(cmd); mbm->addSeparator(); // Previous Doc cmd = ActionManager::registerAction(&m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, editorManagerContext); mbm->addAction(cmd); // Next Doc cmd = ActionManager::registerAction(&m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, editorManagerContext); mbm->addAction(cmd); connect(&m_toggleAction, &QAction::triggered, this, [this] { BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); if (editor && !editor->document()->isTemporary()) m_bookmarkManager.toggleBookmark(editor->document()->filePath(), editor->currentLine()); }); connect(&m_prevAction, &QAction::triggered, &m_bookmarkManager, &BookmarkManager::prev); connect(&m_nextAction, &QAction::triggered, &m_bookmarkManager, &BookmarkManager::next); connect(&m_docPrevAction, &QAction::triggered, &m_bookmarkManager, &BookmarkManager::prevInDocument); connect(&m_docNextAction, &QAction::triggered, &m_bookmarkManager, &BookmarkManager::nextInDocument); connect(&m_editBookmarkAction, &QAction::triggered, this, [this] { m_bookmarkManager.editByFileAndLine(m_marginActionFileName, m_marginActionLineNumber); }); connect(&m_bookmarkManager, &BookmarkManager::updateActions, this, &BookmarksPluginRunData::updateActions); updateActions(false, m_bookmarkManager.state()); connect(&m_bookmarkMarginAction, &QAction::triggered, this, [this] { m_bookmarkManager.toggleBookmark(m_marginActionFileName, m_marginActionLineNumber); }); // EditorManager connect(EditorManager::instance(), &EditorManager::editorAboutToClose, this, &BookmarksPluginRunData::editorAboutToClose); connect(EditorManager::instance(), &EditorManager::editorOpened, this, &BookmarksPluginRunData::editorOpened); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), scaleFactor(1.0), currentX(0), currentY(0), colorViewType(COLOR_RGB), currentCamera{-1,-1}, workingDir(QDir::currentPath()), dmapSettingsModel(0, depthMapBuilder) { ui->setupUi(this); scaleStatusLabel = new QLabel(this); coordsStatusLabel = new QLabel(this); ui->statusbar->addWidget(scaleStatusLabel); ui->statusbar->addWidget(coordsStatusLabel); ui->imageLabel1->installEventFilter(this); ui->imageLabel1->setMouseTracking(true); ui->imageLabel2->installEventFilter(this); ui->imageLabel2->setMouseTracking(true); ui->depthMapLabel->installEventFilter(this); resize(QGuiApplication::primaryScreen()->availableSize() * 3 / 5); updateActions(); //initialze camera connections camera[0].setFrameCallback(std::bind(&FrameProcessor::setFrame, &frameProcessor[0], std::placeholders::_1)); converter[0].setFrameSource(frameProcessor[0]); connect(&converter[0], SIGNAL(imageReady(QImage)), this, SLOT(setImage1(QImage))); camera[1].setFrameCallback(std::bind(&FrameProcessor::setFrame, &frameProcessor[1], std::placeholders::_1)); converter[1].setFrameSource(frameProcessor[1]); connect(&converter[1], SIGNAL(imageReady(QImage)), this, SLOT(setImage2(QImage))); depthMapBuilder.setLeftSource(frameProcessor[0]); depthMapBuilder.setRightSource(frameProcessor[1]); converter[2].setFrameSource(depthMapBuilder); connect(&converter[2], SIGNAL(imageReady(QImage)), this, SLOT(setDepthImage(QImage))); converterThread[0].start(); converter[0].moveToThread(&converterThread[0]); converterThread[1].start(); converter[1].moveToThread(&converterThread[1]); converterThread[2].start(); converter[2].moveToThread(&converterThread[2]); ui->depthSettingsTableView->setModel(&dmapSettingsModel); ui->actionCameraView->setChecked(true); this->converter[0].pause(false); this->converter[1].pause(false); this->converter[2].pause(true); depthMapBuilder.stopProcessing(); ui->viewStackedWidget->setCurrentIndex(0); cloud.reset (new PointCloudT); viewer.reset (new pcl::visualization::PCLVisualizer ("viewer", false)); viewer->setBackgroundColor (0.1, 0.1, 0.1); viewer->addCoordinateSystem (1.0); ui->pc3dVtk->SetRenderWindow (viewer->getRenderWindow ()); viewer->setupInteractor (ui->pc3dVtk->GetInteractor (), ui->pc3dVtk->GetRenderWindow ()); ui->pc3dVtk->update (); //viewer->addPointCloud (cloud, "cloud"); //viewer->resetCamera (); //ui->pc3dVtk->update (); }
void MainWindow::startFunctions() { headersLst.append("ОУ"); headersLst.append("Адрес"); headersLst.append("Класс"); treeMdl = new TreeModel(headersLst); ui->progressBarTree->hide(); lblSN = new QLabel; lblPOVer = new QLabel(); lblNetNum = new QLabel(); lblNumLiter = new QLabel(); lblStatus = new QLabel(); lblPort = new QLabel(); lblSysAddress = new QLabel(); lblCoverStat = new QLabel(); lblBindStat = new QLabel(); lblIn1 = new QLabel(); lblIn2 = new QLabel(); lblNoize = new QLabel(); lblInterView = new QLabel(); statusBar()->addWidget(lblArrow, 0); statusBar()->addWidget(lblStatus, 0); statusBar()->addWidget(lblPort, 0); statusBar()->addWidget(lblCoverStat, 0); statusBar()->addWidget(lblBindStat, 0); statusBar()->addWidget(lblIn1, 0); statusBar()->addWidget(lblIn2, 0); statusBar()->addWidget(lblNoize, 0); statusBar()->addWidget(lblPOVer, 0); statusBar()->addWidget(lblSN, 0); statusBar()->addWidget(lblNetNum, 0); statusBar()->addWidget(lblNumLiter, 0); statusBar()->addWidget(lblSysAddress, 0); statusBar()->addWidget(chckBxInterView, 0); statusBar()->addWidget(lblInterView, 0); lblBindStat->setFixedSize(61, 26); lblNoize->setFixedSize(40, 26); lblCoverStat->setFixedSize(77, 26); lblBindStat->setStyleSheet("QLabel { background-color : white; }"); lblNetNum->setText("Сеть:\n"); lblNetNum->setToolTip("Номер сети"); lblNumLiter->setText("Литера:\n"); lblNumLiter->setToolTip("Номер литеры"); lblSN->setText("S/N:\n"); lblSN->setToolTip("Серийный номер контроллера"); lblSysAddress->setText("Системный\nадрес: "); lblSysAddress->setToolTip("Системный адрес контроллера"); lblPOVer->setText("Версия прошивки:\n"); lblPOVer->setToolTip("Версия прошивки контроллера:"); lblInterView->setText("Опрос"); connect(ui->actUpdate, SIGNAL(triggered()), this, SLOT(slotActUpdate())); connect(ui->actExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actHelp, SIGNAL(triggered()), this, SLOT(help())); connect(ui->actSetNetParams, SIGNAL(triggered()), this, SLOT(slotSetParams())); connect(ui->actExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actAbout, SIGNAL(triggered()), this, SLOT(slotAboutApp())); connect(ui->actRestart, SIGNAL(triggered()), this, SLOT(slotReboot())); connect(ui->actConnectPort, SIGNAL(triggered()), this, SLOT(slotConnectTo())); connect(ui->pbBind, SIGNAL(clicked()), this, SLOT(slotBind())); connect(ui->actTree, SIGNAL(triggered()), this, SLOT(slotAskTree())); connect(chckBxInterView, SIGNAL(clicked(bool)), this, SLOT(slotInterview(bool))); connect(ui->pbSet, SIGNAL(clicked()), this, SLOT(slotSetSettings())); connect(ui->pbCancel, SIGNAL(clicked()), this, SLOT(slotCancelSettings())); connect(ui->act_showHideLog, SIGNAL(triggered(bool)), this, SLOT(slotShowHideLogAct(bool))); connect(ui->pbClear, SIGNAL(clicked(bool)), this, SLOT(clearTxtEdit(bool))); connect(ui->cmbBxCls, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeCls(int))); connect(ui->cmbBxCmnd, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotChangeCmnd(QString))); connect(ui->pbSend, SIGNAL(clicked()), this, SLOT(slotPBSend())); connect(ui->pages, SIGNAL(currentChanged(int)), this, SLOT(slotTabChanged(int))); connect(ui->pbLoad, SIGNAL(clicked()), this, SLOT(slotAskTree())); connect(treeMdl, SIGNAL(signalDropTreeNode(int, int, int, int, unsigned char)), this, SLOT(slotDropTreeNode(int, int, int, int, unsigned char))); answerFlag = true; writeInLogFlag = false; customCommFlag = false; lblCoverStat->setText("Крышка\nзакрыта"); lblBindStat->setText("Связывания\nнет"); lblIn1->setText("Вход 1"); lblIn2->setText("Вход 2"); /*this->setMouseTracking(true); ui->tabs->setMouseTracking(true);*/ createDev(); loadCommLst(); loadDevSpecMap(); ui->treeView->setModel(treeMdl); ui->treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->treeView->setDragEnabled(true); ui->treeView->setAcceptDrops(true); ui->treeView->setDropIndicatorShown(true); ui->treeView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->treeView->expandAll(); updateActions(); QVBoxLayout *vbl = new QVBoxLayout(); vbl->addWidget(lgWgt); ui->logTab->setLayout(vbl); //connect(this, SIGNAL(signal_log_click()), logWgt, SLOT(slot_log_clicked())); qDebug() << "start"; if(pb->pairObjArr.isEmpty()) //closeApp("<u><b>Приложение будет закрыто.</b></u><i> Нет доступных подключений.</i>"); qDebug() << "No connection"; else { connect(m_sde, SIGNAL(hasChanged(QStringList)), this, SLOT(printDevices(QStringList))); if(pb->pairObjArr.size() > 1) { dsc = new DialogSelectConnection(pb); connect(dsc, SIGNAL(tryConnSignal(QString, QString)), this, SLOT(sendTryConn(QString, QString))); if(dsc->exec() != dsc->Accepted) closeApp("<u><b>Приложение будет закрыто.</b></u><i> Подключение не выбрано.</i>"); delete dsc; } else { currPair.port = pb->pairObjArr.first().port; currPair.baud = pb->pairObjArr.first().baud; pserial = new AbstractSerial(this); if(!tryConnect(pserial, currPair.port, currPair.baud)) qDebug() << "serial port is not open"; } disconnect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(parceAnswerPack(QByteArray))); connect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(onPackReceiver(QByteArray))); connect(pserial, SIGNAL(readyRead()), this, SLOT(onProcSerialReceive())); pserial->enableEmitStatus(true); lblPort->setText(currPair.port + "\n" + currPair.baud); lblStatus->setText("Connected"); //lblStatus->setBackgroundRole(QColor(Qt::green)); MainWindow::setWindowTitle(currPair.port + " Конфигуратор Ладога-РК"); commLst.clear(); QTimer::singleShot(50, this, SLOT(createStartCommands())); } }
void Prj::somethingChanged() { m_hasChanges = true; updateActions(); }
bool CameraMainWindow::eventFilter(QObject* o, QEvent* e) { if ( e->type() == QEvent::KeyPress ) { QKeyEvent *ke = (QKeyEvent*)e; if (!ke->isAutoRepeat()) { if (ke->key() == Qt::Key_1) { takePhoto(); return true; } else if (ke->key() == Qt::Key_2) { toggleVideo(); return true; } } if (ke->key() == Qt::Key_4) { if(camera->videocaptureview->minZoom() < m_currzoom) { m_currzoom--; m_zoom->setValue(m_currzoom); showZoom(); } camera->videocaptureview->zoomOut(); } if (ke->key() == Qt::Key_6) { if(camera->videocaptureview->maxZoom() > m_currzoom) { m_currzoom++; m_zoom->setValue(m_currzoom); showZoom(); } camera->videocaptureview->zoomIn(); } if ( ke->key() == Qt::Key_Select ) for(int i = 0; i <nthumb-1; ++i) if( o == thumb[i]) return true; if ( ke->key() == Qt::Key_Up ) { camera->photo->setFocus(); return true; } else if ( ke->key() == Qt::Key_Down ) { thumb[0]->setFocus(); return true; } else if ( ke->key() == (QApplication::isLeftToRight() ? Qt::Key_Left : Qt::Key_Right) ) { if ( o == camera->video ) { camera->photo->setFocus(); return true; } else { if ( o == thumb[0] ) return true; for (int i=1; i<nthumb; ++i) { if ( o == thumb[i] ) { thumb[i-1]->setFocus(); return true; } } } } else if ( ke->key() == (QApplication::isLeftToRight() ? Qt::Key_Right : Qt::Key_Left) ) { if ( o == camera->photo ) { camera->video->setFocus(); return true; } else { if ( o == thumb[nthumb-1] ) return true; for (int i=0; i<nthumb-1; ++i) { if ( o == thumb[i] ) { thumb[i+1]->setFocus(); return true; } } } } } else if (!m_contextMenuActive) { if (e->type() == QEvent::FocusIn) { if (o == camera->photo) { QtopiaApplication::setPowerConstraint( QtopiaApplication::Disable ); } updateActions(); } else if (e->type() == QEvent::FocusOut) { if (o == camera->photo) { QtopiaApplication::setPowerConstraint( QtopiaApplication::Enable ); } } } return QWidget::eventFilter(o,e); }
void MainWindow::onTabChanged(int index) { Sheet* curr = dynamic_cast<Sheet *>(tabWidget->widget(index)); if (curr) setWindowTitle(tr("%1 - qCharts").arg(curr->getLongTitle())); updateActions(); }
void QuantumInput::refreshGenerators() { updateInputGeneratorScripts(); updateActions(); }
void TransfersContentsWidget::updateTransfer(TransferInformation *transfer) { const int row = findTransfer(transfer); if (row < 0) { return; } QString remainingTime; if (transfer->state == RunningTransfer) { if (!m_speeds.contains(transfer)) { m_speeds[transfer] = QQueue<qint64>(); } m_speeds[transfer].enqueue(transfer->speed); if (m_speeds[transfer].count() > 10) { m_speeds[transfer].dequeue(); } if (transfer->bytesTotal > 0) { qint64 speedSum = 0; const QList<qint64> speeds = m_speeds[transfer]; for (int i = 0; i < speeds.count(); ++i) { speedSum += speeds.at(i); } speedSum /= (speeds.count()); remainingTime = Utils::formatTime(qreal(transfer->bytesTotal - transfer->bytesReceived) / speedSum); } } else { m_speeds.remove(transfer); } QIcon icon; switch (transfer->state) { case RunningTransfer: icon = Utils::getIcon(QLatin1String("task-ongoing")); break; case FinishedTransfer: icon = Utils::getIcon(QLatin1String("task-complete")); break; case ErrorTransfer: icon = Utils::getIcon(QLatin1String("task-reject")); break; default: break; } m_model->item(row, 0)->setIcon(icon); m_model->item(row, 2)->setText(Utils::formatUnit(transfer->bytesTotal, false, 1)); m_model->item(row, 3)->setText((transfer->bytesTotal > 0) ? QString::number(qFloor(((qreal) transfer->bytesReceived / transfer->bytesTotal) * 100), 'f', 0) : QString()); m_model->item(row, 4)->setText(remainingTime); m_model->item(row, 5)->setText((transfer->state == RunningTransfer) ? Utils::formatUnit(transfer->speed, true, 1) : QString()); m_model->item(row, 6)->setText(transfer->started.toString(QLatin1String("yyyy-MM-dd HH:mm:ss"))); m_model->item(row, 7)->setText(transfer->finished.toString(QLatin1String("yyyy-MM-dd HH:mm:ss"))); const QString tooltip = tr("<div style=\"white-space:pre;\">Source: %1\nTarget: %2\nSize: %3\nDownloaded: %4\nProgress: %5</div>").arg(transfer->source.toHtmlEscaped()).arg(transfer->target.toHtmlEscaped()).arg((transfer->bytesTotal > 0) ? tr("%1 (%n B)", "", transfer->bytesTotal).arg(Utils::formatUnit(transfer->bytesTotal)) : QString('?')).arg(tr("%1 (%n B)", "", transfer->bytesReceived).arg(Utils::formatUnit(transfer->bytesReceived))).arg(QStringLiteral("%1%").arg(((transfer->bytesTotal > 0) ? (((qreal) transfer->bytesReceived / transfer->bytesTotal) * 100) : 0.0), 0, 'f', 1)); for (int i = 0; i < m_model->columnCount(); ++i) { m_model->item(row, i)->setToolTip(tooltip); } if (m_ui->transfersView->selectionModel()->hasSelection()) { updateActions(); } const bool isRunning = (transfer && transfer->state == RunningTransfer); if (isRunning != m_isLoading) { if (isRunning) { m_isLoading = true; emit loadingChanged(true); } else { const QList<TransferInformation*> transfers = TransfersManager::getTransfers(); bool hasRunning = false; for (int i = 0; i < transfers.count(); ++i) { if (transfers.at(i) && transfers.at(i)->state == RunningTransfer) { hasRunning = true; break; } } if (!hasRunning) { m_isLoading = false; emit loadingChanged(false); } } } }
void NBFolderView::createAndSetupActions() { connect( IconView, SIGNAL( peek( QModelIndex ) ), this, SLOT( doPeek( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QModelIndex ) ), this, SLOT( doOpen( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QString ) ), this, SLOT( doOpen( QString ) ) ); connect( IconView, SIGNAL( contextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); connect( IconView, SIGNAL( actionsMenuRequested( QPoint ) ), this, SLOT( showActionsMenu( QPoint ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( updateActions() ) ); connect( IconView, SIGNAL( link( QStringList, QString ) ), this, SLOT( link( QStringList, QString ) ) ); // DragDrop copy connect( IconView, SIGNAL( copy( QStringList, QString ) ), this, SLOT( copy( QStringList, QString ) ) ); // DragDrop move connect( IconView, SIGNAL( move( QStringList, QString ) ), this, SLOT( move( QStringList, QString ) ) ); // Update actions once the directory is loaded connect( fsModel, SIGNAL( directoryLoaded( QString ) ), this, SLOT( updateActions() ) ); // Peek peekAct = new QAction( QIcon( ":/icons/peek.png" ), "Pee&k", this ); peekAct->setShortcuts( Settings->shortcuts( "Peek" ) ); connect( peekAct, SIGNAL( triggered() ), this, SLOT( doPeek() ) ); addAction( peekAct ); // Home Dir actHomeDir = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actHomeDir->setShortcuts( Settings->shortcuts( "GoHome" ) ); connect( actHomeDir, SIGNAL( triggered() ), this, SLOT( loadHomeDir() ) ); addAction( actHomeDir ); // Home actGoHome = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actGoHome->setShortcut( tr( "Alt+Shift+Home" ) ); connect( actGoHome, SIGNAL( triggered() ), this, SLOT( doOpenHome() ) ); addAction( actGoHome ); // Up actParDir = new QAction( QIcon( ":/icons/up.png" ), "&Up", this ); actParDir->setShortcuts( Settings->shortcuts( "GoUp" ) ); connect( actParDir, SIGNAL( triggered() ), fsModel, SLOT( goUp() ) ); addAction( actParDir ); // Back actPrevDir = new QAction( QIcon( ":/icons/prev.png" ), "&Back", this ); actPrevDir->setShortcuts( Settings->shortcuts( "GoLeft" ) ); connect( actPrevDir, SIGNAL( triggered() ), fsModel, SLOT( goBack() ) ); addAction( actPrevDir ); // Forward actNextDir = new QAction( QIcon( ":/icons/next.png" ), "&Forward", this ); actNextDir->setShortcuts( Settings->shortcuts( "GoRight" ) ); connect( actNextDir, SIGNAL( triggered() ), fsModel, SLOT( goForward() ) ); addAction( actNextDir ); // New Folder actNewDir = new QAction( QIcon::fromTheme( "folder-new" ), "New folder", this ); actNewDir->setShortcuts( Settings->shortcuts( "NewFolder" ) ); connect( actNewDir, SIGNAL( triggered() ), this, SLOT( newFolder() ) ); addAction( actNewDir ); // New file actNewFile = new QAction( QIcon::fromTheme( "document-new" ), "New File", this ); actNewFile->setShortcuts( Settings->shortcuts( "NewFile" ) ); connect( actNewFile, SIGNAL( triggered() ), this, SLOT( newFile() ) ); addAction( actNewFile ); // New file actNewEncFS = new QAction( QIcon::fromTheme( "document-new" ), "New Encrypted Directory", this ); actNewEncFS->setShortcuts( Settings->shortcuts( "NewEncFS" ) ); connect( actNewEncFS, SIGNAL( triggered() ), this, SLOT( createEncFS() ) ); addAction( actNewEncFS ); // Copy copyAct = new QAction( QIcon( ":/icons/copy.png" ), "&Copy", this ); copyAct->setShortcuts( Settings->shortcuts( "Copy" ) ); connect( copyAct, SIGNAL( triggered() ), this, SLOT( prepareCopy() ) ); addAction( copyAct ); // Move moveAct = new QAction( QIcon( ":/icons/cut.png" ), "Cu&t", this ); moveAct->setShortcuts( Settings->shortcuts( "Cut" ) ); connect( moveAct, SIGNAL( triggered() ), this, SLOT( prepareMove() ) ); addAction( moveAct ); // Paste pasteAct = new QAction( QIcon( ":/icons/paste.png" ), "&Paste", this ); pasteAct->setShortcuts( Settings->shortcuts( "Paste" ) ); connect( pasteAct, SIGNAL( triggered() ), this, SLOT( prepareIO() ) ); addAction( pasteAct ); // Rename renameAct = new QAction( QIcon( ":/icons/rename.png" ), "&Rename", this ); renameAct->setShortcuts( Settings->shortcuts( "Rename" ) ); connect( renameAct, SIGNAL( triggered() ), this, SLOT( doRename() ) ); addAction( renameAct ); // Reload reloadAct = new QAction( QIcon( ":/icons/reload.png" ), "Re&fresh", this ); reloadAct->setShortcuts( Settings->shortcuts( "Reload" ) ); connect( reloadAct, SIGNAL( triggered() ), this, SLOT( doReload() ) ); addAction( reloadAct ); // showDotFiles showHideDotFiles = new QAction( QIcon( ":/icons/showDotFiles.png" ), "Show &Hidden", this ); showHideDotFiles->setShortcuts( Settings->shortcuts( "ToggleHidden" ) ); connect( showHideDotFiles, SIGNAL( triggered() ), this, SLOT( doToggleHidden() ) ); addAction( showHideDotFiles ); // Trash trashAct = new QAction( QIcon( ":/icons/trash.png" ), "Move to trash", this ); trashAct->setShortcuts( Settings->shortcuts( "Trash" ) ); connect( trashAct, SIGNAL( triggered() ), this, SLOT( doSendToTrash() ) ); addAction( trashAct ); // Delete delAct = new QAction( QIcon( ":/icons/delete.png" ), "Delete", this ); delAct->setShortcuts( Settings->shortcuts( "Delete" ) ); connect( delAct, SIGNAL( triggered() ), this, SLOT( doDelete() ) ); addAction( delAct ); // Properties propertiesAct = new QAction( QIcon( ":/icons/props.png" ), "&Properties", this ); propertiesAct->setShortcuts( Settings->shortcuts( "Properties" ) ); connect( propertiesAct, SIGNAL( triggered() ), this, SIGNAL( showProperties() ) ); addAction( propertiesAct ); // Permissions permissionsAct = new QAction( QIcon::fromTheme( "system-users" ), "P&ermissions", this ); permissionsAct->setShortcuts( Settings->shortcuts( "Permissions" ) ); connect( permissionsAct, SIGNAL( triggered() ), this, SIGNAL( showPermissions() ) ); addAction( permissionsAct ); // Open a virtual terminal emulator openVTE = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE", this ); openVTE->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTE, SIGNAL( triggered() ), this, SLOT( openTerminal() ) ); addAction( openVTE ); // Open a virtual terminal emulator openVTEin = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE Here", this ); // openVTEin->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTEin, SIGNAL( triggered() ), this, SLOT( openTerminalIn() ) ); // Select All QAction *selectAllAct = new QAction( "&Select All", this ); selectAllAct->setShortcuts( Settings->shortcuts( "SelectAll" ) ); connect( selectAllAct, SIGNAL( triggered() ), this, SLOT( selectAll() ) ); addAction( selectAllAct ); // Sorting sortByNameAct = new QAction( QIcon::fromTheme( "format-text-underline" ), "&Name", this ); sortByNameAct->setCheckable( true ); connect( sortByNameAct, SIGNAL( triggered() ), this, SLOT( sortByName() ) ); sortByTypeAct = new QAction( QIcon::fromTheme( "preferences-other" ), "&Type", this ); sortByTypeAct->setCheckable( true ); connect( sortByTypeAct, SIGNAL( triggered() ), this, SLOT( sortByType() ) ); sortBySizeAct = new QAction( QIcon( ":/icons/size.png" ), "&Size", this ); sortBySizeAct->setCheckable( true ); connect( sortBySizeAct, SIGNAL( triggered() ), this, SLOT( sortBySize() ) ); sortByDateAct = new QAction( QIcon::fromTheme( "office-calendar" ), "&Date", this ); sortByDateAct->setCheckable( true ); connect( sortByDateAct, SIGNAL( triggered() ), this, SLOT( sortByDate() ) ); QActionGroup *sortGroup = new QActionGroup( this ); sortGroup->addAction( sortByNameAct ); sortGroup->addAction( sortByTypeAct ); sortGroup->addAction( sortBySizeAct ); sortGroup->addAction( sortByDateAct ); switch( ( int )Settings->value( "SortColumn" ) ) { case 0: { sortByNameAct->setChecked( true ); break; } case 1: { sortBySizeAct->setChecked( true ); break; } case 2: { sortByTypeAct->setChecked( true ); break; } case 4: { sortByDateAct->setChecked( true ); break; } } groupsAct = new QAction( QIcon::fromTheme( "view-group", QIcon( ":/icons/groups.png" ) ), "Show in &Groups", this ); groupsAct->setCheckable( true ); groupsAct->setChecked( Settings->value( "Grouping" ) ); connect( groupsAct, SIGNAL( triggered() ), this, SIGNAL( toggleGroups() ) ); // Add bookmark addBookMarkAct = new QAction( QIcon( ":/icons/bookmark.png" ), "Add &Bookmark", this ); addBookMarkAct->setShortcuts( Settings->shortcuts( "AddBookmark" ) ); connect( addBookMarkAct, SIGNAL( triggered() ), this, SLOT( addBookMark() ) ); addAction( addBookMarkAct ); /* Add to SuperStart */ addToSuperStartAct = new QAction( QIcon( ":/icons/superstart.png" ), "Add to S&uperStart", this ); addToSuperStartAct->setShortcut( tr( "Ctrl+U" ) ); connect( addToSuperStartAct, SIGNAL( triggered() ), this, SLOT( addToSuperStart() ) ); addAction( addToSuperStartAct ); updateActions(); };
void VirtualConsole::slotEditPaste() { if (m_clipboard.size() == 0) { /* Invalidate the edit action if there's nothing to paste */ m_editAction = EditNone; m_editPasteAction->setEnabled(false); return; } VCWidget* parent; VCWidget* widget; QRect bounds; Q_ASSERT(contents() != NULL); /* Select the parent that gets the cut clipboard contents */ parent = closestParent(); /* Get the bounding rect for all selected widgets */ QListIterator <VCWidget*> it(m_clipboard); while (it.hasNext() == true) { widget = it.next(); Q_ASSERT(widget != NULL); bounds = bounds.united(widget->geometry()); } /* Get the upcoming parent's last mouse click point */ QPoint cp(parent->lastClickPoint()); if (m_editAction == EditCut) { it.toFront(); while (it.hasNext() == true) { widget = it.next(); Q_ASSERT(widget != NULL); if (widget == parent) continue; /* Get widget's relative pos to the bounding rect */ QPoint p(widget->x() - bounds.x() + cp.x(), widget->y() - bounds.y() + cp.y()); /* Reparent and move to the correct place */ widget->setParent(parent); widget->move(p); widget->show(); } /* Clear clipboard after pasting stuff that was CUT */ m_clipboard.clear(); m_editPasteAction->setEnabled(false); } else if (m_editAction == EditCopy) { it.toFront(); while (it.hasNext() == true) { widget = it.next(); Q_ASSERT(widget != NULL); if (widget == parent) continue; /* Get widget's relative pos to the bounding rect */ QPoint p(widget->x() - bounds.x() + cp.x(), widget->y() - bounds.y() + cp.y()); /* Create a copy and move to correct place */ VCWidget* copy = widget->createCopy(parent); Q_ASSERT(copy != NULL); copy->move(p); copy->show(); } } updateActions(); }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RiuRecentFileActionProvider::RiuRecentFileActionProvider(int maxActionCount) : m_maxActionCount(maxActionCount) { createActions(); updateActions(); }
DetView::DetView(QWidget* p, SequenceObjectContext* ctx) : GSequenceLineViewAnnotated(p, ctx) { editor = new DetViewSequenceEditor(this); showComplementAction = new QAction(tr("Show complementary strand"), this); showComplementAction->setIcon(QIcon(":core/images/show_compl.png")); showComplementAction->setObjectName("complement_action"); connect(showComplementAction, SIGNAL(triggered(bool)), SLOT(sl_showComplementToggle(bool))); showTranslationAction = new QAction(tr("Show/hide translations"), this); showTranslationAction->setObjectName("translation_action"); connect(showTranslationAction, SIGNAL(triggered(bool)), SLOT(sl_showTranslationToggle(bool))); doNotTranslateAction = new QAction(tr("Do not translate"), this); doNotTranslateAction->setObjectName("do_not_translate_radiobutton"); doNotTranslateAction->setData(SequenceObjectContext::TS_DoNotTranslate); connect(doNotTranslateAction, SIGNAL(triggered(bool)), SLOT(sl_doNotTranslate())); doNotTranslateAction->setCheckable(true); doNotTranslateAction->setChecked(true); translateAnnotationsOrSelectionAction = new QAction(tr("Translate selection"), this); translateAnnotationsOrSelectionAction->setData(SequenceObjectContext::TS_AnnotationsOrSelection); connect(translateAnnotationsOrSelectionAction, SIGNAL(triggered(bool)), SLOT(sl_translateAnnotationsOrSelection())); translateAnnotationsOrSelectionAction->setCheckable(true); setUpFramesManuallyAction = new QAction(tr("Set up frames manually"), this); setUpFramesManuallyAction->setObjectName("set_up_frames_manuallt_radiobutton"); setUpFramesManuallyAction->setData(SequenceObjectContext::TS_SetUpFramesManually); connect(setUpFramesManuallyAction, SIGNAL(triggered(bool)), SLOT(sl_setUpFramesManually())); setUpFramesManuallyAction->setCheckable(true); showAllFramesAction = new QAction(tr("Show all frames"), this); showAllFramesAction->setObjectName("show_all_frames_radiobutton"); showAllFramesAction->setData(SequenceObjectContext::TS_ShowAllFrames); connect(showAllFramesAction, SIGNAL(triggered(bool)), SLOT(sl_showAllFrames())); showAllFramesAction->setCheckable(true); wrapSequenceAction = new QAction(tr("Wrap sequence"), this); wrapSequenceAction->setIcon(QIcon(":core/images/wrap_sequence.png")); wrapSequenceAction->setObjectName("wrap_sequence_action"); connect(wrapSequenceAction, SIGNAL(triggered(bool)), SLOT(sl_wrapSequenceToggle(bool))); showComplementAction->setCheckable(true); showTranslationAction->setCheckable(true); wrapSequenceAction->setCheckable(true); wrapSequenceAction->setChecked(true); bool hasComplement = ctx->getComplementTT() != NULL; showComplementAction->setChecked(hasComplement); bool hasAmino = ctx->getAminoTT() != NULL; showTranslationAction->setChecked(hasAmino); assert(ctx->getSequenceObject()!=NULL); featureFlags&=!GSLV_FF_SupportsCustomRange; renderArea = new DetViewRenderArea(this); renderArea->setObjectName("render_area_" + ctx->getSequenceObject()->getSequenceName()); connect(ctx, SIGNAL(si_aminoTranslationChanged()), SLOT(sl_onAminoTTChanged())); connect(ctx, SIGNAL(si_translationRowsChanged()), SLOT(sl_translationRowsChanged())); addActionToLocalToolbar(wrapSequenceAction); if (hasComplement) { addActionToLocalToolbar(showComplementAction); } if (hasAmino) { setupTranslationsMenu(); setupGeneticCodeMenu(); } addActionToLocalToolbar(editor->getEditAction()); verticalScrollBar = new GScrollBar(Qt::Vertical, this); verticalScrollBar->setObjectName("multiline_scrollbar"); scrollBar->setObjectName("singleline_scrollbar"); currentShiftsCounter = 0; numShiftsInOneLine = 1; verticalScrollBar->setHidden(!wrapSequenceAction->isChecked()); scrollBar->setHidden(wrapSequenceAction->isChecked()); pack(); updateActions(); // TODO_SVEDIT: check its required connect(ctx->getSequenceObject(), SIGNAL(si_sequenceChanged()), SLOT(sl_sequenceChanged())); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); }
void MWMDIManagerImpl::updateState() { updateActions(); sl_updateWindowMenu(); AppContext::getSettings()->setValue(SETTINGS_DIR + "maximized", defaultIsMaximized); }
void GUIClient::clientAdded( KXMLGUIClient *client ) { if ( client == this ) updateActions(); }
GPXLab::GPXLab(const QString &fileName, QWidget *parent) : QMainWindow(parent), ui(new Ui::GPXLab), closing(false) { // setup UI ui->setupUi(this); // create GPX_model wrapper gpxmw = new GPX_wrapper(appName); connect(gpxmw, SIGNAL(fileLoaded()), this, SLOT(fileLoaded())); connect(gpxmw, SIGNAL(fileSaved()), this, SLOT(fileSaved())); connect(gpxmw, SIGNAL(modelCleared()), this, SLOT(modelCleared())); connect(gpxmw, SIGNAL(modelPropertiesChanged()), this, SLOT(modelPropertiesChanged())); connect(gpxmw, SIGNAL(modelMetadataChanged()), this, SLOT(modelMetadataChanged())); connect(gpxmw, SIGNAL(trackMetadataChanged(int)), this, SLOT(trackMetadataChanged(int))); connect(gpxmw, SIGNAL(trackInserted(int, const GPX_trkType&)), this, SLOT(trackInserted(int, const GPX_trkType&))); connect(gpxmw, SIGNAL(trackDeleted(int)), this, SLOT(trackDeleted(int))); connect(gpxmw, SIGNAL(trackMovedUp(int)), this, SLOT(trackMovedUp(int))); connect(gpxmw, SIGNAL(trackMovedDown(int)), this, SLOT(trackMovedDown(int))); connect(gpxmw, SIGNAL(trackSplited(int)), this, SLOT(trackSplited(int))); connect(gpxmw, SIGNAL(trackCombined(int)), this, SLOT(trackCombined(int))); connect(gpxmw, SIGNAL(trackTimeShifted(int, long)), this, SLOT(trackTimeShifted(int, long))); connect(gpxmw, SIGNAL(trackSelectionChanged(int, int, int, const GPX_wptType*)), this, SLOT(trackSelectionChanged(int, int, int, const GPX_wptType*))); connect(gpxmw, SIGNAL(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty)), this, SLOT(pointEdited(int, int, int, GPX_wrapper::TrackPointProperty))); connect(gpxmw, SIGNAL(pointInserted(int, int, int, const GPX_wptType&)), this, SLOT(pointInserted(int, int, int, const GPX_wptType&))); connect(gpxmw, SIGNAL(pointDeleted(int, int, int)), this, SLOT(pointDeleted(int, int, int))); connect(gpxmw, SIGNAL(pointSelectionChanged(int, const GPX_wptType*)), this, SLOT(pointSelectionChanged(int, const GPX_wptType*))); // set window title setMainWindowTitle(); // load settings settings = new Settings(this); settings->load(); ui->actionFollow_Item->setChecked(settings->getValue("FollowItem").toBool()); ui->actionShow_Only_Selected_Track->setChecked(settings->getValue("ShowOnlySelectedItem").toBool()); // undo stack undoStack = new QUndoStack(this); undoStack->setUndoLimit(settings->undoLimit); QAction *undoAction = undoStack->createUndoAction(this, tr("&Undo")); undoAction->setShortcuts(QKeySequence::Undo); undoAction->setIcon(QIcon(":/images/undo.png")); QAction *redoAction = undoStack->createRedoAction(this, tr("&Redo")); redoAction->setShortcuts(QKeySequence::Redo); redoAction->setIcon(QIcon(":/images/redo.png")); connect(undoStack, SIGNAL(indexChanged(int)), this, SLOT(setMainWindowTitle())); // tree widget connect(ui->treeTracks, SIGNAL(itemDoubleClicked(QTreeWidgetItem* , int)), this, SLOT(tree_doubleClicked(QTreeWidgetItem*, int))); // map widget ui->mapWidget->init(gpxmw, undoStack, settings->doPersistentCaching, settings->cachePath); ui->mapWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->mapWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(map_showContextMenu(const QPoint&))); connect(ui->mapWidget, SIGNAL(viewChanged(const QPointF&, int)), this, SLOT(map_viewChanged(const QPointF&, int))); // calendar widget ui->calendarWidget->init(gpxmw); // table widget ui->tableWidgetPoints->init(gpxmw, undoStack); connect(settings, SIGNAL(settingsChanged(bool)), ui->tableWidgetPoints, SLOT(settingsChanged(bool))); // diagram widget ui->diagramWidget->addAction(ui->dockWidgetDiagrams->toggleViewAction()); ui->diagramWidget->init(gpxmw); // status bar widgets lblCoordinates = new QLabel(); statusBar()->addWidget(lblCoordinates); lblStatus = new QLabel(); statusBar()->addWidget(lblStatus); // zoom slider widget zoomSlider = new QSlider(Qt::Horizontal, this); zoomSlider->setMinimumWidth(10); zoomSlider->setMaximumWidth(100); zoomSlider->setMinimum(0); zoomSlider->setMaximum(0); ui->mainToolBar->insertWidget(ui->actionMapZoom, zoomSlider); connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(zoom_valueChanged(int))); // build recent files action actionOpenRecentFile = new QAction*[settings->maxRecentFiles]; for (int i = 0; i < settings->maxRecentFiles; ++i) { actionOpenRecentFile[i] = new QAction(this); actionOpenRecentFile[i]->setVisible(false); connect(actionOpenRecentFile[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, actionOpenRecentFile[i]); } ui->menuFile->insertSeparator(ui->actionExit); updateRecentFiles(); // menu edit ui->menuEdit->addAction(undoAction); ui->menuEdit->addAction(redoAction); // menu view ui->menuView->addAction(ui->dockWidgetFile->toggleViewAction()); ui->menuView->addAction(ui->dockWidgetTracks->toggleViewAction()); ui->menuView->addAction(ui->dockWidgetDiagrams->toggleViewAction()); ui->menuView->addAction(ui->dockWidgetPoints->toggleViewAction()); ui->menuView->addAction(ui->mainToolBar->toggleViewAction()); ui->menuView->addSeparator(); ui->menuView->addAction(ui->actionRestore_Default_View); // install event filters for dock widgets to catch resize events ui->dockWidgetFile->installEventFilter(this); ui->dockWidgetTracks->installEventFilter(this); ui->dockWidgetDiagrams->installEventFilter(this); ui->dockWidgetPoints->installEventFilter(this); // dock file ui->dockWidgetFile->addAction(ui->dockWidgetFile->toggleViewAction()); ui->dockWidgetFile->addAction(ui->actionEdit_File_Properties); // dock tracks ui->dockWidgetTracks->addAction(ui->dockWidgetTracks->toggleViewAction()); ui->dockWidgetTracks->addAction(ui->actionEdit_Track_Properties); ui->dockWidgetTracks->addAction(ui->actionGetAltitudeFromSRTM); ui->dockWidgetTracks->addAction(ui->actionSetStartTime); // dock diagram ui->dockWidgetDiagrams->addActions(ui->diagramWidget->actions()); // dock points ui->dockWidgetPoints->addAction(ui->dockWidgetPoints->toggleViewAction()); ui->dockWidgetPoints->addAction(ui->actionInsert_Point); ui->dockWidgetPoints->addAction(ui->actionDelete_Point); // default context menu addActions(ui->menuView->actions()); // connect signals for track and point selection connect(ui->diagramWidget, SIGNAL(selectionChanged(time_t)), this, SLOT(diagram_selectionChanged(time_t))); connect(ui->mapWidget, SIGNAL(selectionChanged(int, int, double, double)), this, SLOT(map_selectionChanged(int, int, double, double))); connect(ui->mapWidget, SIGNAL(selectionChanged(int)), this, SLOT(map_selectionChanged(int))); connect(ui->tableWidgetPoints, SIGNAL(selectionChanged(int)), this, SLOT(table_selectionChanged(int))); connect(ui->treeTracks, SIGNAL(itemSelectionChanged()), this, SLOT(tree_selectionChanged())); connect(ui->calendarWidget, SIGNAL(selectionChanged(int)), this, SLOT(cal_selectionChanged(int))); // disable actions updateActions(false); // open file if any passed as argument if (!fileName.isEmpty()) { openFile(fileName); } }
void RichTextEditor::on_qteRichText_textChanged() { bModified = true; bChanged = true; updateActions(); }
CommandManager::CommandManager() : mModel(new CommandDataModel(this)) { updateActions(); }
void RichTextEditor::on_qteRichText_currentCharFormatChanged() { updateActions(); }
void MainWindow::onTabCloseRequested(int index) { tabWidget->widget(index)->close(); updateActions(); }
void RecentFiles::clear(void) { m_files.clear(); updateActions(); }
void QgsOfflineEditingPlugin::synchronize() { mProgressDialog->setTitle( tr( "Synchronizing to remote layers" ) ); mOfflineEditing->synchronize(); updateActions(); }