Exemple #1
0
void
Gui::warningDialog(const std::string & title,
                   const std::string & text,
                   bool useHtml)
{
    ///don't show dialogs when about to close, otherwise we could enter in a deadlock situation
    {
        QMutexLocker l(&_imp->aboutToCloseMutex);
        if (_imp->_aboutToClose) {
            return;
        }
    }

    StandardButtons buttons(eStandardButtonYes | eStandardButtonNo);

    if ( QThread::currentThread() != QCoreApplication::instance()->thread() ) {
        QMutexLocker locker(&_imp->_uiUsingMainThreadMutex);
        while (_imp->_uiUsingMainThread) {
            _imp->_uiUsingMainThreadCond.wait(&_imp->_uiUsingMainThreadMutex);
        }
        ++_imp->_uiUsingMainThread;
        locker.unlock();
        Q_EMIT doDialog(1, QString::fromUtf8( title.c_str() ), QString::fromUtf8( text.c_str() ), useHtml, buttons, (int)eStandardButtonYes);
        locker.relock();
        while (_imp->_uiUsingMainThread) {
            _imp->_uiUsingMainThreadCond.wait(&_imp->_uiUsingMainThreadMutex);
        }
    } else {
        {
            QMutexLocker locker(&_imp->_uiUsingMainThreadMutex);
            ++_imp->_uiUsingMainThread;
        }
        Q_EMIT doDialog(1, QString::fromUtf8( title.c_str() ), QString::fromUtf8( text.c_str() ), useHtml, buttons, (int)eStandardButtonYes);
    }
}
Exemple #2
0
void ClsQHarborImpl::slotCellDoubleClicked(int row, int col, int /*button*/, const QPoint & /*mousePos*/) {
//    cout << "ClsQHarborImpl::slotCellDoubleClicked(int row, int col, int button, const QPoint & mousePos)" << endl;
    string _strID = qtableEntries->text(row, COL_ID);
//	cout << _strID << endl;
    int iItemType = -1;
    string strItemType = qtableEntries->text(row, COL_TYPE);
    if(!strItemType.compare("Group")) {
        iItemType = ClsFESystemManager::ITEM_GROUP;
    }
    else if(!strItemType.compare("Connection")) {
        iItemType = ClsFESystemManager::ITEM_CONNECTION;
    }

    if(col == COL_PARAM_LABEL) {
        doDialog(iItemType, _strID, row);
    } else if(col == COL_VALUE) {
        string strParamLabel = qtableEntries->text(row, COL_PARAM_LABEL);
        string strParamName = qtableEntries->text(row, COL_PARAM_NAME);
        double fMin = qtableEntries->text(row, COL_MIN).toDouble();
        double fMax = qtableEntries->text(row, COL_MAX).toDouble();
        double fValue = qtableEntries->text(row, COL_VALUE).toDouble();

        doValueDialog(iItemType, _strID, row, strParamName, strParamLabel, fMin, fMax, fValue);
    }
}
Exemple #3
0
bool pinDialog::doDialogInloop(pinOpInterface &operation,PinString &authPinCache) {
	for(;;) {
		byte retries = 0;
		try {
				PinString pin;
				if (authPinCache.empty()) {
					if (!doDialog())
						throw std::runtime_error("User cancelled");
					pin = getPin();
				} else
					pin = authPinCache;
				mutexObjLocker lock(operation.m_mutex);
				if (m_key == EstEidCard::AUTH)
					operation.m_card.validateAuthPin(pin,retries);
				else
					operation.m_card.validateSignPin(pin,retries);
				operation.call(operation.m_card,pin,m_key);
				authPinCache = pin;
				return true;
		} catch(AuthError &auth) {
			authPinCache.clear();
			if (auth.m_blocked) {
				showPrompt("Wrong pin entered, PIN is blocked");
				throw std::runtime_error("PIN is blocked");
				}
			std::stringstream buf;
			buf << "Wrong pin entered, " << (int)retries << " retries left";
			if (!showPrompt(buf.str(),true))
				throw std::runtime_error("User cancelled");
			}
		}
	}
Exemple #4
0
void ClsQHarborImpl::slotCellDoubleClicked(int row, int col){
#ifdef DEBUG_CLSQHARBORIMPL
    cout << "ClsQHarborImpl::slotCellDoubleClicked(int row, int col)" << endl;
#endif
    string _strID = getItemValue(row, COL_ID);
//    cout << _strID << endl;
    int iItemType = -1;
    string strItemType = getItemValue(row, COL_TYPE);
    if(!strItemType.compare("Group")){
	iItemType = ClsFESystemManager::ITEM_GROUP;
    } 
    else if(!strItemType.compare("Connection")){
	iItemType = ClsFESystemManager::ITEM_CONNECTION;
    }
    
    if(col == COL_PARAM_LABEL){
//	cout << "col == COL_PARAM_LABEL" << endl;
	doDialog(iItemType, _strID, row);
    } else if(col == COL_VALUE){
//	cout << "col == COL_VALUE" << endl;
	string strParamLabel = getItemValue(row, COL_PARAM_LABEL);
	string strParamName = getItemValue(row, COL_PARAM_NAME);
	double fMin = QString(getItemValue(row, COL_MIN).c_str()).toDouble();
	double fMax = QString(getItemValue(row, COL_MAX).c_str()).toDouble();
	double fValue = QString(getItemValue(row, COL_VALUE).c_str()).toDouble();

	doValueDialog(iItemType, _strID, row, strParamName, strParamLabel, fMin, fMax, fValue);
    } else {
//	cout << "other col" << endl;
    }
}
Exemple #5
0
//static
void LLDelayedGestureError::gestureMissing(const LLUUID &id)
{
	LLErrorEntry ent("GestureMissing", id);
	if ( ! doDialog(ent) )
	{
		enqueue(ent);
	}
}
/* main function */
static void
run (const gchar      *name,
     gint              n_params,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[2];
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
  GimpDrawable      *drawable;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  *nreturn_vals = 2;
  *return_vals  = values;

  if (run_mode == GIMP_RUN_NONINTERACTIVE)
    {
      if (n_params != 3)
        status = GIMP_PDB_CALLING_ERROR;
    }

  if (status == GIMP_PDB_SUCCESS)
    {
      drawable = gimp_drawable_get (param[2].data.d_drawable);
      imageID  = param[1].data.d_image;

      if (gimp_drawable_is_rgb (drawable->drawable_id) ||
          gimp_drawable_is_gray (drawable->drawable_id) ||
          gimp_drawable_is_indexed (drawable->drawable_id))
        {
          memset (hist_red, 0, sizeof (hist_red));
          memset (hist_green, 0, sizeof (hist_green));
          memset (hist_blue, 0, sizeof (hist_blue));

          gimp_tile_cache_ntiles (2 *
                                  (drawable->width / gimp_tile_width () + 1));

          analyze (drawable);

          /* show dialog after we analyzed image */
          if (run_mode != GIMP_RUN_NONINTERACTIVE)
            doDialog ();
        }
      else
        status = GIMP_PDB_EXECUTION_ERROR;

      gimp_drawable_detach (drawable);
    }

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;
  values[1].type          = GIMP_PDB_INT32;
  values[1].data.d_int32  = uniques;
}
Exemple #7
0
//static
void LLDelayedGestureError::gestureFailedToLoad(const LLUUID &id)
{
	LLErrorEntry ent("UnableToLoadGesture", id);

	if ( ! doDialog(ent) )
	{
		enqueue(ent);
	}
}
Exemple #8
0
int WEXPORT WDialog::process( WWindow *parent ) {
/***********************************************/

// Process a dialog and use the given parent window for the parent of the
// dialog.

    setParent( parent );
    doDialog( parent );
    setParent( NULL );
    return( _quitCode );
}
Exemple #9
0
int testpluginPlugin::msg(int msgId, void* wParam, void* lParam)
{
    bool handled = false;
    switch (msgId)
    {
    case MSG_INIT:
        init();
        handled = true;
        break;
    case MSG_GET_LABELS:
        getLabels((InputList*) wParam);
        handled = true;
        break;
    case MSG_GET_ID:
        getID((uint*) wParam);
        handled = true;
        break;
    case MSG_GET_NAME:
        getName((QString*) wParam);
        handled = true;
        break;
    case MSG_GET_RESULTS:
        getResults((InputList*) wParam, (QList<CatItem>*) lParam);
        handled = true;
        break;
    case MSG_GET_CATALOG:
        getCatalog((QList<CatItem>*) wParam);
        handled = true;
        break;
    case MSG_EXTEND_CATALOG:
        extendCatalog((SearchInfo*) wParam, (QList<CatItem>*)lParam);
        handled = true;
        break;
    case MSG_LAUNCH_ITEM:
        handled = launchItem((InputList*) wParam, (QList<CatItem>*) lParam);
        break;
    case MSG_HAS_DIALOG:
        handled = true;
        break;
    case MSG_DO_DIALOG:
        doDialog((QWidget*) wParam, (QWidget**) lParam);
        break;
    case MSG_END_DIALOG:
        endDialog((bool) wParam);
        break;
    case MSG_PATH:
        setPath((QString *) wParam);
    default:
        break;
    }

    return handled;
}
Exemple #10
0
int controlyPlugin::msg(int msgId, void* wParam, void* lParam)
{
	int handled = 0;
	switch (msgId)
	{		
		case MSG_INIT:
			init();
			handled = 1;
			break;
		case MSG_GET_ID:
			getID((uint*) wParam);
			handled = 1;
			break;
		case MSG_GET_NAME:
			getName((QString*) wParam);
			handled = 1;
			break;
		case MSG_GET_CATALOG:
			getCatalog((QList<CatItem>*) wParam);
			handled = 1;
			break;
		case MSG_GET_RESULTS:
			getResults((QList<InputData>*) wParam, (QList<CatItem>*) lParam);
			handled = 1;
			break;
		case MSG_LAUNCH_ITEM:
			handled = launchItem((QList<InputData>*) wParam, (CatItem*) lParam);
			break;

		case MSG_HAS_DIALOG:
			handled = true;
			break;
		case MSG_DO_DIALOG:
			doDialog((QWidget*) wParam, (QWidget**) lParam);
			break;
		case MSG_END_DIALOG:
			endDialog(wParam != 0);
			break;

		case MSG_PATH:
			setPath((QString *) wParam);
			break;

		default:
			break;
	}
		
	return handled;
}
Exemple #11
0
void ClsQHarborImpl::dropEvent(QDropEvent* event) {
#ifdef DEBUG_CLSQHARBORIMPL
    cout << "ClsQHarborImpl::dropEvent(QDropEvent* event)" << endl;
#endif
    mapParams.clear();
    QString text;
    if ( QTextDrag::decode(event, text) ) {
        if(event->provides("text/iqr-plot")) {
//	    cout << "drop text: " << text << endl;
            dropInfo di = ClsDragDropDeEncoder::decode(text.latin1());
            int iItemType = di.ItemType;
            string strItemID = di.ItemID;
            doDialog(iItemType, strItemID, -1);
        }
    }
};
Exemple #12
0
int VerbyPlugin::msg(int msgId, void* wParam, void* lParam)
{
	bool handled = false;
	switch (msgId)
	{		
	case MSG_INIT:
		init();
		handled = true;
		break;
	case MSG_GET_ID:
		getID((uint*) wParam);
		handled = true;
		break;
	case MSG_GET_NAME:
		getName((QString*) wParam);
		handled = true;
		break;
	case MSG_GET_LABELS:
		getLabels((QList<InputData>*) wParam);
		handled = true;
		break;
	case MSG_GET_RESULTS:
		getResults((QList<InputData>*) wParam, (QList<CatItem>*) lParam);
		handled = true;
		break;
	case MSG_LAUNCH_ITEM:
		launchItem((QList<InputData>*) wParam, (CatItem*) lParam);
		handled = true;
		break;
	case MSG_HAS_DIALOG:
		handled = true;
		break;
	case MSG_DO_DIALOG:
		doDialog((QWidget*) wParam, (QWidget**) lParam);
		break;
	case MSG_END_DIALOG:
		endDialog(wParam != 0);
		break;

	default:
		break;
	}

	return handled;
}
Exemple #13
0
//static 
void LLDelayedGestureError::onIdle(void *userdata)
{
	if ( ! sQueue.empty() )
	{
		LLErrorEntry ent = sQueue.front();
		sQueue.pop_front();

		if ( ! doDialog(ent, false ) )
		{
			enqueue(ent);
		}
	}
	else
	{
		// Nothing to do anymore
		gIdleCallbacks.deleteFunction(onIdle, NULL);
	}
}
Exemple #14
0
void ClsQHarborImpl::dropEvent(QDropEvent* event) {
#ifdef DEBUG_CLSQHARBORIMPL
    cout << "ClsQHarborImpl::dropEvent(QDropEvent* event)" << endl;
#endif
    mapParams.clear();
    QString qstrDropString;


    if(event->mimeData()->hasFormat ("text/iqr-plot" )){
	qstrDropString = event->mimeData()->data ("text/iqr-plot");
    } else {
	return;
    }

//    cout << "drop text: " << qstrDropString.toStdString() << endl;
    dropInfo di = ClsDragDropDeEncoder::decode(qstrDropString.toStdString());
    int iItemType = di.ItemType;
    string strItemID = di.ItemID;
//    cout << "iItemType: " << iItemType << endl;
//    cout << "strItemID: " << strItemID << endl;

    doDialog(iItemType, strItemID, -1);
};
Exemple #15
0
void NavDialog::Show()
{
	doDialog();

	HWND hwnd = ::GetFocus();

	// Free resources if needed
	m_view[0].reset();
	m_view[1].reset();

	HDC hDC = ::GetDC(_hSelf);

	m_view[0].init(hDC);
	m_view[1].init(hDC);

	// Release DC
	::ReleaseDC(_hSelf, hDC);

	CreateBitmap();

	display(true);

	::SetFocus(hwnd);
}
Exemple #16
0
int WEXPORT WDialog::process() {
/******************************/

    doDialog( parent() );
    return( _quitCode );
}