Beispiel #1
0
void LapsusOSD::readSettings( KConfigBase* c )
{
	QString oldGroup = c->group();
	c->setGroup( "applet_osd" );

	setPosition( c->readPointEntry( "position", 0 ) );
	setScreen( c->readNumEntry( "screen", 0 ) );

	c->setGroup( oldGroup );
}
void Window::goBackScreen()
{
    // Make sure the pointer is valid
    if(!switchBackScreen) return;

    // Switch screens
    setScreen(switchBackScreen);

    // Trash new back screen
    // You may only go back 1 time
    switchBackScreen = 0;
}
QT_BEGIN_NAMESPACE

QShapedPixmapWindow::QShapedPixmapWindow(QScreen *screen)
    : m_useCompositing(true)
{
    setScreen(screen);
    QSurfaceFormat format;
    format.setAlphaBufferSize(8);
    setFormat(format);
    setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint
             | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus);
}
Beispiel #4
0
void View::positionOnScreen()
{
    QScreen* shownOnScreen = 0;
    if (QGuiApplication::screens().count() <= 1) {
        shownOnScreen = QGuiApplication::primaryScreen();
    } else {
        Q_FOREACH (QScreen* screen, QGuiApplication::screens()) {
            if (screen->geometry().contains(QCursor::pos(screen))) {
                shownOnScreen = screen;
                break;
            }
        }
    }
    Q_ASSERT(shownOnScreen);

    setScreen(shownOnScreen);
    const QRect r = shownOnScreen->availableGeometry();

    if (m_floating && !m_customPos.isNull()) {
        int x = qBound(r.left(), m_customPos.x(), r.right() - width());
        int y = qBound(r.top(), m_customPos.y(), r.bottom() - height());
        setPosition(x, y);
        show();
        return;
    }

    const int w = width();
    int x = r.left() + (r.width() * m_offset) - (w / 2);

    int y = r.top();
    if (m_floating) {
        y += r.height() / 3;
    }

    x = qBound(r.left(), x, r.right() - width());
    y = qBound(r.top(), y, r.bottom() - height());

    setPosition(x, y);

    if (m_floating) {
        KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop());
        KWindowSystem::setType(winId(), NET::Normal);
        //Turn the sliding effect off
        KWindowEffects::slideWindow(winId(), KWindowEffects::NoEdge, 0);
    } else {
        KWindowSystem::setOnAllDesktops(winId(), true);
        KWindowEffects::slideWindow(winId(), KWindowEffects::TopEdge, 0);
    }

    KWindowSystem::forceActiveWindow(winId());
    //qDebug() << "moving to" << m_screenPos[screen];
}
void ScreenInfo::updateGeometry(int screen)
{
    if (m_corner != InvalidCorner) {
        int screenCorner = cornerScreen(m_corner);
        if (m_screen != screenCorner) {
            setScreen(screenCorner);
            return;
        }
    }
    if (screen == m_screen) {
        Q_EMIT geometryChanged(geometry());
    }
}
Beispiel #6
0
WindowPaintData::WindowPaintData(EffectWindow* w)
    : PaintData()
    , shader(nullptr)
    , d(new WindowPaintDataPrivate())
{
    quads = w->buildQuads();
    setOpacity(w->opacity());
    setDecorationOpacity(1.0);
    setSaturation(1.0);
    setBrightness(1.0);
    setScreen(0);
    setCrossFadeProgress(1.0);
}
Beispiel #7
0
WindowPaintData::WindowPaintData(EffectWindow* w, const QMatrix4x4 &screenProjectionMatrix)
    : PaintData()
    , shader(nullptr)
    , d(new WindowPaintDataPrivate())
{
    d->screenProjectionMatrix = screenProjectionMatrix;
    quads = w->buildQuads();
    setOpacity(w->opacity());
    setSaturation(1.0);
    setBrightness(1.0);
    setScreen(0);
    setCrossFadeProgress(1.0);
}
Beispiel #8
0
bool Video::loadXML(const QDomElement& root)
{
    if (root.tagName() != KXMLQLCFunction)
    {
        qWarning() << Q_FUNC_INFO << "Function node not found";
        return false;
    }

    if (root.attribute(KXMLQLCFunctionType) != typeToString(Function::Video))
    {
        qWarning() << Q_FUNC_INFO << root.attribute(KXMLQLCFunctionType)
                   << "is not Video";
        return false;
    }

    QDomNode node = root.firstChild();
    while (node.isNull() == false)
    {
        QDomElement tag = node.toElement();
        if (tag.tagName() == KXMLQLCVideoSource)
        {
            if (tag.hasAttribute(KXMLQLCVideoStartTime))
                setStartTime(tag.attribute(KXMLQLCVideoStartTime).toUInt());
            if (tag.hasAttribute(KXMLQLCVideoColor))
                setColor(QColor(tag.attribute(KXMLQLCVideoColor)));
            if (tag.hasAttribute(KXMLQLCVideoLocked))
                setLocked(true);
            if (tag.hasAttribute(KXMLQLCVideoScreen))
                setScreen(tag.attribute(KXMLQLCVideoScreen).toInt());
            if (tag.hasAttribute(KXMLQLCVideoFullscreen))
            {
                if (tag.attribute(KXMLQLCVideoFullscreen) == "1")
                    setFullscreen(true);
                else
                    setFullscreen(false);
            }
            if (tag.text().contains("://") == true)
                setSourceUrl(tag.text());
            else
                setSourceUrl(m_doc->denormalizeComponentPath(tag.text()));
        }
        else if (tag.tagName() == KXMLQLCFunctionSpeed)
        {
            loadXMLSpeed(tag);
        }
        node = node.nextSibling();
    }

    return true;
}
ScreenTab::ScreenTab(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ScreenTab),
    _currentMedia(NULL),
    _screen(NULL),
    _desktopMediaPlayer(new DesktopMediaPlayer(this))
{
    ui->setupUi(this);
    setScreen(new Screen(this));

//    ui->currentDisplaySpinBox->setMaximum(QApplication::desktop()->screenCount() - 1);

    ui->splitter->setStretchFactor(0, 1);
    ui->splitter->setSizes(QList<int>() << 10000 << 1);
    setContextMenuPolicy(Qt::PreventContextMenu);

    addAction(ui->actionStartStopPlaying);

    ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::FilePatch, QHeaderView::Stretch);
    ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::NumberToShow, QHeaderView::ResizeToContents);
    ui->mediaListTableView->horizontalHeader()->setResizeMode(MediaTableModel::RandomWeigth, QHeaderView::ResizeToContents);
    ui->mediaListTableView->addAction(ui->actionAddMedia);
    ui->mediaListTableView->addAction(ui->actionAddExtension);
    ui->mediaListTableView->addAction(ui->actionRemoveRow);
    ui->mediaListTableView->addAction(ui->actionMoveMediaUp);
    ui->mediaListTableView->addAction(ui->actionMoveMediaDown);
    ui->mediaListTableView->setContextMenuPolicy(Qt::ActionsContextMenu);
    connect(ui->actionAddMedia, SIGNAL(triggered()), this, SLOT(addMedia()));
    connect(ui->actionAddExtension, SIGNAL(triggered()), this, SLOT(addExtension()));
    connect(ui->actionRemoveRow, SIGNAL(triggered()), this, SLOT(removeMedia()));
    connect(ui->actionMoveMediaUp, SIGNAL(triggered()), this, SLOT(moveMediaUp()));
    connect(ui->actionMoveMediaDown, SIGNAL(triggered()), this, SLOT(moveMediaDown()));
    connect(ui->actionStartStopPlaying, SIGNAL(triggered()), this, SLOT(startStopPlaying()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load()));

//    connect(ui->currentDisplaySpinBox, SIGNAL(valueChanged(int)), this, SLOT(onCurrentDisplaySpinBoxChanged(int)));

    connect(_desktopMediaPlayer, SIGNAL(graphicSceneChanged(QGraphicsScene*)), this, SLOT(setSceneToPreview(QGraphicsScene*)));
    connect(_desktopMediaPlayer, SIGNAL(escKeyPressed()), this, SLOT(stopPlaying()));

    mediaListSelectedChanded(QItemSelection(), QItemSelection());

    //Законектим изменение данных в энжайне расширений со слотом обновления расширений
    connect(MDVPlayerApplication::instance(), SIGNAL(extensionEngineDataChanged()), this, SLOT(updateExtensions()));

    onCurrentDisplaySpinBoxChanged(1);
//    onCurrentDisplaySpinBoxChanged(ui->currentDisplaySpinBox->value());
}
Beispiel #10
0
    void Game::run()
    {
        initialize();
        while (m_world->isExists())
        {
            clock_t clockNow = clock();
            clock_t deltaClock = clockNow - m_clockLastFrame;
            float deltaTime = float(deltaClock) / CLOCKS_PER_SEC;
            m_clockLastFrame = clockNow;

            m_framesCounter++;
            m_framesTimeCounter += deltaTime;
            if (m_framesTimeCounter >= 1.0)
            {
                m_framesTimeCounter -= 1.0;
                m_fps = m_framesCounter;
                m_framesCounter = 0;
            }

            m_renderSystem->clear();
            if (m_currentScreen != NULL)
            {
                ScreenType next = m_currentScreen->openNext();
                if (ScreenType_None == next)
                {
                    m_currentScreen->render(m_renderSystem, m_world);
                    m_currentScreen->update(deltaTime, m_world);
                }
                else
                {
                    setScreen(next);
                }
            }
            else
            {
                char buffer[SCREEN_WIDTH];
                int length = sprintf_s(buffer, "SCREEN NOT SET!");
                int x = SCREEN_WIDTH / 2 - length / 2;
                m_renderSystem->drawText(x, SCREEN_HEIGHT / 2, buffer, ConsoleColor_Grey, ConsoleColor_Black);
            }
            m_world->postUpdate(deltaTime);

            char buffer[SCREEN_WIDTH];
            int length = sprintf_s(buffer, "FPS: %d", getFps());
            m_renderSystem->drawText(SCREEN_WIDTH - length, 0, buffer, ConsoleColor_Grey, ConsoleColor_Black);
            m_renderSystem->flush();
        }
    }
Beispiel #11
0
HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer, QScreen *screen)
    : m_colorIndex(0), m_renderer(renderer)
{
    setSurfaceType(QWindow::OpenGLSurface);
    setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);

    setGeometry(QRect(10, 10, 640, 480));

    setFormat(renderer->format());
    if (screen)
        setScreen(screen);

    create();

    updateColor();
}
Beispiel #12
0
UISystem::UISystem()
    : m_renderer(nullptr)
    , m_root(nullptr)
    , m_focus(nullptr)
    , m_screen()
{
    s_inst = this;

    m_renderer = CreateUIRenderer();
    m_wmhandler = std::bind(&UISystem::handleWindowMessage, this, std::placeholders::_1);

    ist::Application *app = istGetAplication();
    uvec2 wsize = app->getWindowSize();
    app->addMessageHandler(&m_wmhandler);
    setScreen((float32)wsize.x, (float32)wsize.y);
}
Beispiel #13
0
void PanelWindow::readSettings()
{
    setFontName(Settings::value(m_id, "fontName", "default").toString());
    setScreen(Settings::value(m_id, "screen", 0).toInt());

    PanelWindow::Anchor m_verticalAnchor;
    QString verticalPosition = Settings::value(m_id, "verticalPosition", "Bottom").toString();
    if(verticalPosition == "Top")
        m_verticalAnchor = PanelWindow::Min;
    else if(verticalPosition == "Bottom")
        m_verticalAnchor = PanelWindow::Max;

    setVerticalAnchor(m_verticalAnchor);

    m_appletnames = Settings::value(m_id, "applets", QStringList() ).toStringList();

    setApplets();
}
Beispiel #14
0
void
Amarok::OSD::applySettings()
{
    DEBUG_BLOCK

    setAlignment( static_cast<OSDWidget::Alignment>( AmarokConfig::osdAlignment() ) );
    setDuration( AmarokConfig::osdDuration() );
    setEnabled( AmarokConfig::osdEnabled() );
    setOffset( AmarokConfig::osdYOffset() );
    setScreen( AmarokConfig::osdScreen() );
    setFont( AmarokConfig::osdFont() );

    if( AmarokConfig::osdUseCustomColors() )
        setTextColor( AmarokConfig::osdTextColor() );
    else
        unsetColors();

    setTranslucent( AmarokConfig::osdUseTranslucency() );
}
Beispiel #15
0
WindowPaintData::WindowPaintData(const WindowPaintData &other)
    : PaintData()
    , quads(other.quads)
    , shader(other.shader)
    , d(new WindowPaintDataPrivate())
{
    setXScale(other.xScale());
    setYScale(other.yScale());
    setZScale(other.zScale());
    translate(other.translation());
    setRotationOrigin(other.rotationOrigin());
    setRotationAxis(other.rotationAxis());
    setRotationAngle(other.rotationAngle());
    setOpacity(other.opacity());
    setDecorationOpacity(other.decorationOpacity());
    setSaturation(other.saturation());
    setBrightness(other.brightness());
    setScreen(other.screen());
    setCrossFadeProgress(other.crossFadeProgress());
}
Beispiel #16
0
WindowPaintData::WindowPaintData(const WindowPaintData &other)
    : PaintData()
    , quads(other.quads)
    , shader(other.shader)
    , d(new WindowPaintDataPrivate())
{
    setXScale(other.xScale());
    setYScale(other.yScale());
    setZScale(other.zScale());
    translate(other.translation());
    setRotationOrigin(other.rotationOrigin());
    setRotationAxis(other.rotationAxis());
    setRotationAngle(other.rotationAngle());
    setOpacity(other.opacity());
    setSaturation(other.saturation());
    setBrightness(other.brightness());
    setScreen(other.screen());
    setCrossFadeProgress(other.crossFadeProgress());
    setProjectionMatrix(other.projectionMatrix());
    setModelViewMatrix(other.modelViewMatrix());
    d->screenProjectionMatrix = other.d->screenProjectionMatrix;
}
Beispiel #17
0
void
OSDPreviewWidget::mouseReleaseEvent( QMouseEvent * /*event*/ )
{
    if( m_dragging )
    {
        m_dragging = false;
        releaseMouse();

        // compute current Position && offset
        QDesktopWidget *desktop = QApplication::desktop();
        int currentScreen = desktop->screenNumber( pos() );

        if( currentScreen != -1 )
        {
            // set new data
            setScreen( currentScreen );
            setOffset( QWidget::y() );

            emit positionChanged();
        }
    }
}
Beispiel #18
0
/*!
    \reimp
*/
bool QTransformedScreen::connect(const QString &displaySpec)
{
    QString dspec = displaySpec.trimmed();
    if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive))
        dspec = dspec.mid(QString::fromLatin1("Transformed:").size());
    else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive))
        dspec = QString();

    const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
    if (dspec.endsWith(displayIdSpec))
        dspec = dspec.left(dspec.size() - displayIdSpec.size());

    d_ptr->transformation = filterTransformation(dspec);

    QString driver = dspec;
    int colon = driver.indexOf(QLatin1Char(':'));
    if (colon >= 0)
        driver.truncate(colon);

    if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive))
        if (!dspec.isEmpty())
            dspec.prepend(QLatin1Char(':'));

    const int id = getDisplayId(dspec);
    QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
    setScreen(s);

#ifdef QT_QWS_DEPTH_GENERIC
    d_ptr->doGenericColors = dspec.contains(QLatin1String("genericcolors"));
#endif

    d_ptr->configure();

    // XXX
    qt_screen = this;

    return true;
}
Beispiel #19
0
Panel::Panel(QScreen *screen, Element *elm)
     : QQuickWindow()
     , m_element(elm)
{
    elm->setParentItem(contentItem());
    setScreen(screen);
    setWidth(elm->width());
    setHeight(elm->height());
    setColor(Qt::transparent);
    setFlags(Qt::BypassWindowManagerHint);
    show();
    create();

    Client::client()->setInputRegion(this, elm->inputRegion());
    m_panel = Client::client()->setPanel(this, screen, (int)elm->location());
    desktop_shell_panel_add_listener(m_panel, &s_listener, this);

    connect(elm, &Element::published, this, &Panel::move);
    connect(elm, &QQuickItem::widthChanged, [this]() { setWidth(m_element->width()); });
    connect(elm, &QQuickItem::heightChanged, [this]() { setHeight(m_element->height()); });
    connect(elm, &Element::inputRegionChanged, [this]() { Client::client()->setInputRegion(this, m_element->inputRegion()); });
    connect(screen, &QObject::destroyed, [this]() { delete this; });
}
Beispiel #20
0
QT_BEGIN_NAMESPACE

QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context)
    : QPlatformWindow(window),
      m_screenContext(context),
      m_window(0),
      m_currentBufferIndex(-1),
      m_previousBufferIndex(-1),
#if !defined(QT_NO_OPENGL)
      m_platformOpenGLContext(0),
#endif
      m_screen(0),
      m_parentWindow(0),
      m_visible(true),
      m_windowState(Qt::WindowNoState),
      m_requestedBufferSize(window->geometry().size())
{
    qWindowDebug() << Q_FUNC_INFO << "window =" << window << ", size =" << window->size();
    int result;

    // Create child QNX window
    errno = 0;
    result = screen_create_window_type(&m_window, m_screenContext, SCREEN_CHILD_WINDOW);
    if (result != 0)
        qFatal("QQnxWindow: failed to create window, errno=%d", errno);

    // Set window buffer usage based on rendering API
    int val;
    QSurface::SurfaceType surfaceType = window->surfaceType();
    switch (surfaceType) {
    case QSurface::RasterSurface:
        val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;
        break;
    case QSurface::OpenGLSurface:
        val = SCREEN_USAGE_OPENGL_ES2;
        break;
    default:
        qFatal("QQnxWindow: unsupported window API");
        break;
    }

    errno = 0;
    result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_USAGE, &val);
    if (result != 0)
        qFatal("QQnxWindow: failed to set window buffer usage, errno=%d", errno);

    // Alpha channel is always pre-multiplied if present
    errno = 0;
    val = SCREEN_PRE_MULTIPLIED_ALPHA;
    result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_ALPHA_MODE, &val);
    if (result != 0)
        qFatal("QQnxWindow: failed to set window alpha mode, errno=%d", errno);

    // Make the window opaque
    errno = 0;
    val = SCREEN_TRANSPARENCY_NONE;
    result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
    if (result != 0)
        qFatal("QQnxWindow: failed to set window transparency, errno=%d", errno);

    // Set the window swap interval
    errno = 0;
    val = 1;
    result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SWAP_INTERVAL, &val);
    if (result != 0)
        qFatal("QQnxWindow: failed to set window swap interval, errno=%d", errno);

    if (window->flags() && Qt::WindowDoesNotAcceptFocus) {
        errno = 0;
        val = SCREEN_SENSITIVITY_NO_FOCUS;
        result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SENSITIVITY, &val);
        if (result != 0)
            qFatal("QQnxWindow: failed to set window sensitivity, errno=%d", errno);
    }

    setScreen(static_cast<QQnxScreen *>(window->screen()->handle()));

    // Add window to plugin's window mapper
    QQnxIntegration::addWindow(m_window, window);

    // Qt never calls these setters after creating the window, so we need to do that ourselves here
    setWindowState(window->windowState());
    if (window->parent() && window->parent()->handle())
        setParent(window->parent()->handle());
    setGeometryHelper(window->geometry());
    setVisible(window->isVisible());
}
Beispiel #21
0
View::View(QWindow *)
    : PlasmaQuick::Dialog(),
      m_offset(.5),
      m_floating(false)
{
    setClearBeforeRendering(true);
    setColor(QColor(Qt::transparent));
    setFlags(Qt::FramelessWindowHint);

    KCrash::setFlags(KCrash::AutoRestart);

    m_config = KConfigGroup(KSharedConfig::openConfig(QStringLiteral("krunnerrc")), "General");

    setFreeFloating(m_config.readEntry("FreeFloating", false));
    reloadConfig();

    new AppAdaptor(this);
    QDBusConnection::sessionBus().registerObject(QStringLiteral("/App"), this);

    if (KAuthorized::authorize(QStringLiteral("run_command"))) {
        QAction *a = new QAction(0);
        QObject::connect(a, &QAction::triggered, this, &View::displayOrHide);
        a->setText(i18n("Run Command"));
        a->setObjectName(QStringLiteral("run command"));
        KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space), KGlobalAccel::NoAutoloading);
        KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT + Qt::Key_Space) << QKeySequence(Qt::ALT + Qt::Key_F2) << Qt::Key_Search);

        a = new QAction(0);
        QObject::connect(a, &QAction::triggered, this, &View::displayWithClipboardContents);
        a->setText(i18n("Run Command on clipboard contents"));
        a->setObjectName(QStringLiteral("run command on clipboard contents"));
        KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2));
        KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_F2));
    }

    m_qmlObj = new KDeclarative::QmlObject(this);
    m_qmlObj->setInitializationDelayed(true);
    connect(m_qmlObj, &KDeclarative::QmlObject::finished, this, &View::objectIncubated);

    KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
    KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE");
    const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
    if (!packageName.isEmpty()) {
        package.setPath(packageName);
    }

    m_qmlObj->setSource(QUrl::fromLocalFile(package.filePath("runcommandmainscript")));
    m_qmlObj->engine()->rootContext()->setContextProperty(QStringLiteral("runnerWindow"), this);
    m_qmlObj->completeInitialization();

    auto screenRemoved = [=](QScreen* screen) {
        if (screen == this->screen()) {
            setScreen(qGuiApp->primaryScreen());
            hide();
        }
    };

    auto screenAdded = [=](QScreen* screen) {
        connect(screen, &QScreen::geometryChanged, this, &View::screenGeometryChanged);
        screenGeometryChanged();
    };

    foreach(QScreen* s, QGuiApplication::screens())
        screenAdded(s);
    connect(qApp, &QGuiApplication::screenAdded, this, screenAdded);
    connect(qApp, &QGuiApplication::screenRemoved, this, screenRemoved);

    connect(KWindowSystem::self(), &KWindowSystem::workAreaChanged, this, &View::resetScreenPos);

    connect(this, &View::visibleChanged, this, &View::resetScreenPos);

    KDirWatch::self()->addFile(m_config.name());

    // Catch both, direct changes to the config file ...
    connect(KDirWatch::self(), &KDirWatch::dirty, this, &View::reloadConfig);
    connect(KDirWatch::self(), &KDirWatch::created, this, &View::reloadConfig);

    if (m_qmlObj->rootObject()) {
        connect(m_qmlObj->rootObject(), SIGNAL(widthChanged()), this, SLOT(resetScreenPos()));
    }

    if (m_floating) {
        setLocation(Plasma::Types::Floating);
    } else {
        setLocation(Plasma::Types::TopEdge);
    }

    connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &View::slotFocusWindowChanged);
}
Beispiel #22
0
Camera::Camera(const CameraOptions &options) :
	_options(options),
	_viewMatrix(),
	_projectionMatrix(),
    _frustumInvalid(true),
	_frustum(),
	_moveMode(CameraMovementMode::Player),

	_turnMode(_options.turnMode),
	_turnTime(DEFAULT_TURN_TIME),

	_position(),
	_ori(),

	_trackPos(),
	_trackLevel(0.0f),

	_zoom(CAM_ZOOM_AVG),
	_center{0, 0, 0},
	_zadd(CAM_ZADD_AVG),
	_zaddGoto(CAM_ZADD_AVG),
	_zGoto(CAM_ZADD_AVG),

	_turnZ_radians(-Ego::Math::piOverFour<float>()),
	_turnZ_turns(RadiansToTurns(_turnZ_radians)),
	_turnZAdd(0.0f),
	_turnZSustain(0.60f),	

	_forward{0, 0, 0},
	_up{0, 0, 0},
	_right{0, 0, 0},

	// Special effects.
	_motionBlur(0.0f),
	_motionBlurOld(0.0f),
	_swing(_options.swing),
	_swingRate(_options.swingRate),
	_swingAmp(_options.swingAmp),
	_roll(0.0f),

    // Extended camera data.
    _trackList(),
    _screen(),
    _lastFrame(-1),
    _tileList(nullptr),
    _entityList(nullptr)
{
    // Derived values.
	_trackPos = _center;
    _position = _center + Vector3f(_zoom * std::sin(_turnZ_radians), _zoom * std::cos(_turnZ_radians), CAM_ZADD_MAX);

    _turnZ_turns = RadiansToTurns( _turnZ_radians );
    _ori.facing_z = TurnsToFacing( _turnZ_turns ) ;

    resetView();

    // Get renderlist manager pointer.
    renderlist_mgr_t *rmgr_ptr = gfx_system_get_renderlist_mgr();
    if (!rmgr_ptr)
    {
        throw std::runtime_error("failed to get renderlist manager");
    }

    // Get dolist manager pointer.
    dolist_mgr_t *dmgr_ptr = gfx_system_get_dolist_mgr();
    if (!dmgr_ptr)
    {
        throw std::runtime_error("failed to get dolist manager");
    }

    // Lock a tile list for this camera.
    _tileList = rmgr_ptr->acquire();
    // Connect the tile list to the mesh.
    _tileList->setMesh(_currentModule->getMeshPointer());

    // Lock an entity list for this camera.
    _entityList = dmgr_ptr->acquire();

    // Assume that the camera is fullscreen.
    setScreen(0, 0, sdl_scr.x, sdl_scr.y);
}
Beispiel #23
0
bool Video::loadXML(QXmlStreamReader &root)
{
    if (root.name() != KXMLQLCFunction)
    {
        qWarning() << Q_FUNC_INFO << "Function node not found";
        return false;
    }

    if (root.attributes().value(KXMLQLCFunctionType).toString() != typeToString(Function::Video))
    {
        qWarning() << Q_FUNC_INFO << root.attributes().value(KXMLQLCFunctionType).toString()
                   << "is not Video";
        return false;
    }

    QString fname = name();

    while (root.readNextStartElement())
    {
        if (root.name() == KXMLQLCVideoSource)
        {
            QXmlStreamAttributes attrs = root.attributes();
            if (attrs.hasAttribute(KXMLQLCVideoStartTime))
                setStartTime(attrs.value(KXMLQLCVideoStartTime).toString().toUInt());
            if (attrs.hasAttribute(KXMLQLCVideoColor))
                setColor(QColor(attrs.value(KXMLQLCVideoColor).toString()));
            if (attrs.hasAttribute(KXMLQLCVideoLocked))
                setLocked(true);
            if (attrs.hasAttribute(KXMLQLCVideoScreen))
                setScreen(attrs.value(KXMLQLCVideoScreen).toString().toInt());
            if (attrs.hasAttribute(KXMLQLCVideoFullscreen))
            {
                if (attrs.value(KXMLQLCVideoFullscreen).toString() == "1")
                    setFullscreen(true);
                else
                    setFullscreen(false);
            }
            QString path = root.readElementText();
            if (path.contains("://") == true)
                setSourceUrl(path);
            else
                setSourceUrl(m_doc->denormalizeComponentPath(path));
        }
        else if (root.name() == KXMLQLCFunctionSpeed)
        {
            loadXMLSpeed(root);
        }
        else if (root.name() == KXMLQLCFunctionRunOrder)
        {
            loadXMLRunOrder(root);
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Video tag:" << root.name();
            root.skipCurrentElement();
        }
    }

    setName(fname);

    return true;
}
Beispiel #24
0
void EasyDrawState::setScreen(float32 width, float32 height)
{
    setScreen(0.0f, width, height, 0.0f);
}
Beispiel #25
0
KSMShutdownDlg::KSMShutdownDlg( QWindow* parent,
                                bool maysd, bool choose, KWorkSpace::ShutdownType sdtype,
                                const QString& theme)
  : QQuickView(parent),
    m_result(false)
    // this is a WType_Popup on purpose. Do not change that! Not
    // having a popup here has severe side effects.
{
    // window stuff
    setClearBeforeRendering(true);
    setColor(QColor(Qt::transparent));
    setFlags(Qt::FramelessWindowHint | Qt::BypassWindowManagerHint);

    QPoint globalPosition(QCursor::pos());
    foreach (QScreen *s, QGuiApplication::screens()) {
        if (s->geometry().contains(globalPosition)) {
            setScreen(s);
            break;
        }
    }


    // Qt doesn't set this on unmanaged windows
    //FIXME: or does it?
    XChangeProperty( QX11Info::display(), winId(),
        XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace,
        (unsigned char *)"logoutdialog", strlen( "logoutdialog" ));


    //QQuickView *windowContainer = QQuickView::createWindowContainer(m_view, this);
    //windowContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    QQmlContext *context = rootContext();
    context->setContextProperty(QStringLiteral("maysd"), maysd);
    context->setContextProperty(QStringLiteral("choose"), choose);
    context->setContextProperty(QStringLiteral("sdtype"), sdtype);

    QQmlPropertyMap *mapShutdownType = new QQmlPropertyMap(this);
    mapShutdownType->insert(QStringLiteral("ShutdownTypeDefault"), QVariant::fromValue<int>(KWorkSpace::ShutdownTypeDefault));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeNone"), QVariant::fromValue<int>(KWorkSpace::ShutdownTypeNone));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeReboot"), QVariant::fromValue<int>(KWorkSpace::ShutdownTypeReboot));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeHalt"), QVariant::fromValue<int>(KWorkSpace::ShutdownTypeHalt));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeLogout"), QVariant::fromValue<int>(KWorkSpace::ShutdownTypeLogout));
    context->setContextProperty(QStringLiteral("ShutdownType"), mapShutdownType);

    QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this);
    QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates();
    mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState)));
    mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState)));
    mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState)));
    context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods);

    QString bootManager = KConfig(QStringLiteral(KDE_CONFDIR "/kdm/kdmrc"), KConfig::SimpleConfig)
                          .group("Shutdown")
                          .readEntry("BootManager", "None");
    context->setContextProperty(QStringLiteral("bootManager"), bootManager);

    QStringList options;
    int def, cur;
    if ( KDisplayManager().bootOptions( rebootOptions, def, cur ) ) {
        if ( cur > -1 ) {
            def = cur;
        }
    }
    QQmlPropertyMap *rebootOptionsMap = new QQmlPropertyMap(this);
    rebootOptionsMap->insert(QStringLiteral("options"), QVariant::fromValue(rebootOptions));
    rebootOptionsMap->insert(QStringLiteral("default"), QVariant::fromValue(def));
    context->setContextProperty(QStringLiteral("rebootOptions"), rebootOptionsMap);
    context->setContextProperty(QStringLiteral("screenGeometry"), screen()->geometry());

    setModality(Qt::ApplicationModal);

    // engine stuff
    KDeclarative::KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(engine());
    kdeclarative.initialize();
    kdeclarative.setupBindings();
//    windowContainer->installEventFilter(this);

    QString fileName;
    if(theme.isEmpty()) {
        KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"));
        KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE");
        const QString packageName = cg.readEntry("LookAndFeelPackage", QString());
        if (!packageName.isEmpty()) {
            package.setPath(packageName);
        }

        fileName = package.filePath("logoutmainscript");
    } else
        fileName = theme;

    if (QFile::exists(fileName)) {
        //qCDebug(KSMSERVER) << "Using QML theme" << fileName;
        setSource(QUrl::fromLocalFile(fileName));
    } else {
        qWarning() << "Couldn't find a theme for the Shutdown dialog" << fileName;
        return;
    }

    setPosition(screen()->virtualGeometry().center().x() - width() / 2,
                screen()->virtualGeometry().center().y() - height() / 2);

    if(!errors().isEmpty()) {
        qWarning() << errors();
    }

    connect(rootObject(), SIGNAL(logoutRequested()), SLOT(slotLogout()));
    connect(rootObject(), SIGNAL(haltRequested()), SLOT(slotHalt()));
    connect(rootObject(), SIGNAL(suspendRequested(int)), SLOT(slotSuspend(int)) );
    connect(rootObject(), SIGNAL(rebootRequested()), SLOT(slotReboot()));
    connect(rootObject(), SIGNAL(rebootRequested2(int)), SLOT(slotReboot(int)) );
    connect(rootObject(), SIGNAL(cancelRequested()), SLOT(reject()));
    connect(rootObject(), SIGNAL(lockScreenRequested()), SLOT(slotLockScreen()));

    show();
    requestActivate();

    KWindowSystem::setState(winId(), NET::SkipTaskbar|NET::SkipPager);
}
Beispiel #26
0
void Engine::init() {
	game = new Game();
	setScreen(game);
}
Beispiel #27
0
static void
selectScreen (void) {
  setScreen(activeScreens);
}
Beispiel #28
0
static void
activateScreen (ActiveScreen which) {
  activeScreens |= which;
  setScreen(which);
}
Beispiel #29
0
void Animation::reshapeFunc(int w, int h) {
	setScreen(w, h);
}
void ScheduleManager::registerSchedule()
{
	enum ScheduleManagerFunction
	{
		SET_SCREEN = 1,
		SET_DATE,
		SET_MOVIE,
		SET_TIME,
		REGISTER_SCHEDULE,
	};

	for (Schedule schedule;;)
	{
		system("cls");
		cout <<
			"극장 관리 시스템\n"
			" > 상영 일정 관리\n"
			"  > 상영 일정 등록\n"
			"\n";

		if (0 != schedule.screen.getNumber()
			|| 0 != schedule.date.getValue()
			|| 0 != schedule.movie.getCode()
			|| 0 != schedule.getStartTime())
		{
			cout << "새 스케쥴\n";
			if (0 != schedule.screen.getNumber())
			{
				schedule.screen.show();
			}
			if (0 != schedule.date.getValue())
			{
				schedule.date.show();
			}
			if (0 != schedule.movie.getCode())
			{
				schedule.movie.show();
			}
			if (0 != schedule.getStartTime())
			{
				schedule.showTime();
			}
			cout << endl;
		}
				
		cout <<
			"1. 상영관 설정\n"
			"2. 날짜 설정\n"
			"3. 영화 설정\n"
			"4. 시간 설정\n"
			"5. 새 스케쥴 등록\n"
			"0. 종료\n"
			"\n"
			"선택: ";

		int32_t function = 0;
		switch (inputPositiveInteger(function))
		{
		case FUNCTION_CANCEL:
			return;
		case FUNCTION_ERROR:
			cout << "\n잘못된 입력입니다.\n";
			system("pause");
			continue;
		case FUNCTION_SUCCESS:
			switch (function)
			{
			case SET_SCREEN:
				setScreen(schedule.screen);
				continue;
			case SET_DATE:
				setDate(schedule.date);
				continue;
			case SET_MOVIE:
				setMovie(schedule.movie);
				continue;
			case SET_TIME:
				cout << endl;
				if (0 == schedule.screen.getNumber())
				{
					cout << "상영관을 선택하지 않았습니다.\n";
				}
				else if (0 == schedule.date.getValue())
				{
					cout << "상영일을 선택하지 않았습니다.\n";
				}
				else if (0 == schedule.movie.getCode())
				{
					cout << "영화를 선택하지 않았습니다.\n";
				}
				else
				{
					setTime(schedule);
					continue;
				}
				system("pause");
				continue;
			case REGISTER_SCHEDULE:
				if (0 == schedule.getStartTime())
				{
					cout << "\n상영 시간을 입력하지 않았습니다.\n";
					system("pause");
					continue;
				}
			}
		}

		SQLWCHAR scheduleSql[BUFSIZ];
		swprintf_s(scheduleSql, L""
			"INSERT INTO d%d "
			"(movie_code, movie_title, age, start_time, end_time, screen) "
			"VALUES (?, ?, ?, ?, ?, ?);",
			schedule.date.getValue());
		SQLWCHAR seatSql[BUFSIZ];
		swprintf_s(seatSql, L"SELECT * INTO d%ds%dt%d FROM screen%d;",
			schedule.date.getValue(), schedule.screen.getNumber(), schedule.getStartTime(),
			schedule.screen.getNumber());

		if (SQL_SUCCESS == schedule.bindParameter()
			&& SQL_SUCCESS == schedule.execute(MDF_SCHEDULE, scheduleSql)
			&& SQL_SUCCESS == schedule.execute(MDF_SEAT, seatSql))
		{
			schedule.initialize();
			cout << "\n상영 일정이 등록 되었습니다.\n";
		}
		else
		{
			cout << "\n상영 일정 등록을 실패했습니다.\n";
		}
		system("pause");
	}
}