BtBookshelfWidget::BtBookshelfWidget(QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags) , m_sourceModel(nullptr) , m_treeModel(nullptr) , m_leftCornerWidget(nullptr) , m_rightCornerWidget(nullptr) { // Setup post-filter: m_postFilterModel = new BtBookshelfFilterModel(this); // Init widgets and such: initActions(); initMenus(); initWidgets(); // Connect treeview to model: m_treeView->setModel(m_postFilterModel); retranslateUi(); BT_CONNECT(m_nameFilterEdit, SIGNAL(textEdited(QString)), m_postFilterModel, SLOT(setNameFilterFixedString(QString))); BT_CONNECT(m_treeView, SIGNAL(contextMenuActivated(QPoint)), this, SLOT(slotShowContextMenu(QPoint))); BT_CONNECT(m_treeView, SIGNAL(moduleContextMenuActivated(CSwordModuleInfo *, QPoint)), this, SLOT(slotShowItemContextMenu(CSwordModuleInfo *, QPoint))); }
ThunderPanel::ThunderPanel(QWidget *parent) : QWidget(parent), ui(new Ui::ThunderPanel), my_model(new QStandardItemModel), my_contextMenu(new QMenu(this)) { ui->setupUi(this); QAction *action = new QAction (QIcon(":/resources/images/movie.png"), tr("Preview"), this); connect (action, SIGNAL(triggered()), SLOT(slotPreviewThisTask())); my_contextMenu->addAction(action); action = new QAction (tr("Download"), this); connect (action, SIGNAL(triggered()), SLOT(slotDownloadThisTask())); my_contextMenu->addAction(action); my_contextMenu->addSeparator(); action = new QAction (QIcon(":/resources/images/user-trash.png"), tr("Remove selected tasks"), this); connect (action, SIGNAL(triggered()), SLOT(slotRemoveTheseTasks())); my_contextMenu->addAction(action); my_contextMenu->addSeparator(); action = new QAction (tr("Copy download address"), this); connect (action, SIGNAL(triggered()), SLOT(slotCopyDownloadAddress())); my_contextMenu->addSeparator(); my_contextMenu->addAction(action); action = new QAction (tr("Copy source address"), this); connect (action, SIGNAL(triggered()), SLOT(slotCopySourceAddress())); my_contextMenu->addAction(action); connect (ui->treeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotShowContextMenu(QPoint))); my_model->setHorizontalHeaderLabels(QStringList() << tr("Size") << tr("Name")); ui->treeView->setModel(my_model); ui->treeView->resizeColumnToContents(0); }
bool EvaScriptManager::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: slotCurrentChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 1: static_QUType_bool.set(_o,slotInstallScript()); break; case 2: static_QUType_bool.set(_o,slotInstallScript((const QString&)static_QUType_QString.get(_o+1))); break; case 3: slotUninstallScript(); break; case 4: static_QUType_bool.set(_o,slotRunScript()); break; case 5: static_QUType_bool.set(_o,slotRunScript((bool)static_QUType_bool.get(_o+1))); break; case 6: slotStopScript(); break; case 7: slotConfigureScript(); break; case 8: slotAboutScript(); break; case 9: slotShowContextMenu((QListViewItem*)static_QUType_ptr.get(_o+1),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+2))); break; case 10: slotReceivedStdout((KProcess*)static_QUType_ptr.get(_o+1),(char*)static_QUType_charstar.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 11: slotReceivedStderr((KProcess*)static_QUType_ptr.get(_o+1),(char*)static_QUType_charstar.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 12: scriptFinished((KProcess*)static_QUType_ptr.get(_o+1)); break; default: return KDialogBase::qt_invoke( _id, _o ); } return TRUE; }
KatePluginSymbolViewerView::KatePluginSymbolViewerView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mw) :QObject(mw) ,m_mainWindow(mw) ,m_plugin(qobject_cast<KatePluginSymbolViewer*>(plugin)) { // FIXME KF5 KGlobal::locale()->insertCatalog("katesymbolviewerplugin"); KXMLGUIClient::setComponentName (QLatin1String("katesymbolviewer"), i18n ("SymbolViewer")); setXMLFile(QLatin1String("ui.rc")); mw->guiFactory()->addClient (this); m_symbols = 0; m_popup = new QMenu(m_symbols); m_popup->addAction(i18n("Refresh List"), this, SLOT(slotRefreshSymbol())); m_popup->addSeparator(); m_macro = m_popup->addAction(i18n("Show Macros"), this, SLOT(toggleShowMacros())); m_struct = m_popup->addAction(i18n("Show Structures"), this, SLOT(toggleShowStructures())); m_func = m_popup->addAction(i18n("Show Functions"), this, SLOT(toggleShowFunctions())); m_popup->addSeparator(); m_popup->addAction(i18n("List/Tree Mode"), this, SLOT(slotChangeMode())); m_sort = m_popup->addAction(i18n("Enable Sorting"), this, SLOT(slotEnableSorting())); KConfigGroup config(KSharedConfig::openConfig(), "PluginSymbolViewer"); m_plugin->typesOn = config.readEntry(QLatin1String("ViewTypes"), false); m_plugin->expandedOn = config.readEntry(QLatin1String("ExpandTree"), false); m_plugin->treeOn = config.readEntry(QLatin1String("TreeView"), false); m_plugin->sortOn = config.readEntry(QLatin1String("SortSymbols"), false); m_macro->setChecked(true); m_struct->setChecked(true); m_func->setChecked(true); m_sort->setChecked(m_plugin->sortOn); macro_on = true; struct_on = true; func_on = true; m_updateTimer.setSingleShot(true); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(slotRefreshSymbol())); m_currItemTimer.setSingleShot(true); connect(&m_currItemTimer, SIGNAL(timeout()), this, SLOT(updateCurrTreeItem())); QPixmap cls( ( const char** ) class_xpm ); m_toolview = m_mainWindow->createToolView(plugin, QLatin1String("kate_plugin_symbolviewer"), KTextEditor::MainWindow::Left, cls, i18n("Symbol List")); QWidget *container = new QWidget(m_toolview); QHBoxLayout *layout = new QHBoxLayout(container); m_symbols = new QTreeWidget(); m_symbols->setFocusPolicy(Qt::NoFocus); m_symbols->setLayoutDirection( Qt::LeftToRight ); layout->addWidget(m_symbols, 10); layout->setContentsMargins(0,0,0,0); connect(m_symbols, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(goToSymbol(QTreeWidgetItem*))); connect(m_symbols, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotShowContextMenu(QPoint))); connect(m_mainWindow, SIGNAL(viewChanged(KTextEditor::View *)), this, SLOT(slotDocChanged())); QStringList titles; titles << i18nc("@title:column", "Symbols") << i18nc("@title:column", "Position"); m_symbols->setColumnCount(2); m_symbols->setHeaderLabels(titles); m_symbols->setColumnHidden(1, true); m_symbols->setSortingEnabled(m_plugin->sortOn); m_symbols->setRootIsDecorated(0); m_symbols->setContextMenuPolicy(Qt::CustomContextMenu); m_symbols->setIndentation(10); m_toolview->installEventFilter(this); /* First Symbols parsing here...*/ QTimer::singleShot(10, this, SLOT(slotRefreshSymbol())); if (m_plugin->sortOn == true) m_symbols->sortItems(0, Qt::AscendingOrder); }
ThunderPanel::ThunderPanel(QWidget *parent) : QWidget(parent), ui(new Ui::ThunderPanel), my_quickViewMode(true), my_filterModel(new QSortFilterProxyModel), my_model(new QStandardItemModel), my_contextMenu(new QMenu(this)) { ui->setupUi(this); ui->filterPanel->hide(); QAction *action = new QAction (QIcon(":/resources/images/movie.png"), tr("Preview"), this); connect (action, SIGNAL(triggered()), SLOT(slotPreviewThisTask())); my_contextMenu->addAction(action); action = new QAction (tr("Download"), this); connect (action, SIGNAL(triggered()), SLOT(slotDownloadThisTask())); my_contextMenu->addAction(action); my_contextMenu->addSeparator(); action = new QAction (QIcon(":/resources/images/user-trash.png"), tr("Remove selected tasks"), this); connect (action, SIGNAL(triggered()), SLOT(slotRemoveTheseTasks())); my_contextMenu->addAction(action); my_contextMenu->addSeparator(); action = new QAction (tr("Copy download address"), this); connect (action, SIGNAL(triggered()), SLOT(slotCopyDownloadAddress())); my_contextMenu->addSeparator(); my_contextMenu->addAction(action); action = new QAction (tr("Copy source address"), this); connect (action, SIGNAL(triggered()), SLOT(slotCopySourceAddress())); my_contextMenu->addAction(action); action = new QAction (tr("Copy task name"), this); connect (action, SIGNAL(triggered()), SLOT(slotCopyTaskName())); my_contextMenu->addAction(action); my_contextMenu->addSeparator(); action = new QAction (tr("Collapse all"), this); connect (action, SIGNAL(triggered()), ui->treeView, SLOT(collapseAll())); my_contextMenu->addAction(action); action = new QAction (tr("Expand all"), this); connect (action, SIGNAL(triggered()), ui->treeView, SLOT(expandAll())); my_contextMenu->addAction(action); action = new QAction (tr("Resize Columns"), this); connect (action, SIGNAL(triggered()), this, SLOT(slotResizeAllColumnsOfTreeView())); my_contextMenu->addAction(action); connect (ui->treeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(slotShowContextMenu(QPoint))); my_model->setHorizontalHeaderLabels(QStringList() << tr("Size") << tr("Name")); my_filterModel->setSourceModel(my_model); ui->treeView->setModel(my_model); ui->treeView->resizeColumnToContents(0); connect (ui->treeView, SIGNAL(expanded(QModelIndex)), SLOT(slotResizeFirstColumnOfTreeView())); }