Example #1
0
JobWidget::JobWidget(QWidget *parent) :
    QWidget(parent),
    _ui(new Ui::JobWidget)
{
    _ui->setupUi(this);
    _ui->restoreListWidget->setAttribute(Qt::WA_MacShowFocusRect, false);

    connect(_ui->listArchivesButton, &QPushButton::clicked,
            [=](){
                _ui->stackedWidget->setCurrentWidget(_ui->jobRestorePage);
            });
    connect(_ui->restoreBackButton, &QPushButton::clicked,
            [=](){
                _ui->stackedWidget->setCurrentWidget(_ui->jobDetailPage);
            });
    connect(_ui->optionsBackButton, &QPushButton::clicked,
            [=](){
            if(_job->objectKey().isEmpty())
                _ui->stackedWidget->setCurrentWidget(_ui->jobNewPage);
            else
                _ui->stackedWidget->setCurrentWidget(_ui->jobDetailPage);
            });
    connect(_ui->optionsButton, &QPushButton::clicked,
            [=](){
                _ui->stackedWidget->setCurrentWidget(_ui->jobOptionsPage);
            });
    connect(_ui->jobNameLineEdit, &QLineEdit::textChanged,
            [=](){
                    emit enableSave(canSaveNew());
            });
    connect(_ui->newJobTreeWidget, &FilePicker::selectionChanged,
            [=](){
                    emit enableSave(canSaveNew());
            });
    connect(_ui->newJobOptionsButton, &QPushButton::clicked,
            [=](){
                _ui->stackedWidget->setCurrentWidget(_ui->jobOptionsPage);
            });

    connect(_ui->detailTreeWidget, SIGNAL(focusLost()), this, SLOT(save()));
    connect(_ui->preservePathsCheckBox, SIGNAL(toggled(bool)), this, SLOT(save()));
    connect(_ui->traverseMountCheckBox, SIGNAL(toggled(bool)), this, SLOT(save()));
    connect(_ui->followSymLinksCheckBox, SIGNAL(toggled(bool)), this, SLOT(save()));
    connect(_ui->skipFilesSpinBox, SIGNAL(valueChanged(int)), this, SLOT(save()));
    connect(_ui->cancelButton, SIGNAL(clicked()), this, SIGNAL(cancel()));
    connect(_ui->restoreLatestArchiveButton, SIGNAL(clicked()), this, SLOT(restoreLatestArchive()));
    connect(_ui->restoreListWidget, SIGNAL(inspectArchive(ArchivePtr)), this, SIGNAL(inspectJobArchive(ArchivePtr)));
    connect(_ui->restoreListWidget, SIGNAL(restoreArchive(ArchivePtr,ArchiveRestoreOptions)), this, SIGNAL(restoreJobArchive(ArchivePtr,ArchiveRestoreOptions)));
    connect(_ui->restoreListWidget, SIGNAL(deleteArchives(QList<ArchivePtr>)), this, SIGNAL(deleteJobArchives(QList<ArchivePtr>)));
}
bool Component::giveFocus(Component* const NewFocusedComponent, bool Temporary)
{
    if(this == NewFocusedComponent)
    {
        return true;
    }
    else
    {
        setFocused(false);
        FocusEventDetailsUnrecPtr Details(FocusEventDetails::create(this,getSystemTime(),Temporary, NewFocusedComponent));
        focusLost(Details);
        return true;
    }
}
KPrViewModeSlidesSorter::KPrViewModeSlidesSorter(KoPAView *view, KoPACanvasBase *canvas)
    : KoPAViewMode(view, canvas)
    , m_slidesSorterView(new KPrSlidesManagerView())
    , m_customSlideShowView(new KPrSlidesManagerView())
    , m_slidesSorterModel(new KPrSlidesSorterDocumentModel(this, view->parentWidget()))
    , m_centralWidget(new QWidget())
    , m_customSlideShowModel(new KPrCustomSlideShowsModel(static_cast<KPrDocument *>(view->kopaDocument()), view->parentWidget()))
    , m_iconSize(QSize(200, 200))
    , m_editCustomSlideShow(false)
{
    setName(i18n("Slides Sorter"));
    //Create customSlideShow GUI
    QWidget *m_customShowsToolBar = new QWidget();

    QHBoxLayout *toolBarLayout = new QHBoxLayout(m_customShowsToolBar);
    toolBarLayout->setMargin(0);
    QVBoxLayout *centralWidgetLayout = new QVBoxLayout(m_centralWidget);
    centralWidgetLayout->setMargin(0);
    centralWidgetLayout->setSpacing(0);

    QLabel *slideShowsLabel = new QLabel(i18n("Slide Show: "));
    m_customSlideShowsList = new QComboBox;
    m_customSlideShowsList->setEditable(false);
    m_customSlideShowsList->setInsertPolicy(QComboBox::NoInsert);
    m_customSlideShowsList->setMinimumContentsLength(30);
    slideShowsLabel->setBuddy(m_customSlideShowsList);

    m_buttonAddCustomSlideShow = new QToolButton();
    m_buttonAddCustomSlideShow->setIcon(koIcon("list-add"));
    m_buttonAddCustomSlideShow->setToolTip(i18n("Add a new custom slide show"));

    m_buttonDelCustomSlideShow = new QToolButton();
    m_buttonDelCustomSlideShow->setIcon(koIcon("list-remove"));
    m_buttonDelCustomSlideShow->setEnabled(false);
    m_buttonDelCustomSlideShow->setToolTip(i18n("Delete current custom slide show"));

    m_buttonAddSlideToCurrentShow = new QToolButton();
    m_buttonAddSlideToCurrentShow->setIcon(koIcon("arrow-down"));
    m_buttonAddSlideToCurrentShow->setToolTip(i18n("Add slides to current custom slide show"));
    m_buttonAddSlideToCurrentShow->setEnabled(false);

    m_buttonDelSlideFromCurrentShow = new QToolButton();
    m_buttonDelSlideFromCurrentShow->setIcon(koIcon("arrow-up"));
    m_buttonDelSlideFromCurrentShow->setToolTip(i18n("Remove slides from current custom slide show"));
    m_buttonDelSlideFromCurrentShow->setEnabled(false);

    QSplitter *viewsSplitter = new QSplitter(Qt::Vertical);

    //hide Custom Shows View
    m_customSlideShowView->setMaximumHeight(0);

    //Layout Widgets
    toolBarLayout->addWidget(slideShowsLabel);
    toolBarLayout->addWidget(m_customSlideShowsList);
    toolBarLayout->addWidget(m_buttonAddCustomSlideShow);
    toolBarLayout->addWidget(m_buttonDelCustomSlideShow);
    toolBarLayout->addStretch();
    toolBarLayout->addWidget(m_buttonAddSlideToCurrentShow);
    toolBarLayout->addWidget(m_buttonDelSlideFromCurrentShow);
    viewsSplitter->addWidget(m_slidesSorterView);
    viewsSplitter->addWidget(m_customSlideShowView);

    centralWidgetLayout->addWidget(viewsSplitter);
    centralWidgetLayout->addWidget(m_customShowsToolBar);

    //initialize widgets
    m_centralWidget->hide();
    m_slidesSorterView->setIconSize(m_iconSize);
    m_slidesSorterView->setAutoScroll(true);
    m_customSlideShowView->setIconSize(m_iconSize);
    m_customSlideShowView->setAutoScroll(true);

    //Populate ComboBox
    customShowChanged(0);
    updateCustomSlideShowsList();

    //Setup customSlideShows view
    m_customSlideShowView->setModel(m_customSlideShowModel);
    m_customSlideShowView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_customSlideShowView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_customSlideShowView->setDragDropMode(QAbstractItemView::InternalMove);
    m_customSlideShowView->setSpacing(10);

    //Setup slides sorter view
    m_slidesSorterModel->setDocument(m_view->kopaDocument());
    m_slidesSorterView->setModel(m_slidesSorterModel);
    m_slidesSorterView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_slidesSorterView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_slidesSorterView->setDragDropMode(QAbstractItemView::InternalMove);
    m_slidesSorterView->setSpacing(10);

    //setup signals
    connect(m_slidesSorterView, SIGNAL(requestContextMenu(QContextMenuEvent*)), this, SLOT(slidesSorterContextMenu(QContextMenuEvent*)));
    connect(m_customSlideShowView, SIGNAL(requestContextMenu(QContextMenuEvent*)), this, SLOT(customSlideShowsContextMenu(QContextMenuEvent*)));
    connect(m_slidesSorterView, SIGNAL(slideDblClick()), this, SLOT(activateNormalViewMode()));
    connect(m_buttonAddCustomSlideShow, SIGNAL(clicked()), this, SLOT(addCustomSlideShow()));
    connect(m_buttonDelCustomSlideShow, SIGNAL(clicked()), this, SLOT(removeCustomSlideShow()));
    connect(m_buttonAddSlideToCurrentShow, SIGNAL(clicked()), this, SLOT(addSlideToCustomShow()));
    connect(m_buttonDelSlideFromCurrentShow, SIGNAL(clicked()), this, SLOT(deleteSlidesFromCustomShow()));
    connect(m_customSlideShowModel, SIGNAL(customSlideShowsChanged()), this, SLOT(updateCustomSlideShowsList()));
    connect(m_customSlideShowModel, SIGNAL(selectPages(int,int)), this, SLOT(selectCustomShowPages(int,int)));

    //setup signals for manage edit actions
    connect(view->copyController(), SIGNAL(copyRequested()), this, SLOT(editCopy()));
    connect(view->cutController(), SIGNAL(copyRequested()), this, SLOT(editCut()));
    connect(view, SIGNAL(selectAllRequested()), m_slidesSorterView, SLOT(selectAll()));
    connect(view, SIGNAL(deselectAllRequested()), m_slidesSorterView, SLOT(clearSelection()));
    connect(m_slidesSorterView, SIGNAL(selectionCleared()), this, SLOT(disableEditActions()));
    connect(m_slidesSorterView, SIGNAL(itemSelected()), this, SLOT(enableEditActions()));
    connect(m_slidesSorterView, SIGNAL(focusLost()), SLOT(disableEditActions()));
    connect(m_slidesSorterView, SIGNAL(focusGot()), SLOT(manageAddRemoveSlidesButtons()));
    connect(m_slidesSorterView, SIGNAL(zoomIn()), m_view->zoomController()->zoomAction(), SLOT(zoomIn()));
    connect(m_slidesSorterView, SIGNAL(zoomOut()), m_view->zoomController()->zoomAction(), SLOT(zoomOut()));
    connect(m_customSlideShowView, SIGNAL(focusGot()), SLOT(disableEditActions()));
    connect(m_customSlideShowView, SIGNAL(focusGot()), SLOT(manageAddRemoveSlidesButtons()));

    //install selection manager for Slides Sorter View and Custom Shows View
    m_slidesSorterItemContextBar = new KoViewItemContextBar(m_slidesSorterView);
    new KoViewItemContextBar(m_customSlideShowView);
    QToolButton *duplicateButton = m_slidesSorterItemContextBar->addContextButton(i18n("Duplicate Slide"),QString("edit-copy"));
    QToolButton *deleteButton = m_slidesSorterItemContextBar->addContextButton(i18n("Delete Slide"),QString("edit-delete"));
    QToolButton *startPresentation = m_slidesSorterItemContextBar->addContextButton(i18n("Start Slideshow"),QString("view-presentation"));
    connect(view->kopaDocument(), SIGNAL(pageRemoved(KoPAPageBase*)), m_slidesSorterItemContextBar, SLOT(update()));

    //setup signals for item context bar buttons
    connect(duplicateButton, SIGNAL(clicked()), this, SLOT(contextBarDuplicateSlide()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(contextBarDeleteSlide()));
    connect(startPresentation, SIGNAL(clicked()), this, SLOT(contextBarStartSlideshow()));

    //install delegate for Slides Sorter View
    KPrSlidesSorterItemDelegate *slidesSorterDelegate = new KPrSlidesSorterItemDelegate(m_slidesSorterView);
    m_slidesSorterView->setItemDelegate(slidesSorterDelegate);
}
Example #4
0
		bool update()
		{
			ThreadMessages::message msg;
			while (_threadMessages.peek(msg, true))
			{

			}
#ifdef __S3E__

			s3eDeviceYield(0);
			s3eKeyboardUpdate();
			s3ePointerUpdate();

			bool done = false;

			if (s3eDeviceCheckQuitRequest())
				done = true;

			if (s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_PRESSED)
				done = true;

			return done;
#endif


	#if OXYGINE_SDL || EMSCRIPTEN

			//log::messageln("update");
			Input *input = &Input::instance;
			bool done = false;
			SDL_Event event;
			while (SDL_PollEvent(&event)) 
			{
				Event ev(Input::event_platform);
				ev.userData = &event;
				Input::instance.dispatchEvent(&ev);
				
				ObjectScript::processKeyboardEvent(&ev, getStage().get());

				switch(event.type)
				{
				case SDL_QUIT:
					done = true;
					break;
				case SDL_WINDOWEVENT:
					{					
						/*
						if (event.window.event == SDL_WINDOWEVENT_ENTER)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_LEAVE)
							active = true;
							*/

						if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
							active = false;
						if (event.window.event == SDL_WINDOWEVENT_RESTORED)
							active = true;

						bool newFocus = focus;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
							newFocus = false;
						if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
							newFocus = true;
						if (focus != newFocus)
						{
							focus = newFocus;
#if HANDLE_FOCUS_LOST

							if (focus)							
								focusAcquired();

							log::messageln("focus: %d", (int)focus);
							Event ev(focus ? Stage::ACTIVATE : Stage::DEACTIVATE);
							if (getStage())
								getStage()->dispatchEvent(&ev);

							if (!focus)
								focusLost();							
#endif							
						}
						//log::messageln("SDL_SYSWMEVENT %d", (int)event.window.event);
						break;
					}
				case SDL_MOUSEWHEEL:
					input->sendPointerWheelEvent(event.wheel.y, &input->_pointerMouse);
					break;
				case SDL_KEYDOWN:
				{
					KeyEvent ev(KeyEvent::KEY_DOWN, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
				case SDL_KEYUP:
				{
					KeyEvent ev(KeyEvent::KEY_UP, &event.key);
					getStage()->dispatchEvent(&ev);
				} break;
#if SDL_VIDEO_OPENGL
				case SDL_MOUSEMOTION:
					input->sendPointerMotionEvent((float)event.motion.x, (float)event.motion.y, 1.0f, &input->_pointerMouse);
					break;
				case SDL_MOUSEBUTTONDOWN:
				case SDL_MOUSEBUTTONUP:
					{
						MouseButton b = MouseButton_Left;
						switch(event.button.button)
						{
							case 1: b = MouseButton_Left; break;
							case 2: b = MouseButton_Middle; break;
							case 3: b = MouseButton_Right; break;
						}

						input->sendPointerButtonEvent(b, (float)event.button.x, (float)event.button.y, 1.0f, 
							event.type == SDL_MOUSEBUTTONDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP, &input->_pointerMouse);
					}					
					break;
#else

				case SDL_FINGERMOTION:
					{
						//log::messageln("SDL_FINGERMOTION");
						Vector2 pos = convertTouch(event);
						input->sendPointerMotionEvent(
							pos.x, pos.y, event.tfinger.pressure,
							input->getTouchByID((int)event.tfinger.fingerId));
					}
				
					break;
				case SDL_FINGERDOWN:
				case SDL_FINGERUP:
					{				
						//log::messageln("SDL_FINGER");
						Vector2 pos = convertTouch(event);
						input->sendPointerButtonEvent(
							MouseButton_Touch,
							pos.x, pos.y, event.tfinger.pressure,
							event.type == SDL_FINGERDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP,
							input->getTouchByID((int)event.tfinger.fingerId));
					}				
					break;
#endif
				}
			}


			return done;
	#elif EMSCRIPTEN
			return false;
	#endif


			log::warning("update not implemented");
			return true;
		}
Example #5
0
void W_EDITBOX::run(W_CONTEXT *psContext)
{
	/* Note the edit state */
	unsigned editState = state & WEDBS_MASK;

	/* Only have anything to do if the widget is being edited */
	if ((editState & WEDBS_MASK) == WEDBS_FIXED)
	{
		return;
	}

	/* If there is a mouse click outside of the edit box - stop editing */
	int mx = psContext->mx;
	int my = psContext->my;
	if (mousePressed(MOUSE_LMB) && (mx < x || mx > x + width || my < y || my > y + height))
	{
		screenClearFocus(psContext->psScreen);
		return;
	}

	/* note the widget state */
	iV_SetFont(FontID);

	/* Loop through the characters in the input buffer */
	bool done = false;
	utf_32_char unicode;
	for (unsigned key = inputGetKey(&unicode); key != 0 && !done; key = inputGetKey(&unicode))
	{
		// Don't blink while typing.
		blinkOffset = wzGetTicks();

		int len = 0;

		/* Deal with all the control keys, assume anything else is a printable character */
		switch (key)
		{
		case INPBUF_LEFT :
			/* Move the cursor left */
			insPos = MAX(insPos - 1, 0);

			/* If the cursor has gone off the left of the edit box,
			 * need to update the printable text.
			 */
			if (insPos < printStart)
			{
				printStart = MAX(printStart - WEDB_CHARJUMP, 0);
				fitStringStart();
			}
			debug(LOG_INPUT, "EditBox cursor left");
			break;
		case INPBUF_RIGHT :
			/* Move the cursor right */
			len = aText.length();
			insPos = MIN(insPos + 1, len);

			/* If the cursor has gone off the right of the edit box,
			 * need to update the printable text.
			 */
			if (insPos > printStart + printChars)
			{
				printStart = MIN(printStart + WEDB_CHARJUMP, len - 1);
				fitStringStart();
			}
			debug(LOG_INPUT, "EditBox cursor right");
			break;
		case INPBUF_UP :
			debug(LOG_INPUT, "EditBox cursor up");
			break;
		case INPBUF_DOWN :
			debug(LOG_INPUT, "EditBox cursor down");
			break;
		case INPBUF_HOME :
			/* Move the cursor to the start of the buffer */
			insPos = 0;
			printStart = 0;
			fitStringStart();
			debug(LOG_INPUT, "EditBox cursor home");
			break;
		case INPBUF_END :
			/* Move the cursor to the end of the buffer */
			insPos = aText.length();
			if (insPos != printStart + printChars)
			{
				fitStringEnd();
			}
			debug(LOG_INPUT, "EditBox cursor end");
			break;
		case INPBUF_INS :
			if (editState == WEDBS_INSERT)
			{
				editState = WEDBS_OVER;
			}
			else
			{
				editState = WEDBS_INSERT;
			}
			debug(LOG_INPUT, "EditBox cursor insert");
			break;
		case INPBUF_DEL :
			delCharRight();

			/* Update the printable text */
			fitStringStart();
			debug(LOG_INPUT, "EditBox cursor delete");
			break;
		case INPBUF_PGUP :
			debug(LOG_INPUT, "EditBox cursor page up");
			break;
		case INPBUF_PGDN :
			debug(LOG_INPUT, "EditBox cursor page down");
			break;
		case INPBUF_BKSPACE :
			/* Delete the character to the left of the cursor */
			delCharLeft();

			/* Update the printable text */
			if (insPos <= printStart)
			{
				printStart = MAX(printStart - WEDB_CHARJUMP, 0);
			}
			fitStringStart();
			debug(LOG_INPUT, "EditBox cursor backspace");
			break;
		case INPBUF_TAB :
			debug(LOG_INPUT, "EditBox cursor tab");
			break;
		case INPBUF_CR :
		case KEY_KPENTER:                  // either normal return key || keypad enter
			/* Finish editing */
			focusLost(psContext->psScreen);
			screenClearFocus(psContext->psScreen);
			debug(LOG_INPUT, "EditBox cursor return");
			return;
			break;
		case INPBUF_ESC :
			debug(LOG_INPUT, "EditBox cursor escape");
			break;

		default:
			if (keyDown(KEY_LCTRL) || keyDown(KEY_RCTRL))
			{
				switch (key)
				{
					case KEY_V:
						aText = wzGetSelection();
						insPos = aText.length();
						/* Update the printable text */
						fitStringEnd();
						debug(LOG_INPUT, "EditBox paste");
						break;
					default:
						break;
				}
				break;
			}
			/* Dealt with everything else this must be a printable character */
			if (editState == WEDBS_INSERT)
			{
				insertChar(unicode);
			}
			else
			{
				overwriteChar(unicode);
			}
			len = aText.length();
			/* Update the printable chars */
			if (insPos == len)
			{
				fitStringEnd();
			}
			else
			{
				fitStringStart();
				if (insPos > printStart + printChars)
				{
					printStart = MIN(printStart + WEDB_CHARJUMP, len - 1);
					if (printStart >= len)
					{
						fitStringStart();
					}
				}
			}
			break;
		}
	}

	/* Store the current widget state */
	state = (state & ~WEDBS_MASK) | editState;
}
Example #6
0
void CanvasWidget::focusOutEvent(QFocusEvent *event)
{
    emit focusLost();
    QGraphicsView::focusOutEvent(event);
}
Example #7
0
		void SDL_handleEvent(SDL_Event &event, bool &done)
		{
			Input *input = &Input::instance;


#ifndef EMSCRIPTEN
			SDL_Window *wnd = SDL_GetWindowFromID(event.window.windowID);			
			void *data = SDL_GetWindowData(wnd, "_");
			spStage stage = (Stage*)data;
#else
			spStage stage = getStage();
#endif
			if (!stage)
				stage = getStage();

			Event ev(Input::event_platform);
			ev.userData = &event;
			Input::instance.dispatchEvent(&ev);

			switch (event.type)
			{
			case SDL_QUIT:
				done = true;
				break;
			case SDL_WINDOWEVENT:
			{
				/*
				if (event.window.event == SDL_WINDOWEVENT_ENTER)
				active = false;
				if (event.window.event == SDL_WINDOWEVENT_LEAVE)
				active = true;
				*/

				if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
					active = false;
				if (event.window.event == SDL_WINDOWEVENT_RESTORED)
					active = true;

				bool newFocus = focus;
				if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
					newFocus = false;
				if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
					newFocus = true;
				if (focus != newFocus)
				{
					focus = newFocus;
#if HANDLE_FOCUS_LOST

					if (focus)
						focusAcquired();

					log::messageln("focus: %d", (int)focus);
					Event ev(focus ? Stage::ACTIVATE : Stage::DEACTIVATE);
					if (stage)
						stage->dispatchEvent(&ev);

					if (!focus)
						focusLost();
#endif							
				}
				//log::messageln("SDL_SYSWMEVENT %d", (int)event.window.event);
				break;
			}
			case SDL_MOUSEWHEEL:
				input->sendPointerWheelEvent(stage, event.wheel.y, &input->_pointerMouse);
				break;
			case SDL_KEYDOWN:
			{
				KeyEvent ev(KeyEvent::KEY_DOWN, &event.key);
				stage->dispatchEvent(&ev);
			} break;
			case SDL_KEYUP:
			{
				KeyEvent ev(KeyEvent::KEY_UP, &event.key);
				stage->dispatchEvent(&ev);
			} break;
#if SDL_VIDEO_OPENGL
			case SDL_MOUSEMOTION:
				input->sendPointerMotionEvent(stage, (float)event.motion.x, (float)event.motion.y, 1.0f, &input->_pointerMouse);
				break;
			case SDL_MOUSEBUTTONDOWN:
			case SDL_MOUSEBUTTONUP:
			{
				MouseButton b = MouseButton_Left;
				switch (event.button.button)
				{
				case 1: b = MouseButton_Left; break;
				case 2: b = MouseButton_Middle; break;
				case 3: b = MouseButton_Right; break;
				}

				input->sendPointerButtonEvent(stage, b, (float)event.button.x, (float)event.button.y, 1.0f,
					event.type == SDL_MOUSEBUTTONDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP, &input->_pointerMouse);
			}
				break;
#else

			case SDL_FINGERMOTION:
			{
				//log::messageln("SDL_FINGERMOTION");
				Vector2 pos = convertTouch(event);
				input->sendPointerMotionEvent(stage,
					pos.x, pos.y, event.tfinger.pressure,
					input->getTouchByID((int)event.tfinger.fingerId));
			}

				break;
			case SDL_FINGERDOWN:
			case SDL_FINGERUP:
			{
				//log::messageln("SDL_FINGER");
				Vector2 pos = convertTouch(event);
				input->sendPointerButtonEvent(stage, 
					MouseButton_Touch,
					pos.x, pos.y, event.tfinger.pressure,
					event.type == SDL_FINGERDOWN ? TouchEvent::TOUCH_DOWN : TouchEvent::TOUCH_UP,
					input->getTouchByID((int)event.tfinger.fingerId));
			}
				break;
#endif
			}

		}
Example #8
0
//***************************************************************************
Kwave::RecordDialog::RecordDialog(QWidget *parent, QStringList &params,
                                  Kwave::RecordController *controller,
                                  Kwave::RecordDialog::Mode mode)
    :QDialog(parent), Ui::RecordDlg(), m_methods_map(),
     m_file_filter(), m_devices_list_map(),
     m_state(Kwave::REC_EMPTY), m_params(),
     m_supported_resolutions(), m_buffer_progress_count(0),
     m_buffer_progress_total(0), m_buffer_progress_timer(this),
     m_record_enabled(true), m_samples_recorded(0),
     m_enable_setDevice(true), m_state_icon_widget(0)
{
    m_status_bar.m_state           = 0;
    m_status_bar.m_time            = 0;
    m_status_bar.m_sample_rate     = 0;
    m_status_bar.m_bits_per_sample = 0;
    m_status_bar.m_tracks          = 0;

    setupUi(this);

    /* get initial parameters */
    m_params.fromList(params);

    /* set the icons of the record control buttons */
    KIconLoader icon_loader;
    btNew->setIcon(   QIcon(icon_loader.loadIcon(_("document-new"),
	              KIconLoader::Toolbar)));
    btStop->setIcon(  QIcon(QPixmap(xpm_stop)));
    btPause->setIcon( QIcon(QPixmap(xpm_pause)));
    btRecord->setIcon(QIcon(QPixmap(xpm_krec_record)));

    // fill the combo box with playback methods
    unsigned int index=0;
    for (index = 0; index < m_methods_map.count(); ++index) {
	cbMethod->addItem(m_methods_map.description(index, true));
    }
    cbMethod->setEnabled(cbMethod->count() > 1);

    /* --- set up all controls with their default/startup values --- */

    // pre-record
    STD_SETUP_SLIDER(pre_record_enabled, pre_record_time, RecordPre);
    connect(chkRecordPre, SIGNAL(toggled(bool)),
            this,         SLOT(preRecordingChecked(bool)));
    connect(sbRecordPre,  SIGNAL(valueChanged(int)),
            this,         SLOT(preRecordingTimeChanged(int)));

    // record time (duration)
    STD_SETUP(record_time_limited, record_time, RecordTime);

    // start time (date & time)
    chkRecordStartTime->setChecked(m_params.start_time_enabled);
    startTime->setDateTime(m_params.start_time);

    // record trigger
    STD_SETUP_SLIDER(record_trigger_enabled, record_trigger, RecordTrigger);

    // amplification
    STD_SETUP_SLIDER(amplification_enabled, amplification, LevelAmplify);

    // AGC
    STD_SETUP_SLIDER(agc_enabled, agc_decay, LevelAGC);

    // fade in
    STD_SETUP(fade_in_enabled, fade_in_time, LevelFadeIn);

    // fade out
    STD_SETUP(fade_out_enabled, fade_out_time, LevelFadeOut);

    // sample rate, bits per sample, track
    // -> will be initialized later, by the plugin

    // number of buffers
    slSourceBufferCount->setValue(m_params.buffer_count);

    // power of buffer size
    slSourceBufferSize->setValue(m_params.buffer_size);
    sourceBufferSizeChanged(m_params.buffer_size);

    // after this point all controls have their initial values

    /* --- connect some missing low level GUI functionality --- */

    connect(cbMethod, SIGNAL(activated(int)),
            this, SLOT(methodSelected(int)));

    // record buffer size and count
    slSourceBufferCount->setValue(m_params.buffer_count);
    slSourceBufferSize->setValue(m_params.buffer_size);
    connect(slSourceBufferSize, SIGNAL(valueChanged(int)),
            this, SLOT(sourceBufferSizeChanged(int)));
    connect(slSourceBufferCount, SIGNAL(valueChanged(int)),
            this, SLOT(sourceBufferCountChanged(int)));

    // device treeview
    connect(listDevices,
            SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
            SLOT(listEntrySelected(QTreeWidgetItem*,QTreeWidgetItem*)));
    connect(listDevices, SIGNAL(itemExpanded(QTreeWidgetItem*)),
            SLOT(listItemExpanded(QTreeWidgetItem*)));
    connect(listDevices, SIGNAL(focusLost()),
            SLOT(updateListSelection()));

    // "select device..." button
    connect(btSourceSelect, SIGNAL(clicked()),
            this, SLOT(selectRecordDevice()));
    connect(cbDevice, SIGNAL(activated(QString)),
            this, SLOT(setDevice(QString)));

    // setup controls
    connect(chkRecordTime, SIGNAL(toggled(bool)),
            this, SLOT(recordTimeChecked(bool)));
    connect(sbRecordTime, SIGNAL(valueChanged(int)),
            this, SLOT(recordTimeChanged(int)));

    connect(chkRecordStartTime, SIGNAL(toggled(bool)),
            this, SLOT(startTimeChecked(bool)));
    connect(startTime, SIGNAL(dateTimeChanged(QDateTime)),
            this, SLOT(startTimeChanged(QDateTime)));

    connect(chkRecordTrigger, SIGNAL(toggled(bool)),
            this, SLOT(triggerChecked(bool)));
    connect(sbRecordTrigger, SIGNAL(valueChanged(int)),
            this, SLOT(triggerChanged(int)));

    connect(cbFormatSampleRate, SIGNAL(editTextChanged(QString)),
            this, SLOT(sampleRateChanged(QString)));
    connect(cbFormatSampleRate, SIGNAL(activated(QString)),
            this, SLOT(sampleRateChanged(QString)));

    connect(sbFormatTracks, SIGNAL(valueChanged(int)),
            this, SLOT(tracksChanged(int)));

    connect(cbFormatCompression, SIGNAL(activated(int)),
            this, SLOT(compressionChanged(int)));

    connect(sbFormatResolution, SIGNAL(valueChanged(int)),
            this, SLOT(bitsPerSampleChanged(int)));

    connect(cbFormatSampleFormat, SIGNAL(activated(int)),
            this, SLOT(sampleFormatChanged(int)));

    // connect the buttons to the record controller
    connect(btNew, SIGNAL(clicked()),
            controller, SLOT(actionReset()));
    connect(btStop, SIGNAL(clicked()),
            controller, SLOT(actionStop()));
    connect(btPause, SIGNAL(clicked()),
            controller, SLOT(actionPause()));
    connect(btRecord, SIGNAL(clicked()),
            controller, SLOT(actionStart()));

    // stop recording when the window gets closed
    connect(this, SIGNAL(rejected()), controller, SLOT(actionStop()));
    connect(this, SIGNAL(accepted()), controller, SLOT(actionStop()));

    // connect the notifications/commands of the record controller
    connect(controller, SIGNAL(stateChanged(Kwave::RecordState)),
            this, SLOT(setState(Kwave::RecordState)));

    // timer for updating the buffer progress bar
    connect(&m_buffer_progress_timer, SIGNAL(timeout()),
            this, SLOT(updateBufferProgressBar()));

    // help button
    connect(buttonBox->button(QDialogButtonBox::Help), SIGNAL(clicked()),
            this,   SLOT(invokeHelp()));

    // status bar
    m_state_icon_widget = new Kwave::StatusWidget(this);
    Q_ASSERT(m_state_icon_widget);
    if (!m_state_icon_widget) return;

    m_state_icon_widget->setFixedSize(16, 16);
    lbl_state->addWidget(m_state_icon_widget);

    m_status_bar.m_state = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_state);
    if (!m_status_bar.m_state) return;
    m_status_bar.m_state->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_state);

    m_status_bar.m_time = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_time);
    if (!m_status_bar.m_time) return;
    m_status_bar.m_time->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_time);

    m_status_bar.m_sample_rate = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_sample_rate);
    if (!m_status_bar.m_sample_rate) return;
    m_status_bar.m_sample_rate->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_sample_rate);

    m_status_bar.m_bits_per_sample = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_bits_per_sample);
    if (!m_status_bar.m_bits_per_sample) return;
    m_status_bar.m_bits_per_sample->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_bits_per_sample);

    m_status_bar.m_tracks = new (std::nothrow) QLabel(_(" "));
    Q_ASSERT(m_status_bar.m_tracks);
    if (!m_status_bar.m_tracks) return;
    m_status_bar.m_tracks->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    lbl_state->addWidget(m_status_bar.m_tracks);

    m_state_icon_widget->setFixedSize(16, lbl_state->childrenRect().height());

    // set the initial state of the dialog to "Reset/Empty"
    setState(Kwave::REC_EMPTY);

    // disable the "level" tab, it is not implemented yet
    tabRecord->setCurrentIndex(1);
    QWidget *page = tabRecord->currentWidget();
    tabRecord->setCurrentIndex(0);
    if (page) delete page;

    // add the "Done" button manually, otherwise it would have "Cancel" semantic
    QPushButton *bt_done =
	buttonBox->addButton(i18n("&Done"), QDialogButtonBox::AcceptRole);
    Q_ASSERT(bt_done);
    if (!bt_done) return;
    connect(bt_done, SIGNAL(clicked(bool)), this, SLOT(accept()));

    switch (mode)
    {
	case Kwave::RecordDialog::SETTINGS_FORMAT:
	    tabRecord->setCurrentIndex(1);
	    break;
	case Kwave::RecordDialog::SETTINGS_SOURCE:
	    tabRecord->setCurrentIndex(2);
	    break;
	case Kwave::RecordDialog::START_RECORDING:  /* FALLTHROUGH */
	case Kwave::RecordDialog::SETTINGS_DEFAULT: /* FALLTHROUGH */
	default:
	    tabRecord->setCurrentIndex(0);
	    // set the focus onto the "Record" button
	    btRecord->setFocus();
	    break;
    }
}
void PhoneUiHouseHoldPrivate::ConstructL()
{
    new( ELeave ) CPhoneLogger( KUidPhoneUILoggerSingleton );
    FeatureManager::InitializeLibL();
    
    HbTranslator *translator = new HbTranslator(QString("telephone"));

	if (translator) {
        translator->loadCommon();
        m_translators.append(translator);
	}
    
	HbTranslator *translator2 = new HbTranslator(QString("telephone_cp"));
    if (translator2) {
        m_translators.append(translator2);
    }

    PhoneUIQtView *view = new PhoneUIQtView(m_window);
    iViewAdapter = new PhoneUIQtViewAdapter(*view);
    iPhoneUIController = CPhoneUIController::NewL(iViewAdapter);
    iViewAdapter->setEngineInfo(iPhoneUIController->EngineInfo());
    
    m_window.addView (view);
    m_window.setCurrentView (view);
    m_window.scene ()->setFocusItem (view);
    iKeyEventAdapter = new PhoneUIKeyEventAdapter (*iPhoneUIController);
    iCommandAdapter = new PhoneUiCommandAdapter (*iPhoneUIController);
    QObject::connect(view, SIGNAL(dialpadIsAboutToClose()), iViewAdapter, SLOT(dialpadClosed()));
    QObject::connect(view, SIGNAL(keyReleased(QKeyEvent *)), iViewAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyPressed (QKeyEvent *)), iKeyEventAdapter, SLOT(keyPressed (QKeyEvent *)));
    QObject::connect(view, SIGNAL(keyReleased (QKeyEvent *)), iKeyEventAdapter, SLOT(keyReleased (QKeyEvent *)));
    QObject::connect(view, SIGNAL(command (int)), iCommandAdapter, SLOT(handleCommand (int)),
                     Qt::QueuedConnection); // async to enable deletion of widget during signal handling
    QObject::connect(view, SIGNAL(windowActivated()), iViewAdapter, SLOT(handleWindowActivated()));
    QObject::connect(view, SIGNAL(windowDeactivated()), iViewAdapter, SLOT(handleWindowDeactivated()));
    QObject::connect(&m_window, SIGNAL(focusLost()),iViewAdapter, SLOT(onFocusLost()));
    QObject::connect(&m_window, SIGNAL(focusGained()),iViewAdapter, SLOT(onFocusGained()));
    QObject::connect(iViewAdapter->noteController(), SIGNAL(command (int)), 
                     iCommandAdapter, SLOT(handleCommand (int))); 
    
    // Disable default Send key functionality in application framework 
    // avkon removal
//    CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
//    appUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | 
//                             CAknAppUiBase::EDisableSendKeyLong );
    
    // CLI Name.
    TInt err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLIName,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );
      
    // CLI Number.
    err = RProperty::Define( 
        KPSUidTelRemotePartyInformation,
        KTelCLINumber,
        RProperty::EText,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // Startup event signalling
    // Define the telephony application system property 
 
     err = RProperty::Define( 
        KPSUidTelInformation,
        KTelPhoneUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );  

// DefineNewPSKeys:

    // UID: KPSUidTelInternalInformation:
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelRemotePartyContactInfo,
        RProperty::EByteArray,
        KPhoneReadPolicy,
        KPhoneWritePolicy );    
               
    // VT UID.
    err = RProperty::Define( 
        KPSUidTelInternalInformation,
        KTelVideoCallUid,
        RProperty::EInt,
        KPhoneReadPolicy,
        KPhoneWritePolicy );

    // TELINTERNALPSKEY CHANGE 
    // Move to AudioHandling
    // UID: KPSUidTelAudioPreference
    // Call Audio Routing
    err = RProperty::Define( 
        KPSUidTelAudioPreference, 
        KTelAudioOutput, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );

    // UID: KPSUidNEInformation
    err = RProperty::Define( 
        KPSUidNEInformation, 
        KTelNumberEntryInfo, 
        RProperty::EInt,
        KPhoneReadPolicyAlwaysPass,
        KPhoneWritePolicy );


    // Add DoStartupSignalL to the recovery system 
    iStartupSignalRecoveryId = 
        CPhoneRecoverySystem::Instance()->AddL( 
            TCallBack( DoStartupSignalL, this ),
            CTeleRecoverySystem::EPhonePriorityHigh,
            CTeleRecoverySystem::EPhoneStateIdle );

    // Call DoStartupSignalL within recovery system
    const TInt startupState = CPhonePubSubProxy::Instance()->Value(
        KPSUidStartup,
        KPSGlobalSystemState );

    PHONE_DEBUG2("phoneui::main() startupState value=", startupState );

    if ( startupState == ESwStateCriticalPhaseOK ||
        startupState == ESwStateEmergencyCallsOnly ||
        startupState == ESwStateNormalRfOn ||
        startupState == ESwStateNormalRfOff ||
        startupState == ESwStateNormalBTSap )
        {
        PHONE_DEBUG("phoneui::main() Notify Starter that phone is ready...");    
        CPhoneRecoverySystem::Instance()->RecoverNow(
            iStartupSignalRecoveryId, 
            CTeleRecoverySystem::EPhonePriorityHigh );
        }
    else
        {        
        PHONE_DEBUG("phoneui::main() Startup not ready yet. Start listening...");
        CPhonePubSubProxy::Instance()->NotifyChangeL(
            KPSUidStartup,
            KPSGlobalSystemState,
            this );
        }

    if ( err == KErrNone || err == KErrAlreadyExists )
        {
        // Indicate to the system that the Phone has been started
        CPhonePubSubProxy::Instance()->ChangePropertyValue(
            KPSUidTelInformation,
            KTelPhoneUid,
            KUidPhoneApplication.iUid );
        }

    // Update the Apps ready flag
    iAppsReady += EPhoneStartedUp;

    HbMainWindow *main = hbInstance->allMainWindows().at(0);
    RWindow *win = static_cast<RWindow *>(main->effectiveWinId()->DrawableWindow());

    CEikonEnv* env = CEikonEnv::Static();
    if ( env ) {
        env->SetSystem(ETrue);
        // Blacklist singleton is initialized here
        CPhoneClearBlacklist::CreateL( env->WsSession(), *win);
    }
}