Example #1
0
void PermissionWidget::addPermission(void)
{
	Permission *perm=nullptr;

	try
	{
		perm=new Permission(this->object);
		configurePermission(perm);
		model->addPermission(perm);
		listPermissions();
		cancelOperation();
		perms_changed=true;
    updateCodePreview();
	}
	catch(Exception &e)
	{
		if(perm)
		{
			model->removePermission(perm);
			delete(perm);
		}

		cancelOperation();
		throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Example #2
0
void PermissionWidget::updatePermission(void)
{
	Permission *perm=nullptr,*perm_bkp=nullptr;
	int perm_idx=-1;

	try
	{
		perm=new Permission(this->object);

		/* Creates a backup permission. This will receive the current values of the
		editing permission, in case of errors these values can be restored */
		perm_bkp=new Permission(this->object);
		(*perm_bkp)=(*permission);

		configurePermission(perm);

		//Checking if the permission already exists on model
		perm_idx=model->getPermissionIndex(perm);

		if(perm_idx < 0 || (perm_idx >=0 && model->getObject(perm_idx,OBJ_PERMISSION)==permission))
		{
			(*permission)=(*perm);
			listPermissions();
			cancelOperation();
		}
		else
		{
			//Raises an error if the configured permission already exists
			throw Exception(Exception::getErrorMessage(ERR_ASG_DUPLIC_PERMISSION)
                      .arg(/*Utf8String::create(*/permission->getObject()->getName())
											.arg(permission->getObject()->getTypeName()),
											ERR_ASG_DUPLIC_PERMISSION,__PRETTY_FUNCTION__,__FILE__,__LINE__);
		}

		delete(perm_bkp);
		perms_changed=true;
    updateCodePreview();
	}
	catch(Exception &e)
	{
		(*permission)=(*perm_bkp);

		delete(perm);
		delete(perm_bkp);

		cancelOperation();
		throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
	}
}
Example #3
0
void PermissionWidget::removePermissions(void)
{
	model->removePermissions(object);
	cancelOperation();
	perms_changed=true;
  updateCodePreview();
}
void ImageProcessSystem::connnecting()
{
	connect(ui.actionOpen,SIGNAL(triggered()),this,SLOT(openFile()));
	connect(ui.faceDetectingColorModelAction,SIGNAL(triggered()),this,SLOT(faceDetectingUsingColorModel()));
	connect(ui.faceDetectingCombineAction,SIGNAL(triggered()),this,SLOT(faceDetectingCombined()));
	connect(ui.actionColorCorrection,SIGNAL(triggered()),this,SLOT(automaticColorCorrection()));
	connect(ui.actionFace,SIGNAL(triggered()),this,SLOT(automaticFaceDetecting()));
	connect(ui.actionHighLightDetection,SIGNAL(triggered()),this,SLOT(automaticHighlightDetecting()));
	connect(ui.setColorParametersAction,SIGNAL(triggered()),this,SLOT(displayColorParametersDialog()));
	connect(paraDialog.getOKAction(),SIGNAL(clicked()),this,SLOT(setColorParameters()));
	connect(ui.actionHighlightRemoval,SIGNAL(triggered()),this,SLOT(automaticHighlightRemoval()));
	connect(ui.listWidget,SIGNAL(itemClicked(QListWidgetItem *)),this,SLOT(listWidgetClicked(QListWidgetItem *)));
	connect(ui.actionSave,SIGNAL(triggered()),this,SLOT(saveFile()));
	connect(ui.actionCancel,SIGNAL(triggered()),this,SLOT(cancelOperation()));
	connect(ui.faceMeansStatisticsAction,SIGNAL(triggered()),this,SLOT(faceMeansStatistics()));
	connect(ui.sharpenAction,SIGNAL(triggered()),this,SLOT(sharpEffect()));
	connect(ui.highlightBatchAction,SIGNAL(triggered()),this,SLOT(batchHighlightRemoval()));
	connect(ui.actionInteractiveLocalEnhencement,SIGNAL(triggered()),this,SLOT(interactiveLacalEnhencementActionTriggered()));
	connect(ui.actionInteractiveColorCorrection,SIGNAL(triggered()),this,SLOT(interactiveColorCorrectionActionTriggered()));
	connect(ui.actionSwitch,SIGNAL(triggered()),this,SLOT(interactiveSwitchActionTriggered()));
	connect(ui.actionInteractiveHighlight,SIGNAL(triggered()),this,SLOT(intercativeHighlightActionTriggered()));
	connect(ui.actionInteractiveFace,SIGNAL(triggered()),this,SLOT(interactiveFaceActionTriggered()));
	connect(ui.actionInteractiveColorLevel,SIGNAL(triggered()),this,SLOT(interactiveColorLevelTriggered()));
	connect(ui.actionInteractiveColorBalance,SIGNAL(triggered()),this,SLOT(interacitveColorBalanceTriggered()));
	connect(ui.actionSuperPixel,SIGNAL(triggered()),this,SLOT(superPixelActionTriggered()));
	connect(ui.actionInteractiveTriangle,SIGNAL(triggered()),this,SLOT(interactiveTriangleActionTriggered()));
	connect(ui.actionTriangle,SIGNAL(triggered()),this,SLOT(triangle()));
	connect(ui.actionMeshEditing,SIGNAL(triggered()),this,SLOT(interactiveMeshEditingActionTriggered()));
}
Example #5
0
 void ConstraintDeleteInput::keyPress ( QKeyEvent* ke )
 {
   if ( ke->key() == Qt::Key_Escape )
     cancelOperation();
   else
     ke->ignore();
 }
void UIProgressDialog::closeEvent(QCloseEvent *pEvent)
{
    if (m_fCancelEnabled)
        cancelOperation();
    else
        pEvent->ignore();
}
Example #7
0
void PermissionWidget::removePermission(int)
{ 
	model->removePermission(permission);
	cancelOperation();
	permission=nullptr;
	permissions_tab->clearSelection();
	perms_changed=true;
  updateCodePreview();
}
Example #8
0
void MainWindow::LoadFile()
{

    if (FileFormatPluginList.size()) {


        QString FileName = QFileDialog::getOpenFileName(this, tr("Open File"),
                                                     "",
                                                     FileFormatPluginList[0]->getFormatDescription());

        //test();
        // Create a progress dialog.
            QProgressDialog dialog;

            dialog.setLabelText(QString("Загрузка данных из файла"));

            // Create a QFutureWatcher and connect signals and slots.
            QFutureWatcher<void> futureWatcher;
            QTimer timer;
            connect(&timer, SIGNAL(timeout()), this, SLOT(updateProgress()));
            timer.start(1000);
            QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset()));
            QObject::connect(&dialog, SIGNAL(canceled()), SLOT(cancelOperation()));
            QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel()));
            QObject::connect(this, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int)));

            //extern void FileFormatPluginList[0]->getDataFromChannel(channel,(qint8*)data);


            QFuture<void> future = QtConcurrent::run(FileFormatPluginList[0], &FileReadInterface::LoadFile, FileName);

            // Start the computation.
            futureWatcher.setFuture(future);

            // Display the dialog and start the event loop.
            dialog.exec();

            futureWatcher.waitForFinished();
            dialog.setValue(100);
            dialog.hide();


            timer.stop();



        cube= FileFormatPluginList[0]->getCube();


        QList<double> list = cube->GetListOfChannels();




        foreach(double l , list) {
            ui->ChannelListWidget->addItem(QString("%1").arg(l));
        }
Example #9
0
void PermissionWidget::hideEvent(QHideEvent *event)
{
	disconnect(object_selection_wgt,0,this,0);
	cancelOperation();

	permissions_tab->blockSignals(true);
	permissions_tab->removeRows();
	permissions_tab->blockSignals(false);

	if(perms_changed)
		emit s_objectManipulated();

	BaseObjectWidget::hideEvent(event);
}
void Task_MigrateCtTarget::clientDisconnected(IOSender::Handle h)
{
	// #439777 to protect call handler for destroying object
	WaiterTillHandlerUsingObject::AutoUnlock lock( m_waiter );
	if( !lock.isLocked() )
		return;

	if (h != m_hConnHandle)
		return;

	WRITE_TRACE(DBG_FATAL, "%s", __FUNCTION__);
	SmartPtr<CDspClient> nullClient;
	cancelOperation(nullClient, getRequestPackage());
}
Example #11
0
void ForumSession::listGroupsReply(QNetworkReply *reply) {
    if(operationInProgress == FSONoOp) return;
    Q_ASSERT(operationInProgress==FSOListGroups);
    Q_ASSERT(reply->request().attribute(QNetworkRequest::User).toInt() ==FSOListGroups);

    qDebug() << Q_FUNC_INFO;

    QString data = convertCharset(reply->readAll());
    if (reply->error() != QNetworkReply::NoError) {
        emit(networkFailure(reply->errorString()));
        cancelOperation();
        return;
    }
    performListGroups(data);
}
Example #12
0
  void ConstraintDeleteInput::startDisplay ( QMenu* context_menu )
  {
    target_ = 0;

    xml_rep_ = new QDomDocument;

    context_menu_ = context_menu;

    QAction* cancel_action = parent_->lCMW()->getUi()->cancelConstraintDeleteAction;

    separator_id_ = context_menu_->addSeparator();
    context_menu_->addAction( cancel_action );
    connect( cancel_action, SIGNAL( activated() ), SLOT( cancelOperation() )  );

    parent_->view()->
      setCursor( CursorFactory::instance().cursor( CursorFactory::DELETE_CONSTRAINT ) );
  }
// The GTK keypress callback
bool RadiantWindowObserver::onKeyPress(GdkEventKey* ev)
{
	if (!_listenForCancelEvents)
	{
		// Not listening, let the event pass through
		return false;
	}

	// Check for ESC and call the cancelOperation method, if found
	if (ev->keyval == GDK_Escape)
	{
		cancelOperation();

		// Don't pass the key event to the event chain
		return true;
	}

	return false;
}
UIProgressDialog::UIProgressDialog(CProgress &progress,
                                   const QString &strTitle,
                                   QPixmap *pImage /* = 0 */,
                                   bool fSheetOnDarwin /* = false */,
                                   int cMinDuration /* = 2000 */,
                                   QWidget *pParent /* = 0 */)
  : QIDialog(pParent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint)
  , m_progress(progress)
  , m_pImageLbl(0)
  , m_pCancelBtn(0)
  , m_fCancelEnabled(false)
  , m_cOperations(m_progress.GetOperationCount())
  , m_iCurrentOperation(m_progress.GetOperation() + 1)
  , m_fEnded(false)
{
    setModal(true);

    QHBoxLayout *pLayout0 = new QHBoxLayout(this);

#ifdef Q_WS_MAC
    /* No sheets in another mode than normal for now. Firstly it looks ugly and
     * secondly in some cases it is broken. */
    if (   fSheetOnDarwin
        && vboxGlobal().isSheetWindowsAllowed(pParent))
        setWindowFlags(Qt::Sheet);
    ::darwinSetHidesAllTitleButtons(this);
    ::darwinSetShowsResizeIndicator(this, false);
    if (pImage)
        pLayout0->setContentsMargins(30, 15, 30, 15);
    else
        pLayout0->setContentsMargins(6, 6, 6, 6);
#else
    NOREF(fSheetOnDarwin);
#endif /* Q_WS_MAC */

    if (pImage)
    {
        m_pImageLbl = new QILabel(this);
        m_pImageLbl->setPixmap(*pImage);
        pLayout0->addWidget(m_pImageLbl);
    }

    QVBoxLayout *pLayout1 = new QVBoxLayout();
    pLayout1->setMargin(0);
    pLayout0->addLayout(pLayout1);
    pLayout1->addStretch(1);
    m_pDescriptionLbl = new QILabel(this);
    pLayout1->addWidget(m_pDescriptionLbl, 0, Qt::AlignHCenter);

    QHBoxLayout *pLayout2 = new QHBoxLayout();
    pLayout2->setMargin(0);
    pLayout1->addLayout(pLayout2);

    m_progressBar = new QProgressBar(this);
    pLayout2->addWidget(m_progressBar, 0, Qt::AlignVCenter);

    if (m_cOperations > 1)
        m_pDescriptionLbl->setText(QString(m_spcszOpDescTpl)
                                   .arg(m_progress.GetOperationDescription())
                                   .arg(m_iCurrentOperation).arg(m_cOperations));
    else
        m_pDescriptionLbl->setText(QString("%1 ...")
                                   .arg(m_progress.GetOperationDescription()));
    m_progressBar->setMaximum(100);
    setWindowTitle(QString("%1: %2").arg(strTitle, m_progress.GetDescription()));
    m_progressBar->setValue(0);
    m_fCancelEnabled = m_progress.GetCancelable();
    if (m_fCancelEnabled)
    {
        m_pCancelBtn = new UIMiniCancelButton(this);
        m_pCancelBtn->setFocusPolicy(Qt::ClickFocus);
        pLayout2->addWidget(m_pCancelBtn, 0, Qt::AlignVCenter);
        connect(m_pCancelBtn, SIGNAL(clicked()), this, SLOT(cancelOperation()));
    }

    m_pEtaLbl = new QILabel(this);
    pLayout1->addWidget(m_pEtaLbl, 0, Qt::AlignLeft | Qt::AlignVCenter);

    pLayout1->addStretch(1);

    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    retranslateUi();

    /* The progress dialog will be shown automatically after
     * the duration is over if progress is not finished yet. */
    QTimer::singleShot(cMinDuration, this, SLOT(showDialog()));
}
void UIProgressDialog::reject()
{
    if (m_fCancelEnabled)
        cancelOperation();
}