예제 #1
0
  virtual int setup() {
    QWidget *qw;
    uint32_t flags;
    GWEN_WIDGET *wParent;
    QLayout *qLayout;
    QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
    QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;

    flags=GWEN_Widget_GetFlags(_widget);
    wParent=GWEN_Widget_Tree_GetParent(_widget);

    qw=new QT4_DialogBox(dynamic_cast<QT4_GuiDialog*>(getDialog()), QApplication::activeModalWidget());
    qLayout=new QVBoxLayout(qw);

    /* handle flags */
    if (flags & GWEN_WIDGET_FLAGS_FILLX)
      hpolicy=QSizePolicy::Expanding;
    if (flags & GWEN_WIDGET_FLAGS_FILLY)
      vpolicy=QSizePolicy::Expanding;
    qw->setSizePolicy(hpolicy, vpolicy);


    GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw);
    GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_LAYOUT, (void*) qLayout);

    if (wParent)
      GWEN_Widget_AddChildGuiWidget(wParent, _widget);
    return 0;
  }
예제 #2
0
void ImportPrimersDialogFiller::addObjects(HI::GUITestOpStatus &os, const QMap<QString, QStringList> &databaseAndObjectNames) {
    GTUtilsDialog::waitForDialog(os, new ProjectTreeItemSelectorDialogFiller(os,
                                                                             databaseAndObjectNames,
                                                                             QSet<GObjectType>() << GObjectTypes::SEQUENCE,
                                                                             ProjectTreeItemSelectorDialogFiller::Separate));
    GTWidget::click(os, GTWidget::findWidget(os, "pbAddObject", getDialog(os)));
}
FileBrowserDialog *FileBrowserManager::openOrActivateDialog(const Account &account, const ServerRepo &repo, const QString &path)
{
    FileBrowserDialog *dialog = getDialog(account, repo.id);
    QString fixed_path = path;
    if (!fixed_path.startsWith("/")) {
        fixed_path = "/" + fixed_path;
    }
    if (!fixed_path.endsWith("/")) {
        fixed_path += "/";
    }
    if (dialog == NULL) {
        dialog = new FileBrowserDialog(account, repo, fixed_path);
        QRect screen = QApplication::desktop()->screenGeometry();
        dialog->setAttribute(Qt::WA_DeleteOnClose, true);
        dialog->show();
        dialog->move(screen.center() - dialog->rect().center());
        dialogs_.push_back(dialog);
        connect(dialog, SIGNAL(aboutToClose()), this, SLOT(onAboutToClose()));
    } else if (!path.isEmpty()) {
        dialog->enterPath(fixed_path);
    }
    dialog->raise();
    dialog->activateWindow();
    return dialog;
}
예제 #4
0
void MirandaTextField::configure()
{
	TextFieldState *field = (TextFieldState *) getDialog()->getDefaultState()->getField(getName());
	_ASSERT(field != NULL);

	font->registerFont(field->getFont());
}
예제 #5
0
void ImportPrimersDialogFiller::connectDatabase(HI::GUITestOpStatus &os, const QString &databaseName) {
    QList<SharedConnectionsDialogFiller::Action> actions;
    actions << SharedConnectionsDialogFiller::Action(SharedConnectionsDialogFiller::Action::CLICK, databaseName);
    actions << SharedConnectionsDialogFiller::Action(SharedConnectionsDialogFiller::Action::CONNECT);
    GTUtilsDialog::waitForDialog(os, new SharedConnectionsDialogFiller(os, actions));
    GTWidget::click(os, GTWidget::findWidget(os, "pbConnect", getDialog(os)));
    GTUtilsTaskTreeView::waitTaskFinished(os);
}
예제 #6
0
void DialogManager::sendTo(const ChaTIN::ConferenceId& conferenceId, const Glib::ustring& message) throw(Socket::SendFailureException)
{
    std::vector<dbo::ptr<DB::Schema::ConferenceMember> > members = conferenceManager.getList(conferenceId);
    for(auto& member : members)
    {
        const Dialog& dialog = getDialog(member->getIp());
        dialog.send(message);
    }
}
예제 #7
0
UserDialog *LocalUser::ensureDialog(const Telegram::Peer &peer)
{
    UserDialog *dialog = getDialog(peer);
    if (!dialog) {
        dialog = new UserDialog();
        dialog->peer = peer;
        m_dialogs.append(dialog);
    }
    return dialog;
}
예제 #8
0
void registerDialog(char *dialogName, int x1, int y1, int x2, int y2) {
    Dialog *dialog = getDialog(dialogName);

    dialog = registeredDialogs + currentRegDialog;
    dialog->name = dialogName;
    dialog->title = dialogName;
    setRect(&dialog->coords, x1, y1, x2, y2);
    currentRegDialog++;

    allocateDialogWidgets(dialog);
}
FileBrowserDialog *FileBrowserManager::openOrActivateDialog(const Account &account, const ServerRepo &repo)
{
    FileBrowserDialog *dialog = getDialog(account, repo.id);
    if (dialog == NULL) {
        dialog = new FileBrowserDialog(account, repo, seafApplet->mainWindow());
        QRect screen = QApplication::desktop()->screenGeometry();
        dialog->setAttribute(Qt::WA_DeleteOnClose, true);
        dialog->show();
        dialog->move(screen.center() - dialog->rect().center());
        dialogs_.push_back(dialog);
        connect(dialog, SIGNAL(aboutToClose()), this, SLOT(onAboutToClose()));
    }
    dialog->raise();
    dialog->activateWindow();
    return dialog;
}
예제 #10
0
  virtual int setup() {
    QTextEdit *qw;
    uint32_t flags;
    GWEN_WIDGET *wParent;
    QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
    QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
    const char *s;
    QString text;
    QT4_GuiDialog *qtDialog;

    flags=GWEN_Widget_GetFlags(_widget);
    wParent=GWEN_Widget_Tree_GetParent(_widget);
    s=GWEN_Widget_GetText(_widget, 0);
    if (s)
      text=QString::fromUtf8(s);

    qw=new QTextEdit(text);

    /* handle flags */
    if (flags & GWEN_WIDGET_FLAGS_FILLX)
      hpolicy=QSizePolicy::Expanding;
    if (flags & GWEN_WIDGET_FLAGS_FILLY)
      vpolicy=QSizePolicy::Expanding;
    qw->setSizePolicy(hpolicy, vpolicy);

    GWEN_Widget_SetImplData(_widget, QT4_DIALOG_WIDGET_REAL, (void*) qw);

    qtDialog=dynamic_cast<QT4_GuiDialog*>(getDialog());
    assert(qtDialog);

    qw->connect(qw, SIGNAL(returnPressed()),
                qtDialog->getMainWindow(),
                SLOT(slotActivated()));


    if (wParent)
      GWEN_Widget_AddChildGuiWidget(wParent, _widget);
    return 0;
  }
예제 #11
0
void NpcEventListener::event(const std::string &channel,
                             const Mana::Event &event)
{
    if (channel != "NPC")
        return;

    if (event.getName() == "Message")
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        dialog->addText(event.getString("text"));
    }
    else if (event.getName() == "Menu")
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        dialog->choiceRequest();

        int count = event.getInt("choiceCount");
        for (int i = 1; i <= count; i++)
            dialog->addChoice(event.getString("choice" + toString(i)));
    }
    else if (event.getName() == "IntegerInput")
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        int defaultValue = event.getInt("default", 0);
        int min = event.getInt("min", 0);
        int max = event.getInt("max", 2147483647);

        dialog->integerRequest(defaultValue, min, max);
    }
    else if (event.getName() == "StringInput")
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        try
        {
            dialog->textRequest(event.getString("default"));
        }
        catch (Mana::BadEvent)
        {
            dialog->textRequest("");
        }
    }
    else if (event.getName() == "Next")
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (!dialog)
        {
            int mNpcId = id;
            NpcEvent("doNext");
            event.trigger("NPC");
            return;
        }

        dialog->showNextButton();
    }
    else if (event.getName() == "Close")
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (!dialog)
        {
            int mNpcId = id;
            NpcEvent("doClose");
            event.trigger("NPC");
            return;
        }

        dialog->showCloseButton();
    }
    else if (event.getName() == "CloseAll")
    {
        NpcDialog::closeAll();
    }
    else if (event.getName() == "End")
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (dialog)
            dialog->close();
    }
    else if (event.getName() == "Post")
    {
        new NpcPostDialog(event.getInt("id"));
    }
}
예제 #12
0
Widget
PromptDialogManager::post( char *title,
			   char		*text,
			   void		*clientData,
			   DialogCallback ok,
			   DialogCallback cancel,
			    DialogCallback help )
{

    // Get a dialog widget from the cache
    
    Widget dialog = getDialog();
    
    // Make sure the dialog exists, and that it is an XmMessageBox
    // or subclass, since the callbacks assume this widget type
    
    assert ( dialog != NULL );
    assert ( XtIsSubclass ( dialog, xmSelectionBoxWidgetClass ) );
	
	// Convert the text string to a compound string and 
	// specify this to be the message displayed in the dialog.

    XmString titleStr = XmStringCreateLocalized (title);
    XmString xmstr = XmStringCreateLocalized ( text );
    XtVaSetValues ( dialog, 
		    XmNmessageString, xmstr,
		    XmNdialogTitle, titleStr,
		    NULL );
    XmStringFree ( xmstr );
    XmStringFree ( titleStr );
    
    // Create an object to carry the additional data needed
    // to cache the dialogs.
    
    DialogCallbackData *dcb = new DialogCallbackData( this, 
						     clientData,
						     ok, cancel, 
						     help );
    // Install callback function for each button 
    // support by Motif dialogs. If there is no help callback
    // unmanage the corresponding button instead, if possible.

    if ( ok )
      XtAddCallback ( dialog, 
		      XmNokCallback, 
		      &DialogManager::okCallback,
		      (XtPointer) dcb );
    else
      {
	Widget w = XmSelectionBoxGetChild ( dialog,
					  XmDIALOG_OK_BUTTON );
        XtUnmanageChild ( w );
      }


    if ( cancel )
      XtAddCallback ( dialog, 
		      XmNcancelCallback, 
		      &DialogManager::cancelCallback,
		      (XtPointer) dcb );
    else
      {
	Widget w = XmSelectionBoxGetChild ( dialog,
					  XmDIALOG_CANCEL_BUTTON );
        XtUnmanageChild ( w );
      }
    
    
    if ( help )	    
	XtAddCallback ( dialog, 
		       XmNhelpCallback, 
		       &DialogManager::helpCallback,
		       (XtPointer) dcb );
    else
    {
	Widget w = XmSelectionBoxGetChild ( dialog,
					 XmDIALOG_HELP_BUTTON );
        XtUnmanageChild ( w );
    }
    
    // Post the dialog.
    
    XtManageChild ( dialog );

    
    return dialog;
}
예제 #13
0
void DialogManager::sendTo(const ChaTIN::Alias& alias, const Glib::ustring& message) throw(Socket::SendFailureException)
{
    const ChaTIN::IPv6 ip = aliasManager.getIP(alias); // resolve ip from alias
    const Dialog& dialog = getDialog(ip); // get dialog for ip
    dialog.send(message);
}
예제 #14
0
void LocalUser::bumpDialogUnreadCount(const Peer &peer)
{
    getDialog(peer)->unreadCount += 1;
    m_box.setUnreadCount(m_box.unreadCount() + 1);
}
예제 #15
0
void ImportPrimersDialogFiller::setImportTarget(HI::GUITestOpStatus &os, ImportSource importSource) {
    switch (importSource) {
    case LocalFiles:
        GTComboBox::setIndexWithText(os, GTWidget::findExactWidget<QComboBox *>(os, "cbSource", getDialog(os)), "Local file(s)");
        break;
    case SharedDb:
        GTComboBox::setIndexWithText(os, GTWidget::findExactWidget<QComboBox *>(os, "cbSource", getDialog(os)), "Shared database");
        break;
    default:
        os.setError("Unexpected import source");
    }
}
예제 #16
0
ContentDialog* ContentDialog::getFriendDialog(int friendId)
{
    return getDialog(friendId, friendList);
}
예제 #17
0
MachineStatus MTSMSMachine::machineRunState1(int state,const L3Frame*frame,const L3Message*l3msg, const SIP::DialogMessage*sipmsg)
{
		// Step 1	Network->MS	CP-DATA containing RP-DATA with message
		// Step 2	MS->Network	CP-ACK
			// 4.11 6.2.2 State wait-to-send-RP-ACK, timer TR2M
		// Step 3	MS->Network	CP-DATA containing RP-ACK or RP-Error
		// Step 4	Network->MS	CP-ACK
		//			Network->SIP response.

	PROCLOG2(DEBUG,state)<<LOGVAR(l3msg)<<LOGVAR(sipmsg)<<LOGVAR2("imsi",tran()->subscriber());
	switch(state) {
		case stateStart: {
			// There is no dialog for a SMS initiated on this BTS.
			if (getDialog() && getDialog()->isFinished()) {
				// SIP side closed already.
				// We can no longer inform the SIP side whether we succeed or not.
				// Should we continue and deliver the message to the MS or not?
				return MachineStatus::QuitTran(TermCause::Local(L3Cause::SMS_Timeout));	// could be a sip internal error?
			}
			timerStart(TR2M,TR2Mms,TimerAbortTran);

			// Allocate Transaction Identifier
			unsigned l3ti = channel()->chanGetContext(true)->mmGetNextTI();
			tran()->setL3TI(l3ti);
			setGSMState(CCState::SMSDelivering);

			this->mRpduRef = random() % 255;

			gReports.incr("OpenBTS.GSM.SMS.MTSMS.Start");

			// pat 6-2014.  We just send the ESTABLISH_REQUEST no matter what now.
			// The LAPDm will respond with ESTABLISH_INDICATION immediately if 
			SAPI_t sap = getSmsSap();
			//L3LogicalChannel *smschan = getSmsChannel();
			//if (smschan->multiframeMode(3)) { goto step1; }		// If already established.
			// if (channel()->multiframeMode(sap)) { goto step1; }		// If already established.

			// Start ABM in SAP3.
			//smschan->l3sendp(GSM::L3_ESTABLISH_REQUEST,SAPI3);
			channel()->l3sendp(GSM::L3_ESTABLISH_REQUEST,sap);
			// Wait for SAP3 ABM to connect.
			// The next read on SAP3 should be the ESTABLISH primitive.
			// This won't return NULL.  It will throw an exception if it fails.
			// (pat) WARNING: Previous code waited for a return ESTABLISH,
			// but I think the l3sendp(ESTABLISH) will hang until this happens so it is now a no-op.
			// delete getFrameSMS(LCH,GSM::ESTABLISH);
			LOG(DEBUG) << "case start returning, after sending ESTABLISH";
			return MachineStatusOK;	// Wait for the ESTABLISH on the uplink.
		}

		// We use ESTABLISH_INDICATION instead of ESTABLISH_CONFIRM to indicate establishment.
		// We would have to accept both ESTABLISH_CONFIRM and ESTABLISH_INDICATION here anyway in case
		// SABM was started by us and handset simultaneously, so we just dont bother with making ESTABLISH_CONFIRM separate.
		case L3CASE_PRIMITIVE(L3_ESTABLISH_INDICATION):
		case L3CASE_PRIMITIVE(L3_ESTABLISH_CONFIRM): {
			// Step 1
			// Send the first message.
			// CP-DATA, containing RP-DATA.

			RPData rp_data;
			int l3ti = getL3TI();
			if (! createRPData(rp_data)) { // NULL can be returned
				l3sendSms(CPData(l3ti,RPError(95,this->mRpduRef)));
				// TODO: Is this correct? 
				// TODO: Make sure MachineStatusQuitTran sends a failure code to SIP.
				if (getDialog()) getDialog()->MTSMSReply(400, "Bad Request");
				return MachineStatus::QuitTran(TermCause::Local(L3Cause::SMS_Error));
			}

			CPData deliver(l3ti,rp_data);
			PROCLOG(INFO) << "sending " << deliver;
	// WORKING: MS Does not respond to this message.
	// (pat) FIXME: The MS may send a DELIVER_REPORT which is discarded by parseTPDU.
			l3sendSms(deliver);
			LOG(DEBUG) << "case ESTABLISH returning, after receiving ESTABLISH";
			return MachineStatusOK; // Wait for CP-ACK message.
		}

		// Step 2
		// Get the CP-ACK.
		case L3CASE_SMS(ACK): {
			// FIXME -- Check reference and check for RPError.
			return MachineStatusOK;	// Now we are waiting for CP-DATA.
		}

		// Step 3
		// Get CP-DATA containing RP-ACK and message reference.
		case L3CASE_SMS(DATA): {
			timerStop(TR2M);
			PROCLOG(DEBUG) << "MTSMS: data from MS " << *l3msg;
			// FIXME -- Check L3 TI.

			// Parse to check for RP-ACK.
			// We already called parsel3 on the message.
			//CPData data;
			//try {
			//	data.parse(*CM);
			//	LOG(DEBUG) << "CPData " << data;
			//}
			//catch (SMSReadError) {
			//	LOG(WARNING) << "SMS parsing failed (above L3)";
			//	// Cause 95, "semantically incorrect message".
			//	LCH->l2sendf(CPError(L3TI,95),3);
			//	throw UnexpectedMessage();
			//}
			//catch (GSM::L3ReadError) {
			//	LOG(WARNING) << "SMS parsing failed (in L3)";
			//	throw UnsupportedMessage();
			//}
			//delete CM;

			const CPData *cpdata = dynamic_cast<typeof(cpdata)>(l3msg);

			// FIXME -- Check SMS reference.

			bool success = true;
			if (cpdata->RPDU().MTI()!=RPMessage::Ack) {
				PROCLOG(WARNING) << "unexpected RPDU " << cpdata->RPDU();
				success = false;
			}

			gReports.incr("OpenBTS.GSM.SMS.MTSMS.Complete");

			// Step 4
			// Send CP-ACK to the MS.
			PROCLOG(INFO) << "MTSMS: sending CPAck";
			l3sendSms(CPAck(getL3TI()));

			// Ack in SIP domain.
			if (!getDialog()) {
				LOG(DEBUG) << "No dialog found for MTSMS; could be welcome message, CLI SMS, or Dialog pre-destroyed error";
			} else if (success) {
				getDialog()->MTSMSReply(200,"OK");
			} else {
				getDialog()->MTSMSReply(400, "Bad Request");
			}

			LOG(DEBUG) << "case DATA returning";
			return MachineStatus::QuitTran(TermCause::Local(L3Cause::SMS_Success));	// Finished.
		}
		default:
			return unexpectedState(state,l3msg);
	}
}
예제 #18
0
void ImportPrimersDialogFiller::addFile(HI::GUITestOpStatus &os, const QString &filePath) {
    GTUtilsDialog::waitForDialog(os, new GTFileDialogUtils(os, filePath));
    GTWidget::click(os, GTWidget::findWidget(os, "pbAddFile", getDialog(os)));
}
예제 #19
0
ContentDialog* ContentDialog::getGroupDialog(int groupId)
{
    return getDialog(groupId, groupList);
}
예제 #20
0
파일: npcdialog.cpp 프로젝트: B-Rich/mana
void NpcEventListener::event(Event::Channel channel,
                             const Event &event)
{
    if (channel != Event::NpcChannel)
        return;

    if (event.getType() == Event::Message)
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        dialog->addText(event.getString("text"));
    }
    else if (event.getType() == Event::Menu)
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        dialog->choiceRequest();

        int count = event.getInt("choiceCount");
        for (int i = 1; i <= count; i++)
            dialog->addChoice(event.getString("choice" + toString(i)));
        dialog->initChoiceSelection();
    }
    else if (event.getType() == Event::IntegerInput)
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        int defaultValue = event.getInt("default", 0);
        int min = event.getInt("min", 0);
        int max = event.getInt("max", 2147483647);

        dialog->integerRequest(defaultValue, min, max);
    }
    else if (event.getType() == Event::StringInput)
    {
        NpcDialog *dialog = getDialog(event.getInt("id"));

        try
        {
            dialog->textRequest(event.getString("default"));
        }
        catch (BadEvent)
        {
            dialog->textRequest("");
        }
    }
    else if (event.getType() == Event::Next)
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (!dialog)
        {
            int mNpcId = id;
            Net::getNpcHandler()->nextDialog(mNpcId);
            return;
        }

        dialog->showNextButton();
    }
    else if (event.getType() == Event::Close)
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (!dialog)
        {
            int mNpcId = id;
            Net::getNpcHandler()->closeDialog(mNpcId);
            return;
        }

        dialog->showCloseButton();
    }
    else if (event.getType() == Event::CloseAll)
    {
        NpcDialog::closeAll();
    }
    else if (event.getType() == Event::End)
    {
        int id = event.getInt("id");
        NpcDialog *dialog = getDialog(id, false);

        if (dialog)
            dialog->close();
    }
    else if (event.getType() == Event::Post)
    {
        new NpcPostDialog(event.getInt("id"));
    }
}