Example #1
0
bool DatabaseWidget::isInEditMode() const
{
    if (currentMode() == DatabaseWidget::LockedMode) {
        return m_widgetBeforeLock != Q_NULLPTR
                && m_widgetBeforeLock != m_mainWidget
                && m_widgetBeforeLock != m_unlockDatabaseWidget;
    }
    else {
        return currentMode() == DatabaseWidget::EditMode;
    }
}
Example #2
0
void ModeManager::activateModeType(const QString &type)
{
    if (currentMode() && currentMode()->type() == type)
        return;
    int index = -1;
    for (int i = 0; i < d->m_modes.count(); ++i) {
        if (d->m_modes.at(i)->type() == type) {
            index = i;
            break;
        }
    }
    if (index != -1)
        d->m_modeStack->setCurrentIndex(index);
}
/*!
    Constructor.
 */
UsbUiSettingModel::UsbUiSettingModel( QObject *parent )
    : QAbstractItemModel( parent), mSelectionModel(NULL)
{
    mModelActive = new UsbUiModelActive();
    mCurrentMode = currentMode();
    initializeModelData(mCurrentMode);
  	bool ret = mSettingsManager.startMonitoring( 
   	        XQSettingsKey( XQSettingsKey::TargetCentralRepository, 
   	                KCRUidUsbWatcher.iUid, KUsbWatcherPersonality ) );
    myDebug() << ">>> UsbUiSettingModel::startMonitoring value=" 
              << ret; 
                              
   	// signal: personality changed in the central repository                
   	ret = connect( &mSettingsManager, 
   	        SIGNAL( valueChanged( const XQSettingsKey&, const QVariant& ) ), 
   	        this, 
   	        SLOT( cenrepChanged( const XQSettingsKey&, const QVariant& ) ) );
    myDebug() << ">>> UsbUiSettingModel::UsbUiSettingModel connect valueChanged="
            << ret;
   	        
    // signal: response from usbwatcher to our attempt to set the personality 	        
   	ret = connect( mModelActive, 
   	        SIGNAL( requestCompleted( int ) ), 
   	        this, 
   	        SLOT( personalitySetCompleted( int )));
    myDebug() << ">>> UsbUiSettingModel::UsbUiSettingModel connect requestCompleted="
            << ret;
}
Example #4
0
void GLWindow::createGLWindow(bool togglefullscreen)
{

	if(togglefullscreen)
	{
		isFullscreen = !isFullscreen;	
		destroyGL();
	}

	RECT		WindowRect;

	int	width = isFullscreen?videoModes[fullscreenMode].width:videoModes[windowedMode].width;
	int	height = isFullscreen?videoModes[fullscreenMode].height:videoModes[windowedMode].height;
	int	bits = isFullscreen?videoModes[fullscreenMode].bpp:videoModes[windowedMode].bpp;

	windowPosition = Point(nativeMode.dmPelsWidth/2 - width/2, nativeMode.dmPelsHeight/2 - height/2);

	int	x = isFullscreen?0:windowPosition.x;
	int	y = isFullscreen?0:windowPosition.y;

	WindowRect.left = (long) x;
	WindowRect.right = (long) x + width;
	WindowRect.top = (long) y;	
	WindowRect.bottom = (long) y + height;

	if(isFullscreen) 
	{
		SetWindowLongPtr(hWnd, GWL_EXSTYLE, WS_EX_APPWINDOW );
		SetWindowLongPtr(hWnd, GWL_STYLE, 
			WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE);
		SetWindowPos(hWnd,HWND_TOP, 0, 0, width, height, SWP_SHOWWINDOW);

		DEVMODE dm;
		dm.dmSize = sizeof(DEVMODE);
		dm.dmPelsWidth = width;
		dm.dmPelsHeight = height;
		dm.dmBitsPerPel = bits;
		dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
		ChangeDisplaySettings(&dm,CDS_FULLSCREEN);
	}
	else
	{
		if(currentMode() == 0)
			SystemParametersInfo( SPI_GETWORKAREA, 0, &WindowRect, 0 );
		DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;	
		DWORD dwStyle = WS_OVERLAPPEDWINDOW | WS_MINIMIZEBOX  | WS_SYSMENU | WS_VISIBLE;
		SetWindowLongPtr(hWnd, GWL_EXSTYLE,  dwExStyle);
		SetWindowLongPtr(hWnd, GWL_STYLE, dwStyle);
		AdjustWindowRectEx(&WindowRect, dwStyle, false, dwExStyle);
		SetWindowPos(hWnd,HWND_TOP, WindowRect.left, WindowRect.top,
			WindowRect.right-WindowRect.left,
			WindowRect.bottom-WindowRect.top, SWP_SHOWWINDOW);
		if(togglefullscreen)
			ChangeDisplaySettings(NULL, 0);
	}

	if(togglefullscreen)
		initGL(bits);
}
Example #5
0
void DatabaseWidget::lock()
{
    Q_ASSERT(currentMode() != DatabaseWidget::LockedMode);

    widgetBeforeLock = currentWidget();
    m_unlockDatabaseWidget->load(m_filename, m_db);
    setCurrentWidget(m_unlockDatabaseWidget);
}
Example #6
0
void CommandInset::write(WriteStream & os) const
{
	ModeSpecifier specifier(os, currentMode(), lockedMode(), asciiOnly());
	MathEnsurer ensurer(os, needs_math_mode_);
	os << '\\' << name_;
	if (cell(1).size())
		os << '[' << cell(1) << ']';
	os << '{' << cell(0) << '}';
}
Example #7
0
int ModeListModel::getIndexOf(const std::string &widthXHeightMode)
{
    std::string currentMode("");
    for (int i = 0; i < getNumberOfElements(); i++)
    {
        currentMode = getElementAt(i);
        if (currentMode == widthXHeightMode)
            return i;
    }
    return -1;
}
Example #8
0
void QLCFixtureEditor::slotCloneMode()
{
    QLCFixtureMode* mode = NULL;
    bool ok = false;
    QString text;

    mode = currentMode();
    if (mode == NULL)
        return;

    while (1)
    {
        text = QInputDialog::getText(this, tr("Rename new mode"),
                                     tr("Give a unique name for the mode"),
                                     QLineEdit::Normal,
                                     tr("Copy of %1").arg(mode->name()),
                                     &ok);

        if (ok == true && text.isEmpty() == false)
        {
            /* User entered a name that is already found from
               the fixture definition -> again */
            if (mode->fixtureDef()->mode(text) != NULL)
            {
                QMessageBox::information(this,
                                         tr("Invalid name"),
                                         tr("Another mode by that name already exists."));
                ok = false;
                continue;
            }

            /* Create new mode and an item for it */
            QTreeWidgetItem* item;
            QLCFixtureMode* clone;

            clone = new QLCFixtureMode(mode->fixtureDef(), mode);
            clone->setName(text);
            item = new QTreeWidgetItem(m_modeList);

            mode->fixtureDef()->addMode(clone);
            updateModeItem(clone, item);
            m_modeList->setCurrentItem(item);

            setModified();
            break;
        }
        else
        {
            // User pressed cancel
            break;
        }
    }
}
Example #9
0
void ModeManager::setFocusToCurrentMode()
{
    IMode *mode = findMode(currentMode());
    QTC_ASSERT(mode, return);
    QWidget *widget = mode->widget();
    if (widget) {
        QWidget *focusWidget = widget->focusWidget();
        if (!focusWidget)
            focusWidget = widget;
        focusWidget->setFocus();
    }
}
Example #10
0
void ModeManager::setFocusToCurrentMode()
{
    IMode *mode = currentMode();
    QTC_ASSERT(mode, return);
    QWidget *widget = mode->widget();
    if (widget) {
        QWidget *focusWidget = widget->focusWidget();
        if (!focusWidget)
            focusWidget = widget;
        focusWidget->setFocus();
        ICore::raiseWindow(focusWidget);
    }
}
Example #11
0
void QLCFixtureEditor::slotRemoveMode()
{
    QLCFixtureMode* mode = currentMode();

    if (QMessageBox::question(this, tr("Remove Mode"),
                              tr("Are you sure you wish to remove mode: %1 ?").arg(mode->name()),
                              QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
    {
        m_fixtureDef->removeMode(mode);
        delete m_modeList->currentItem();
        setModified();
    }
}
/*!
 * it checks the response from usbwatcher to see if the new mode change has been successful
 * it will go back to the previous personality if it has not been successful
 */
void UsbUiSettingModel::personalitySetCompleted (int status )
{
    myDebug() << ">>> UsbUiSettingModel::personalitySetCompleted status= "
        << status;      
    // status contains Symbian error code from usbwatcher
    // if the status is KErrNone, we are ready to process the next request
    if (status != KErrNone) {
        // changing the personality failed, so we need to set back the previous personality
        // the value will be read from central repository and also updates mCurrentMode  
        updateSelectionModel(currentMode());
    }
   
    myDebug() << "<<< UsbUiSettingModel::personalitySetCompleted";      
}
Example #13
0
void InsetMathSymbol::write(WriteStream & os) const
{
	unique_ptr<MathEnsurer> ensurer;
	if (currentMode() != TEXT_MODE)
		ensurer = make_unique<MathEnsurer>(os);
	else
		ensurer = make_unique<MathEnsurer>(os, false, true, true);
	os << '\\' << name();

	// $,#, etc. In theory the restriction based on catcodes, but then
	// we do not handle catcodes very well, let alone cat code changes,
	// so being outside the alpha range is good enough.
	if (name().size() == 1 && !isAlphaASCII(name()[0]))
		return;

	os.pendingSpace(true);
}
Example #14
0
void QLCFixtureEditor::slotCloneMode()
{
	QLCFixtureMode* mode = NULL;
	QLCFixtureMode* clone = NULL;
	bool ok = false;
	QString text;
	
	mode = currentMode();
	if (mode == NULL)
		return;
	
	while (1)
	{
		text = QInputDialog::getText(this, tr("Rename new mode"),
					     tr("Give a unique name for the mode"),
					     QLineEdit::Normal,
					     "Copy of " + mode->name(),
					     &ok);

		if (ok == true && text.isEmpty() == false)
		{
			/* User entered a name that is already found from
			   the fixture definition -> again */
			if (mode->fixtureDef()->mode(text) != NULL)
			{
				QMessageBox::information(
					this,
					tr("Invalid name"),
					tr("Another mode by that name already exists."));
				ok = false;
				continue;
			}

			clone = new QLCFixtureMode(mode);
			clone->setName(text);
			mode->fixtureDef()->addMode(clone);
			refreshModeList();
			break;
		}
		else
		{
			// User pressed cancel
			break;
		}
	}
}
//! [8]
void ImageComposer::recalculateResult()
{
    QPainter::CompositionMode mode = currentMode();

    QPainter painter(&resultImage);
    painter.setCompositionMode(QPainter::CompositionMode_Source);
    painter.fillRect(resultImage.rect(), Qt::transparent);
    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
    painter.drawImage(0, 0, destinationImage);
    painter.setCompositionMode(mode);
    painter.drawImage(0, 0, sourceImage);
    painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
    painter.fillRect(resultImage.rect(), Qt::white);
    painter.end();

    resultLabel->setPixmap(QPixmap::fromImage(resultImage));
}
Example #16
0
void ModeManager::enabledStateChanged()
{
    IMode *mode = qobject_cast<IMode *>(sender());
    QTC_ASSERT(mode, return);
    int index = d->m_modes.indexOf(mode);
    QTC_ASSERT(index >= 0, return);
    d->m_modeStack->setTabEnabled(index, mode->isEnabled());

    // Make sure we leave any disabled mode to prevent possible crashes:
    if (mode->id() == currentMode() && !mode->isEnabled()) {
        // This assumes that there is always at least one enabled mode.
        for (int i = 0; i < d->m_modes.count(); ++i) {
            if (d->m_modes.at(i) != mode &&
                d->m_modes.at(i)->isEnabled()) {
                activateMode(d->m_modes.at(i)->id());
                break;
            }
        }
    }
}
Example #17
0
void QLCFixtureEditor::slotEditMode()
{
    QLCFixtureMode* mode = currentMode();
    QTreeWidgetItem* item = NULL;

    if (mode == NULL)
        return;

    EditMode em(this, mode);
    em.setClipboard(m_physicalCopy);
    if (em.exec() == QDialog::Accepted)
    {
        *mode = *(em.mode());

        item = m_modeList->currentItem();
        updateModeItem(mode, item);
        setModified();
    }
    m_physicalCopy = em.getClipboard();
}
Example #18
0
void QLCFixtureEditor::slotEditMode()
{
	QLCFixtureMode* mode = currentMode();
	QString str;

	if (mode == NULL)
		return;
	
	EditMode em(this, mode);
	if (em.exec() == QDialog::Accepted)
	{
		QTreeWidgetItem* item = NULL;
		*mode = *(em.mode());
		
		item = m_modeList->currentItem();
		item->setText(KModesColumnName, mode->name());
		str.sprintf("%d", mode->channels());
		item->setText(KModesColumnChannels, str);
		
		setModified();
	}
}
Example #19
0
void QLCFixtureEditor::slotRemoveMode()
{
	QLCFixtureMode* mode = currentMode();
	
	if (QMessageBox::question(this, "Remove Mode",
		QString("Are you sure you wish to remove mode: ") + mode->name(),
			QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
	{
		QTreeWidgetItem* item;
		QTreeWidgetItem* next;
		
		item = m_modeList->currentItem();
		if (m_modeList->itemBelow(item) != NULL)
			next = m_modeList->itemBelow(item);
		else if (m_modeList->itemAbove(item) != NULL)
			next = m_modeList->itemAbove(item);
		else
			next = NULL;

		m_fixtureDef->removeMode(mode);
		delete item;
		setModified();
	}
}
QDeclarativeNetworkInfo::QDeclarativeNetworkInfo(QObject *parent) :
    QSystemNetworkInfo(parent)
{
    m_mode = currentMode();
}
Example #21
0
bool DatabaseWidget::isInEditMode() const
{
    return currentMode() == DatabaseWidget::EditMode;
}
Example #22
0
void DatabaseWidget::emitCurrentModeChanged()
{
    Q_EMIT currentModeChanged(currentMode());
}