예제 #1
0
Selection ScenarioModel::selectedChildren() const
{
    Selection objects;
    copySelected(m_events, objects);
    copySelected(m_timeNodes, objects);
    copySelected(m_constraints, objects);
    copySelected(m_states, objects);

    return objects;
}
예제 #2
0
void GameWindow::buildContextMenu() {
    menu = new ContextMenu(this);
    appearanceAct = new QAction(tr("&Appearance\t"), this);
    menu->addAction(appearanceAct);
    connect(appearanceAct, SIGNAL(triggered()), this, SLOT(changeAppearance()));

    menu->addSeparator();

    copyAct = new QAction(tr("&Copy\t"), this);
    menu->addAction(copyAct);
    copyAct->setEnabled(false);
    connect(copyAct, SIGNAL(triggered()), this, SLOT(copySelected()));

    selectAct = new QAction(tr("&Select all\t"), this);
    menu->addAction(selectAct);
    connect(selectAct, SIGNAL(triggered()), this, SLOT(selectAll()));

    menu->addSeparator();

    saveAct = new QAction(tr("&Save as HTML\t"), this);
    menu->addAction(saveAct);
    connect(saveAct, SIGNAL(triggered()), this, SLOT(saveAsHtml()));

    menu->addSeparator();

    clearAct = new QAction(tr("&Clear\t"), this);
    menu->addAction(clearAct);
    connect(clearAct, SIGNAL(triggered()), this, SLOT(clear()));
}
예제 #3
0
QJsonObject copySelectedScenarioElements(const Scenario::ScenarioModel &sm)
{
    auto obj = copySelected(sm, const_cast<Scenario::ScenarioModel*>(&sm));

    obj["Comments"] = arrayToJson(selectedElements(sm.comments));

    return obj;
}
예제 #4
0
void PDFFactory::createActions()
{
    openAction = new QAction(tr("&Open"), this);
    openAction->setIcon(QIcon(":/images/open.png"));
    openAction->setShortcut(tr("Ctrl+O"));
    openAction->setStatusTip(tr("Open a PDF"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    exportAction = new QAction(tr("&Export a single file"), this);
    exportAction->setIcon(QIcon(":/images/export.png"));
    exportAction->setShortcut(tr("Ctrl+S"));
    exportAction->setStatusTip(tr("Export the selected file to a new PDF"));
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportFile()));

    exportAllAction = new QAction(tr("Export all"), this);
    exportAllAction->setIcon(QIcon(":/images/exportall.png"));
    exportAllAction->setShortcut(tr("Shift+Ctrl+S"));
    exportAllAction->setStatusTip(tr("Export all to multiple PDF files"));
    connect(exportAllAction, SIGNAL(triggered()), this, SLOT(exportAllFiles()));

    cutAction = new QAction(tr("C&ut"), this);
    cutAction->setIcon(QIcon(":/images/cut.png"));
    cutAction->setShortcut(tr("Ctrl+X"));
    cutAction->setStatusTip(tr("Cut selected contents to clipboard"));
    connect(cutAction, SIGNAL(triggered()), pdfTableView, SLOT(cutSelected()));

    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setIcon(QIcon(":/images/copy.png"));
    copyAction->setShortcut(tr("Ctrl+C"));
    copyAction->setStatusTip(tr("Copy selected contents to clipboard"));
    connect(copyAction, SIGNAL(triggered()), pdfTableView, SLOT(copySelected()));

    pasteAction = new QAction(tr("&Paste"), this);
    pasteAction->setIcon(QIcon(":/images/paste.png"));
    pasteAction->setShortcut(tr("Ctrl+V"));
    pasteAction->setStatusTip(tr("Paste clipboard's contents into current selection"));
    //connect(pasteAction, SIGNAL(triggered()), textEdit, SLOT(paste()));

    deleteAction = new QAction(tr("&Delete"), this);
    deleteAction->setIcon(QIcon(":/images/delete.png"));
    deleteAction->setShortcut(tr("Ctrl+D"));
    deleteAction->setStatusTip(tr("Delete selected contents"));
    connect(deleteAction, SIGNAL(triggered()), pdfTableView, SLOT(deleteSelected()));

    rotateAction = new QAction(tr("&Rotate"), this);
    rotateAction->setIcon(QIcon(":/images/rotate.png"));
    rotateAction->setShortcut(tr("Ctrl+R"));
    rotateAction->setStatusTip(tr("Rotate selected pages"));
    connect(rotateAction, SIGNAL(triggered()), pdfTableView, SLOT(rotateSelected()));

    aboutAction = new QAction(tr("A&bout"), this);
    aboutAction->setIcon(QIcon(":/images/about.png"));
    aboutAction->setStatusTip(tr("About this program"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}
예제 #5
0
void QTableViewCp::keyPressEvent(QKeyEvent * event)
{
  if(event->matches(QKeySequence::Copy) )
  {
	  copySelected();
  }
  else
  {
	  QTableView::keyPressEvent(event);
  }
}
ossimQtVceCanvasWidget::ossimQtVceCanvasWidget(QWidget* parent, 
                                               QString name)
   :QCanvasView(parent, name)
{
   theSelectionRect    = NULL;
   theLineObject       = NULL;
   theMouseButtonState = Qt::NoButton;
   setAcceptDrops(true);
   theCanvasUtility = new ossimQtVceCanvasContainerUtility(this);
   thePopupMenu = new QPopupMenu(this);
   thePopupMenu->hide();
   thePopupMenu->clear();
   thePopupMenu->insertItem("Copy", this, SLOT(copySelected()));
   thePopupMenu->insertItem("Paste", this, SLOT(paste()));
   thePopupMenu->insertItem("Cut", this, SLOT(cutSelected()));
   thePopupMenu->insertSeparator();
   thePopupMenu->insertItem("Execute", this, SLOT(executeSelected()));
}
예제 #7
0
void GenericWindow::buildContextMenu() {
    menu = new QMenu(this);

    copyAct = new QAction(tr("&Copy\t"), this);
    menu->addAction(copyAct);
    copyAct->setEnabled(false);
    connect(copyAct, SIGNAL(triggered()), this, SLOT(copySelected()));

    selectAct = new QAction(tr("&Select all\t"), this);
    menu->addAction(selectAct);
    connect(selectAct, SIGNAL(triggered()), this, SLOT(selectAll()));

    menu->addSeparator();

    clearAct = new QAction(tr("&Clear\t"), this);
    menu->addAction(clearAct);
    connect(clearAct, SIGNAL(triggered()), this, SLOT(clear()));
}
Win_data::Win_data(QWidget *parent,Qt::WindowFlags flags )
		:QWidget(parent,flags|Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint)
{
	QFont font;
	font.setFamily(("simsun"));
	QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
	//set the font and encode

	view = new MyView(this);	
	view->setGeometry(10,10,280,380);

	radioButton_allSelect = new QRadioButton(this);
	radioButton_noneSelect = new QRadioButton(this);
	radioButton_allSelect->setText(QObject::tr("全选"));
	radioButton_noneSelect->setText(QObject::tr("全不选"));
	radioButton_allSelect->setGeometry(300,10,80,30);
	radioButton_noneSelect->setGeometry(300,50,80,30);

	button_delete = new QPushButton(this);
	button_delete->setText(QObject::tr("删除"));
	button_delete->setGeometry(300,90,80,30);
	button_copy = new QPushButton(this);
	button_copy->setText(QObject::tr("导出"));
	button_copy->setGeometry(300,130,80,30);
	button_close = new QPushButton(this);
	button_close->setText(QObject::tr("退出"));
	button_close->setGeometry(300,170,80,30);

	msgLabel = new QLabel(this);
	msgLabel->setGeometry(10,150,300,80);
	msgLabel->setAlignment(Qt::AlignHCenter);


	QObject::connect(button_delete,SIGNAL(clicked()),this,SLOT(deleteSelect()));
	QObject::connect(button_copy,SIGNAL(clicked()),view,SLOT(copySelected()));
	QObject::connect(button_close,SIGNAL(clicked()),this,SLOT(close()));
	QObject::connect(radioButton_allSelect,SIGNAL(toggled(bool)),view,SLOT(AllSelect(bool)));
	QObject::connect(radioButton_noneSelect,SIGNAL(toggled(bool)),view,SLOT(NoneSelect(bool)));
	QObject::connect(view,SIGNAL(signalShow(QString,Qt::GlobalColor)),this,SLOT(slotShow(QString,Qt::GlobalColor)));
	QObject::connect(view,SIGNAL(signalClearShow()),this,SLOT(slotClearShow()));

}
void ossimQtVceCanvasWidget::cutSelected()
{
   if(theSelectedItems.size())
   {
      // before we delete copy to clipboard.
      // so they can re-paste if needed
      //
      copySelected();

      deleteAllAssociatedConnections(theSelectedItems);
      
      for(int idx = 0; idx < (int)theSelectedItems.size(); ++idx)
      {
	 emit itemDeleting(theSelectedItems[idx]);
	 theSelectedItems[idx]->hide();
	 delete theSelectedItems[idx];
      }
   }
   
   theSelectedItems.clear();
}
예제 #10
0
UPacketMonitor::UPacketMonitor( QWidget *parent /*= 0*/ )
:QTableView(parent)
{
    setAlternatingRowColors(true);
    setVerticalScrollMode(ScrollPerPixel);
    //setWordWrap(false);
    //setSortingEnabled(true);
    QFontMetrics fontMetrics(font());
    horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    verticalHeader()->setDefaultSectionSize(fontMetrics.height()+3);
    setContextMenuPolicy(Qt::ActionsContextMenu);

    copyAction_ = new QAction(tr("Copy"),this);
    addAction(copyAction_);

    horizontalHeader()->setContextMenuPolicy(Qt::ActionsContextMenu);
    horizontalHeader()->setSectionsMovable(true);

    connect(copyAction_,SIGNAL(triggered()),this,SLOT(copySelected()));
    connect(this,SIGNAL(activated(const QModelIndex &)),this,SLOT(showPacket(const QModelIndex &)));
}
예제 #11
0
QJsonObject copySelectedScenarioElements(
        const BaseScenarioContainer &sm,
        QObject *parent)
{
    return copySelected(sm, parent);
}
예제 #12
0
void ResultsJsInterface::showAnalysesMenu(QString options)
{
	Json::Value menuOptions;

	Json::Reader parser;
	parser.parse(fq(options), menuOptions);

	QIcon _copyIcon = QIcon(":/icons/copy.png");
	QIcon _citeIcon = QIcon(":/icons/cite.png");
	QIcon _codeIcon = QIcon(":/icons/code-icon.png");
	QIcon _collapseIcon = QIcon(":/icons/collapse.png");
	QIcon _expandIcon = QIcon(":/icons/expand.png");
	QIcon _saveImageIcon = QIcon(":/icons/document-save-as.png");
	QIcon _editImageIcon = QIcon(":/icons/editImage.png");

	_analysisMenu->clear();

	QString objName = tq(menuOptions["objectName"].asString());

	if (menuOptions["hasCollapse"].asBool())
	{
		Json::Value collapseOptions = menuOptions["collapseOptions"];
		QIcon icon = collapseOptions["collapsed"].asBool() ? _expandIcon : _collapseIcon;
		_analysisMenu->addAction(icon, tq(collapseOptions["menuText"].asString()), this, SLOT(collapseSelected()));
		_analysisMenu->addSeparator();
	}

	if (menuOptions["hasEditTitle"].asBool())
	{
		_analysisMenu->addAction("Edit Title", this, SLOT(editTitleSelected()));
		_analysisMenu->addSeparator();
	}

	if (menuOptions["hasCopy"].asBool())
		_analysisMenu->addAction(_copyIcon, "Copy", this, SLOT(copySelected()));

	if (menuOptions["hasLaTeXCode"].asBool())  // TODO: || menuOptions["hasPlainText"].asBool())
	{
		_copySpecialMenu = _analysisMenu->addMenu(tr("&Copy special"));

		_copySpecialMenu->addAction(_codeIcon, "LaTeX code", this, SLOT(latexCodeSelected()));

		QAction *copyTextAction = new QAction("Copy text");
		// connect(copyTextAction, SIGNAL(triggered), this, SLOT(copyTextSelected));
		copyTextAction->setEnabled(false);
		_copySpecialMenu->addAction(copyTextAction);
	}

	if (menuOptions["hasCite"].asBool())
	{
		_analysisMenu->addSeparator();
		_analysisMenu->addAction(_citeIcon, "Copy Citations", this, SLOT(citeSelected()));
	}

	if (menuOptions["hasSaveImg"].asBool())
	{
		_analysisMenu->addAction(_saveImageIcon, "Save Image As", this, SLOT(saveImage()));
	}
#ifdef JASP_DEBUG
    if (menuOptions["hasEditImg"].asBool())
    {
        _analysisMenu->addAction(_editImageIcon, "Edit Image", this, SLOT(editImage()));
    }
#endif

	if (menuOptions["hasNotes"].asBool())
	{
		_analysisMenu->addSeparator();

		Json::Value noteOptions = menuOptions["noteOptions"];

		for (Json::ValueIterator iter = noteOptions.begin(); iter != noteOptions.end(); iter++)
		{
			Json::Value noteOption = *iter;
			QAction *a1 = _analysisMenu->addAction(tq(noteOption["menuText"].asString()), this, SLOT(noteSelected()));

			a1->setDisabled(noteOption["visible"].asBool());


			QString call = QString("window.notesMenuClicked('%1', %2);").arg(tq(noteOption["key"].asString())).arg(noteOption["visible"].asBool() ? "false" : "true");

			a1->setData(call);
		}
	}


	if (menuOptions["hasRemove"].asBool())
	{
		_analysisMenu->addSeparator();
		_analysisMenu->addAction("Remove " + objName, this, SLOT(removeSelected()));
	}

	if (menuOptions["hasRemoveAllAnalyses"].asBool())
	{
		_analysisMenu->addSeparator();
		_analysisMenu->addAction("Remove All ", _mainWindow, SLOT(removeAllAnalyses()));
	}

	if (menuOptions["hasRefreshAllAnalyses"].asBool())
	{
		_analysisMenu->addSeparator();
		_analysisMenu->addAction("Refresh All ", _mainWindow, SLOT(refreshAllAnalyses()));
	}

	QPoint point = _webViewResults->mapToGlobal(QPoint(round(menuOptions["rX"].asInt() * _webViewZoom), round(menuOptions["rY"].asInt() * _webViewZoom)));

	_analysisMenu->move(point);
	_analysisMenu->show();
}
예제 #13
0
Window::Window(QWidget* parent):
    QMainWindow(parent)
{
    setObjectName("PlanetScannerWindow");

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "Refresh");
    connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));

    planetTreeView = new QTreeView(this);
    planetTreeView->setMinimumHeight(10);
    planetTreeModel = new PlanetTreeModel(planetTreeView);
    planetTreeProxyModel = new PlanetTreeSortFilterProxyModel(planetTreeModel);
    planetTreeProxyModel->setSourceModel(planetTreeModel);
    planetTreeView->setModel(planetTreeProxyModel);
    planetTreeModel->setHorizontalHeaderLabels(QStringList() << "Hostname" << "Map" << "Gametype" << "Players" << "Address");
    planetTreeView->setSortingEnabled(true);
    planetTreeView->sortByColumn(0, Qt::AscendingOrder);
    planetTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    planetTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
    connect(planetTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));

    QAction* connectAction = new QAction("Connect", planetTreeView);
    QAction* connectAsSpectatorAction = new QAction("Connect as spectator", planetTreeView);
    QAction* copyAction = new QAction("Copy", planetTreeView);
    QAction* openProfileAction = new QAction("Open profile in a browser", planetTreeView);
    connect(connectAction, SIGNAL(triggered()), this, SLOT(connectSelected()));
    connect(connectAsSpectatorAction, SIGNAL(triggered()), this, SLOT(connectAsSpectatorSelected()));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copySelected()));
    connect(openProfileAction, &QAction::triggered, this, &Window::openProfileSelected);
    gameContextMenu = new QMenu(planetTreeView);
    planetContextMenu = new QMenu(planetTreeView);
    registeredPlayerContextMenu = new QMenu(planetTreeView);
    unregisteredPlayerContextMenu = new QMenu(planetTreeView);
    gameContextMenu->addActions(QList<QAction*>() << connectAction << connectAsSpectatorAction << copyAction);
    planetContextMenu->addActions(QList<QAction*>() << copyAction);
    registeredPlayerContextMenu->addActions(QList<QAction*>() << openProfileAction << copyAction);
    unregisteredPlayerContextMenu->addActions(QList<QAction*>() << copyAction);

    setCentralWidget(planetTreeView);

    game = new QProcess(this);

    statistics = new StatisticsWebSite(this);
    connect(statistics, &StatisticsWebSite::playersInfoRecieved, this, &Window::processStatisticsPlayers);

    autoRefreshTimer = new QTimer(this);
    connect(autoRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshPlanets()));

    contextMenuShown = false;

    Settings& settings = Settings::getInstance();
    connect(&settings, &Settings::dataChanged, this, &Window::applyChangedSettings);
    settings.load();
    applyChangedSettings();

    ::Settings::loadWindow(this);

    refreshPlanets();
}