示例#1
0
void Quiddiards::keyPressEvent(QKeyEvent *event){
	switch (event->key()) {
	case Qt::Key_F2:
		actStart();
		break;
	case Qt::Key_P:
		actPause();
		break;
	case Qt::Key_Escape:
	case Qt::Key_Q:
		close();
		break;
	case Qt::Key_Space:
	case Qt::Key_Enter:
	case Qt::Key_Return:
		break;
	case Qt::Key_W:{
		/* forward cueball */
		QVector3D n = -eye;
		n.setZ(0);
		n.normalize();
		n += cueball.getVelocity();
		if (n.length() > cueball.getSpeed()){
			n = cueball.getSpeed()*n.normalized();
		}
		cueball.setVelocity(n);
		break;
	}
	case Qt::Key_A:
		phi += 10;
		break;
	case Qt::Key_S:{
		QVector3D n = eye;
		n.setZ(0);
		n.normalize();
		n += cueball.getVelocity();
		if (n.length() > cueball.getSpeed()){
			n = cueball.getSpeed()*n.normalized();
		}
		cueball.setVelocity(n);
		break;
	}
	case Qt::Key_D:
		phi -= 10;
		break;
	case Qt::Key_Tab:
		//camera = CAMERA((camera + 1) % 2);
		break;
	default:
		return;
	}
	update();
}
示例#2
0
void Quiddiards::initUI(){
	ui.setupUi(this);
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(actAbout()));
	connect(ui.actionAmbient, SIGNAL(triggered()), this, SLOT(actAmbient()));
	connect(ui.actionControl, SIGNAL(triggered()), this, SLOT(actControl()));
	connect(ui.actionPause, SIGNAL(triggered()), this, SLOT(actPause()));
	connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(actQuit()));
	connect(ui.actionSpotlight, SIGNAL(triggered()), this, SLOT(actSpotlight()));
	connect(ui.actionStart, SIGNAL(triggered()), this, SLOT(actStart()));
	connect(ui.actionSunlight, SIGNAL(triggered()), this, SLOT(actSunlight()));
	connect(ui.actionWind, SIGNAL(triggered()), this, SLOT(actWind()));
}
示例#3
0
文件: listjobs.cpp 项目: code-cg/cgru
/*
void ListJobs::v_connectionLost()
{
	if( m_parentWindow != (QWidget*)Watch::getDialog()) m_parentWindow->close();
}
*/
void ListJobs::contextMenuEvent( QContextMenuEvent *event)
{
	QMenu menu(this);
	QMenu * submenu;
	QAction *action;

	ItemJob* jobitem = (ItemJob*)getCurrentItem();
	if( jobitem == NULL ) return;
	int selectedItemsCount = getSelectedItemsCount();

	if( jobitem->folders.size())
	{
		if( af::Environment::hasRULES())
		{
			action = new QAction("Open RULES", this);
			connect( action, SIGNAL( triggered() ), this, SLOT( actOpenRULES() ));
			menu.addAction( action);

			menu.addSeparator();
		}

		submenu = new QMenu("Folders", this);

		QMapIterator<QString,QString> it( jobitem->folders);
		while( it.hasNext())
		{
			it.next();

			action = new QAction( QString("\"") + it.key() + "\":", this);
			action->setEnabled( false);
			submenu->addAction( action);

			ActionString * action_str = new ActionString( it.value(), it.value(), this);
			connect( action_str, SIGNAL( triggeredString(QString) ), this, SLOT( actBrowseFolder(QString) ));
			submenu->addAction( action_str);
		}

		menu.addMenu( submenu);
		menu.addSeparator();
	}

	action = new QAction( "Show Log", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRequestLog() ));
	menu.addAction( action);

	action = new QAction( "Show Error Hosts", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRequestErrorHostsList() ));
	menu.addAction( action);

	action = new QAction( "Reset Error Hosts", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actResetErrorHosts() ));
	menu.addAction( action);

	action = new QAction( "Restart Error Tasks", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestartErrors() ));
	if( selectedItemsCount == 1) action->setEnabled( jobitem->state & AFJOB::STATE_ERROR_MASK);
	menu.addAction( action);

	menu.addSeparator();

	submenu = new QMenu("Start/Stop/Restart", this);
	menu.addMenu( submenu);

	action = new QAction( "Restart Running Tasks", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestartRunning() ));
	if( selectedItemsCount == 1) action->setEnabled( jobitem->state & AFJOB::STATE_RUNNING_MASK);
	submenu->addAction( action);

	action = new QAction( "Restart Skipped Tasks", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestartSkipped() ));
	if( selectedItemsCount == 1) action->setEnabled( jobitem->state & AFJOB::STATE_SKIPPED_MASK);
	submenu->addAction( action);

	action = new QAction( "Restart Done Tasks", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestartDone() ));
	submenu->addAction( action);

	menu.addSeparator();

	action = new QAction("Start Job", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actStart()   ));
	if( selectedItemsCount == 1) action->setEnabled( jobitem->state & AFJOB::STATE_OFFLINE_MASK);
	submenu->addAction( action);

	action = new QAction("Pause Job", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actPause()   ));
	if( selectedItemsCount == 1) action->setEnabled( false == (jobitem->state & AFJOB::STATE_OFFLINE_MASK));
	submenu->addAction( action);

	action = new QAction("Stop Job", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actStop()    ));
	if( selectedItemsCount == 1) action->setEnabled( jobitem->state & AFJOB::STATE_RUNNING_MASK);
	submenu->addAction( action);

	action = new QAction("Restart Job", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestart() ));
	if( selectedItemsCount == 1) action->setEnabled(( jobitem->time_started != 0 ) || ( jobitem->state & AFJOB::STATE_SKIPPED_MASK ));
	submenu->addAction( action);

	action = new QAction("Restart&&Pause", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actRestartPause() ));
	if( selectedItemsCount == 1) action->setEnabled(( jobitem->time_started != 0 ) || ( jobitem->state & AFJOB::STATE_SKIPPED_MASK ));
	submenu->addAction( action);

	menu.addSeparator();

	if( af::Environment::VISOR() == false)
	{
		  action = new QAction( "Move Up", this);
		  connect( action, SIGNAL( triggered() ), this, SLOT( actMoveUp() ));
		  menu.addAction( action);
		  action = new QAction( "Move Down", this);
		  connect( action, SIGNAL( triggered() ), this, SLOT( actMoveDown() ));
		  menu.addAction( action);
		  action = new QAction( "Move Top", this);
		  connect( action, SIGNAL( triggered() ), this, SLOT( actMoveTop() ));
		  menu.addAction( action);
		  action = new QAction( "Move Bottom", this);
		  connect( action, SIGNAL( triggered() ), this, SLOT( actMoveBottom() ));
		  menu.addAction( action);
	}
	else
	{
		  action = new QAction("Change Owner", this);
		  connect( action, SIGNAL( triggered() ), this, SLOT( actSetUser() ));
		  menu.addAction( action);
	}
	menu.addSeparator();

	submenu = new QMenu( "Set Parameter", this);

	action = new QAction( "Max Running Tasks", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actMaxRunningTasks() ));
	submenu->addAction( action);
	action = new QAction( "Max Run Tasks Per Host", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actMaxRunTasksPerHost() ));
	submenu->addAction( action);
	action = new QAction( "Hosts Mask", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actHostsMask() ));
	submenu->addAction( action);
	action = new QAction( "Hosts Exclude Mask", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actHostsMaskExclude() ));
	submenu->addAction( action);

	if(( af::Environment::VISOR()) || ( af::Environment::getPermUserModJobPriority()))
	{
	   action = new QAction( "Priority", this);
	   connect( action, SIGNAL( triggered() ), this, SLOT( actPriority() ));
	   submenu->addAction( action);
	}

	action = new QAction( "Depend Mask", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actDependMask() ));
	submenu->addAction( action);
	action = new QAction( "Global Depend Mask", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actDependMaskGlobal() ));
	submenu->addAction( action);
	action = new QAction( "Wait Time", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actWaitTime() ));
	submenu->addAction( action);
	action = new QAction( "Preview Approval", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actPreviewApproval() ));
	submenu->addAction( action);
	action = new QAction( "No Preview Approval", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actNoPreviewApproval() ));
	submenu->addAction( action);
	action = new QAction( "OS Needed", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actNeedOS() ));
	submenu->addAction( action);
	action = new QAction( "Properties Needed", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actNeedProperties() ));
	submenu->addAction( action);
	action = new QAction( "Post Command", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actPostCommand() ));
	submenu->addAction( action);
	action = new QAction( "Life Time", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actLifeTime() ));
	submenu->addAction( action);

	submenu->addSeparator();

	action = new QAction( "Hidden", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actSetHidden() ));
	submenu->addAction( action);
	action = new QAction( "Not Hidden", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actUnsetHidden() ));
	submenu->addAction( action);

	submenu->addSeparator();

	action = new QAction( "Annotation", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actAnnotate() ));
	submenu->addAction( action);
	action = new QAction( "Custom Data", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actCustomData() ));
	submenu->addAction( action);

	menu.addMenu( submenu);

	menu.addSeparator();

	if( selectedItemsCount == 1)
	{
		if( jobitem->getBlocksNum() > 1)
		{
			submenu = new QMenu( "Tasks Blocks", this);
			for( int b = -1; b < jobitem->getBlocksNum(); b++)
			{
				QMenu * subsubmenu = new QMenu( b == -1 ? QString("_to_all_") : jobitem->getBlockName(b), this);
				jobitem->generateMenu( b, subsubmenu , this);
				submenu->addMenu( subsubmenu);
			}
		}
		else
		{
			submenu = new QMenu( "Tasks Block", this);
			jobitem->generateMenu( 0, submenu, this);
		}
	}
	else
	{
		submenu = new QMenu( "All Selected Blocks", this);
		jobitem->generateMenu( -1, submenu, this);
	}
	menu.addMenu( submenu);

	menu.addSeparator();

	action = new QAction( "Listen", this);
	connect( action, SIGNAL( triggered() ), this, SLOT( actListenJob() ));
	menu.addAction( action);

	menu.addSeparator();

	// System job ID is 1, and can not be deleted
	if( jobitem->getId() != 1 )
	{
		action = new QAction( "Delete All Done", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actDeleteDone()));
		menu.addAction( action);

		action = new QAction( "Delete", this);
		connect( action, SIGNAL( triggered() ), this, SLOT( actDelete()));
		menu.addAction( action);
	}

	menu.exec(event->globalPos());
}
示例#4
0
文件: listjobs.cpp 项目: code-cg/cgru
ListJobs::ListJobs( QWidget* parent):
	ListNodes( parent, "jobs")
{
	if( af::Environment::VISOR())
		m_ctrl_sf = new CtrlSortFilter( this,
			&ms_SortType1_SU, &ms_SortAscending1_SU,
			&ms_SortType2_SU, &ms_SortAscending2_SU,
			&ms_FilterType_SU, &ms_FilterInclude_SU, &ms_FilterMatch_SU, &ms_FilterString_SU);
	else
		m_ctrl_sf = new CtrlSortFilter( this,
			&ms_SortType1, &ms_SortAscending1,
			&ms_SortType2, &ms_SortAscending2,
			&ms_FilterType, &ms_FilterInclude, &ms_FilterMatch, &ms_FilterString);

	m_ctrl_sf->addSortType(   CtrlSortFilter::TNONE);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TTIMECREATION);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TTIMERUN);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TTIMESTARTED);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TTIMEFINISHED);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TNUMRUNNINGTASKS);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TSERVICE);
	m_ctrl_sf->addSortType(   CtrlSortFilter::TNAME);
	m_ctrl_sf->addFilterType( CtrlSortFilter::TNONE);
	m_ctrl_sf->addFilterType( CtrlSortFilter::TNAME);
	m_ctrl_sf->addFilterType( CtrlSortFilter::TSERVICE);
	if( af::Environment::VISOR())
	{
		m_ctrl_sf->addSortType(   CtrlSortFilter::TPRIORITY);
		m_ctrl_sf->addSortType(   CtrlSortFilter::THOSTNAME);
		m_ctrl_sf->addSortType(   CtrlSortFilter::TUSERNAME);
		m_ctrl_sf->addFilterType( CtrlSortFilter::THOSTNAME);
		m_ctrl_sf->addFilterType( CtrlSortFilter::TUSERNAME);
	}

	initSortFilterCtrl();

	CtrlJobs * control = new CtrlJobs( m_ctrl_sf, this);
	m_ctrl_sf->getLayout()->addWidget( control);


	// Add left panel buttons:
	ButtonPanel * bp;

	bp = addButtonPanel("LOG","jobs_log","Show job log.");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actRequestLog()));

	bp = addButtonPanel("EHO","jobs_show_err_hosts","Show error hosts.");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actRequestErrorHostsList()));

	bp = addButtonPanel("PAU","jobs_pause","Pause selected jobs.","P");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actPause()));

	bp = addButtonPanel("STA","jobs_start","Start selected jobs.","S");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actStart()));

	bp = addButtonPanel("REH","jobs_reset_avoid_hosts","Reset error hosts.","E");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actResetErrorHosts()));

	bp = addButtonPanel("RET","jobs_restart_error_tasks","Restart error tasks.","R");
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actRestartErrors()));

	bp = addButtonPanel("DEL","jobs_delete","Delete selected jobs.","D", true);
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actDelete()));

	bp = addButtonPanel("DDJ","jobs_delete_done","Delete all done jobs.","", true);
	connect( bp, SIGNAL( sigClicked()), this, SLOT( actDeleteDone()));


	init();

	QTimer * timer = new QTimer(this);
	timer->start( 1000 * af::Environment::getWatchRefreshGuiSec());
	connect( timer, SIGNAL( timeout()), this, SLOT( repaintItems()));

	m_parentWindow->setWindowTitle("Jobs:");
}
示例#5
0
WindowMain::WindowMain(QWidget *parent)
	: QMainWindow(parent)
{
	importer = new OracleImporter(QDesktopServices::storageLocation(QDesktopServices::DataLocation), this);
	nam = new QNetworkAccessManager(this);
	
	checkBoxLayout = new QVBoxLayout;
	
	QWidget *checkboxFrame = new QWidget;
	checkboxFrame->setLayout(checkBoxLayout);
	
	QScrollArea *checkboxArea = new QScrollArea;
	checkboxArea->setWidget(checkboxFrame);
	checkboxArea->setWidgetResizable(true);
	
	checkAllButton = new QPushButton(tr("&Check all"));
	connect(checkAllButton, SIGNAL(clicked()), this, SLOT(actCheckAll()));
	uncheckAllButton = new QPushButton(tr("&Uncheck all"));
	connect(uncheckAllButton, SIGNAL(clicked()), this, SLOT(actUncheckAll()));
	
	QHBoxLayout *checkAllButtonLayout = new QHBoxLayout;
	checkAllButtonLayout->addWidget(checkAllButton);
	checkAllButtonLayout->addWidget(uncheckAllButton);
	
	startButton = new QPushButton(tr("&Start download"));
	connect(startButton, SIGNAL(clicked()), this, SLOT(actStart()));
	
	QVBoxLayout *settingsLayout = new QVBoxLayout;
	settingsLayout->addWidget(checkboxArea);
	settingsLayout->addLayout(checkAllButtonLayout);
	settingsLayout->addWidget(startButton);
	
	totalLabel = new QLabel(tr("Total progress:"));
	totalProgressBar = new QProgressBar;
	nextSetLabel1 = new QLabel(tr("Current file:"));
	nextSetLabel2 = new QLabel;
	fileLabel = new QLabel(tr("Progress:"));
	fileProgressBar = new QProgressBar;
	
	messageLog = new QTextEdit;
	messageLog->setReadOnly(true);
	
	QGridLayout *grid = new QGridLayout;
	grid->addWidget(totalLabel, 0, 0);
	grid->addWidget(totalProgressBar, 0, 1);
	grid->addWidget(nextSetLabel1, 1, 0);
	grid->addWidget(nextSetLabel2, 1, 1);
	grid->addWidget(fileLabel, 2, 0);
	grid->addWidget(fileProgressBar, 2, 1);
	grid->addWidget(messageLog, 3, 0, 1, 2);
	
	QHBoxLayout *mainLayout = new QHBoxLayout;
	mainLayout->addLayout(settingsLayout, 6);
	mainLayout->addSpacing(10);
	mainLayout->addLayout(grid, 10);
	
	QWidget *centralWidget = new QWidget;
	centralWidget->setLayout(mainLayout);
	setCentralWidget(centralWidget);
	
	connect(importer, SIGNAL(setIndexChanged(int, int, const QString &)), this, SLOT(updateTotalProgress(int, int, const QString &)));
	connect(importer, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateFileProgress(int, int)));
	
	aLoadSetsFile = new QAction(tr("Load sets information from &file..."), this);
	connect(aLoadSetsFile, SIGNAL(triggered()), this, SLOT(actLoadSetsFile()));
	aDownloadSetsFile = new QAction(tr("&Download sets information..."), this);
	connect(aDownloadSetsFile, SIGNAL(triggered()), this, SLOT(actDownloadSetsFile()));
	aExit = new QAction(tr("E&xit"), this);
	connect(aExit, SIGNAL(triggered()), this, SLOT(close()));
	
	fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addAction(aLoadSetsFile);
	fileMenu->addAction(aDownloadSetsFile);
	fileMenu->addSeparator();
	fileMenu->addAction(aExit);
	
	setWindowTitle(tr("Oracle importer"));
	setMinimumSize(750, 500);

	QStringList args = qApp->arguments();
	if (args.contains("-dlsets"))
		downloadSetsFile(defaultSetsUrl);
	
	statusLabel = new QLabel;
	statusBar()->addWidget(statusLabel);
	statusLabel->setText(tr("Sets data not loaded."));
}