// Constructor
TextNotificationWidget::TextNotificationWidget(QWidget *parent):
    #ifdef Q_OS_SYMBIAN
    QDialog(parent),
    #else
    QWidget(parent),
    #endif // Q_OS_SYMBIAN
    _ui(new Ui::TextNotificationWidget),
    _editor(new EditorDialog(this))
  #ifdef Q_OS_SYMBIAN
  , _emptyAction(new QAction("", this)),
    _goBackAction(new QAction(tr("Go back"), this))
  #endif // Q_OS_SYMBIAN
{
    _ui->setupUi(this);

    connect(_ui->enable, SIGNAL(toggled(bool)), this, SLOT(ActivationChange(bool)));
    connect(_ui->singleNotificationMode, SIGNAL(toggled(bool)), this, SLOT(ModeChange()));
    connect(_ui->textNotification, SIGNAL(textEdited(QString)), this, SLOT(TextMessageChange(QString)));
    connect(_ui->showEditor, SIGNAL(clicked()), this, SLOT(ShowEditor()));
    connect(_editor, SIGNAL(accepted()), this, SLOT(MessageListChange()));
#ifdef Q_OS_SYMBIAN
    addAction(_emptyAction);
    addAction(_goBackAction);
    _emptyAction->setSoftKeyRole(QAction::PositiveSoftKey);
    _goBackAction->setSoftKeyRole(QAction::NegativeSoftKey);
    connect(_goBackAction, SIGNAL(triggered()), this, SLOT(hide()));
#endif // Q_OS_SYMBIAN

    _editor->setModal(true);
    _defaultMessageList.clear();
    _defaultMessageList.append(tr("Are you dreaming?"));
    _defaultMessageList.append(tr("How did you get here?"));
    _defaultMessageList.append(tr("So... what's the time?"));
    _defaultMessageList.append(tr("Isn't there anything strange?"));
    _defaultMessageList.append(tr("Reality check time!"));
    _defaultMessageList.append(tr("I'm afraid we're in dream."));
    _defaultMessageList.append(tr("Can you fly?"));
}
Exemple #2
0
void PatternMenuButton::MouseDown (BPoint point)
{
//	BMenuItem *selected;
//	point = BPoint (0, 0);
//	ConvertToScreen (&point);
//	BRect openRect = BRect (point.x - OPEN_RAD, point.y - OPEN_RAD,
//		point.x + OPEN_RAD, point.y + OPEN_RAD);
//	menu->Show();
//	if ((selected = menu->Track (true, &openRect)) != NULL)
//	{
//		index = menu->IndexOf (selected);
//		menu->Mark (index);
//		menu->InvalidateWindow();
//	}
//	menu->Hide();
//	Invalidate();
	Window()->Lock();
	uint32 buttons = Window()->CurrentMessage()->FindInt32 ("buttons");
//	uint32 clicks = Window()->CurrentMessage()->FindInt32 ("clicks");
	BMenuItem *mselected;
	point = BPoint (0, 0);
	ConvertToScreen (&point);
	if (click != 2 && buttons & B_PRIMARY_MOUSE_BUTTON && !(modifiers() & B_CONTROL_KEY))
	{
		BPoint bp, pbp;
		uint32 bt;
		GetMouse (&pbp, &bt, true);
		bigtime_t start = system_time();
		while (system_time() - start < dcspeed)
		{
			snooze (20000);
			GetMouse (&bp, &bt, true);
			if (!bt && click != 2)
			{
				click = 0;
			}
			if (bt && !click)
			{
				click = 2;
			}
			if (bp != pbp)
				break;
		}
		if (click != 2)
		{
			BRect openRect = BRect (point.x - OPEN_RAD, point.y - OPEN_RAD,
				point.x + OPEN_RAD, point.y + OPEN_RAD);
			menu->Show();
			if ((mselected = menu->Track (true, &openRect)) != NULL)
			{
				index = menu->IndexOf (mselected);
				menu->Mark (index);
				if (MenuWinOnScreen)
					menu->InvalidateWindow();
			}
			menu->Hide();
			if (editorshowing)
			{
//				rgb_color c = color();
//				BMessage *msg = new BMessage ('SetC');
//				msg->AddInt32 ("color", c.red);
//				msg->AddInt32 ("color", c.green);
//				msg->AddInt32 ("color", c.blue);
//				editor->PostMessage (msg);
//				delete msg;
			}
			click = 1;
		}
	}
	if (click == 2 || buttons & B_SECONDARY_MOUSE_BUTTON || modifiers() & B_CONTROL_KEY)
	{
		click = 1;
		if (editorshowing)
		{
//			rgb_color c = color();
//			BMessage *msg = new BMessage ('SetC');
//			msg->AddInt32 ("color", c.red);
//			msg->AddInt32 ("color", c.green);
//			msg->AddInt32 ("color", c.blue);
//			editor->PostMessage (msg);
//			delete msg;
		}
		else
		{
			ShowEditor();
		}
	}
	Invalidate();
	Window()->Unlock();
}
Exemple #3
0
void VSTPlugin::Visible(bool vis,bool upd)
{	
    visible = vis;
	if(upd && Is() && IsEdited()) ShowEditor(this,vis);
}