Ejemplo n.º 1
0
void BackgroundManager::refresh()
{
    const qint64 dId = dialogId();
    if(!dId)
    {
        p->background = QUrl();
        Q_EMIT backgroundChanged();
        return;
    }

    QString filePath;
    const QString dIdStr = QString::number(dId);
    const QStringList &files = QDir(p->directory.toLocalFile()).entryList(QDir::Files);
    Q_FOREACH(const QString &f, files)
    {
        const QString path = p->directory.toLocalFile() + "/" + f;
        QFileInfo info(path);
        if(info.baseName() != dIdStr)
            continue;

        filePath = path;
        break;
    }

    p->background = filePath.isEmpty()? QUrl() : QUrl::fromLocalFile(filePath);
    Q_EMIT backgroundChanged();
}
Ejemplo n.º 2
0
void BackgroundManager::setBackground(const QString &filePath)
{
    const qint64 dId = dialogId();
    if(!dId)
    {
        p->background = QUrl();
        Q_EMIT backgroundChanged();
        return;
    }

    const QString dIdStr = QString::number(dId);
    const QStringList &files = QDir(p->directory.toLocalFile()).entryList(QDir::Files);
    Q_FOREACH(const QString &f, files)
    {
        const QString path = p->directory.toLocalFile() + "/" + f;
        QFileInfo info(path);
        if(info.baseName() != dIdStr)
            continue;

        QFile::remove(path);
    }

    if(!filePath.isEmpty())
    {
        QFileInfo inf(filePath);
        QFile::copy(filePath, p->directory.toLocalFile() + "/" + dIdStr + "." + inf.suffix());
    }

    refresh();
}
Ejemplo n.º 3
0
/**
 * Initializes the main window object
 * Updates preferences
 * Checks whether database tables are exists
 * Adds a context menu and sets accepted drops
 * Moreover, registers signals and slots
 * @param parent Pointer to the super class of objects
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->setCentralWidget(ui->textEdit_mainWindow_surface);

    updatePreferences();

    db.transaction();
    query.prepare("CREATE TABLE IF NOT EXISTS `password` ( "
                  "`PasswordID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
                  "`Password` TEXT NOT NULL UNIQUE );");
    if ( query.exec() ) {
        db.commit();
        qDebug() << "The table of the database exists";
    } else {
        db.rollback();
        qDebug() << "The table of the database does not exist";
        qDebug() << query.lastError();
    }

    addContextMenu();

    ui->textEdit_mainWindow_surface->setAcceptDrops(false);
    setAcceptDrops(true);

    connect(this, SIGNAL(backgroundChanged()), this, SLOT(updatePreferences()));
}
Ejemplo n.º 4
0
/**
 * Foreground and background colors switch places and signals are emitted.
 */
void DualColorButton::swapColors()
{
	const QColor tmp = foreground_;
	foreground_ = background_;
	background_ = tmp;
	emit foregroundChanged(foreground_);
	emit backgroundChanged(background_);
	update();
}
Ejemplo n.º 5
0
void Cutegram::setBackground(const QString &background)
{
    if(p->background == background)
        return;

    p->background = background;
    AsemanApplication::settings()->setValue("General/background", background);
    emit backgroundChanged();
}
Ejemplo n.º 6
0
void TelegramGui::setBackground(const QString &path)
{
    if( path == p->background )
        return;

    p->background = path;
    tg_settings->setValue( "General/background", p->background );
    emit backgroundChanged();
}
Ejemplo n.º 7
0
void DualColorButton::dropEvent(QDropEvent *event)
{
	const QColor color = qvariant_cast<QColor>(event->mimeData()->colorData());
	if(foregroundRect().contains(event->pos())) {
		foreground_ = color;
		emit foregroundChanged(color);
	} else if(backgroundRect().contains(event->pos())) {
		background_ = color;
		emit backgroundChanged(color);
	}
	update();
}
Ejemplo n.º 8
0
/**
 * Sets the background color with a dialog
 */
void MainWindow::on_actionBackground_triggered()
{
    QPalette* palette = new QPalette();
    color = QColorDialog::getColor(Qt::white, this);

    QSettings setting("rk", "scribo");
    setting.beginGroup("writing");
    setting.setValue( "red", color.red() );
    setting.setValue( "green", color.green() );
    setting.setValue( "blue", color.blue() );
    setting.endGroup();

    emit backgroundChanged();
}
bool DeclarativeWebContainer::activatePage(int tabId, bool force, int parentId)
{
    if (!m_model) {
        return false;
    }

    m_webPages->initialize(this, m_webPageComponent.data());
    if ((m_model->loaded() || force) && tabId > 0 && m_webPages->initialized()) {
        WebPageActivationData activationData = m_webPages->page(tabId, parentId);
        setWebPage(activationData.webPage);
        // Reset always height so that orentation change is taken into account.
        m_webPage->forceChrome(false);
        m_webPage->setChrome(true);
        connect(m_webPage, SIGNAL(imeNotification(int,bool,int,int,QString)),
                this, SLOT(imeNotificationChanged(int,bool,int,int,QString)), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(windowCloseRequested()), this, SLOT(closeWindow()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(urlChanged()), this, SLOT(onPageUrlChanged()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(loadingChanged()), this, SLOT(updateLoading()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(loadProgressChanged()), this, SLOT(updateLoadProgress()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(titleChanged()), this, SLOT(onPageTitleChanged()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(domContentLoadedChanged()), this, SLOT(sendVkbOpenCompositionMetrics()), Qt::UniqueConnection);
        connect(m_webPage, SIGNAL(backgroundChanged()), this, SIGNAL(backgroundChanged()), Qt::UniqueConnection);
        return activationData.activated;
    }
Ejemplo n.º 10
0
void QQuickTextField::setBackground(QQuickItem *background)
{
    Q_D(QQuickTextField);
    if (d->background != background) {
        delete d->background;
        d->background = background;
        if (background) {
            background->setParentItem(this);
            if (qFuzzyIsNull(background->z()))
                background->setZ(-1);
            if (isComponentComplete())
                d->resizeBackground();
        }
        emit backgroundChanged();
    }
}
Ejemplo n.º 11
0
void DualColorButton::mouseReleaseEvent(QMouseEvent *event)
{
	if(event->button() != Qt::LeftButton)
		return;
	QRectF fgr = foregroundRect();
	QRectF bgr = backgroundRect();
	if(fgr.contains(event->pos()))
		emit foregroundClicked(foreground_);
	else if(bgr.contains(event->pos()))
		emit backgroundClicked(background_);
	else if(event->pos().x() > fgr.right() && event->pos().y() < bgr.top())
		swapColors();
	else if(event->pos().x() < bgr.left() && event->pos().y() > fgr.bottom()) {
		foreground_ = Qt::black;
		background_ = Qt::white;
		emit foregroundChanged(foreground_);
		emit backgroundChanged(background_);
		update();
	}
}
Ejemplo n.º 12
0
void ScreenieControl::frenchConnection()
{
    connect(&d->screenieScene, SIGNAL(distanceChanged()),
            this, SLOT(handleDistanceChanged()));
    connect(&d->screenieScene, SIGNAL(modelAdded(ScreenieModelInterface &)),
            this, SLOT(handleModelAdded(ScreenieModelInterface &)));
    connect(&d->screenieScene, SIGNAL(modelRemoved(ScreenieModelInterface &)),
            this, SLOT(handleModelRemoved(ScreenieModelInterface &)));
    connect(&d->screenieScene, SIGNAL(backgroundChanged()),
            this, SLOT(handleBackgroundChanged()));
    connect(&d->screenieGraphicsScene, SIGNAL(imagesDropped(QList<QImage>, QPointF)),
            this, SLOT(handleImageDrop(QList<QImage>, QPointF)));
    connect(&d->screenieGraphicsScene, SIGNAL(filePathsDropped(QStringList, QPointF)),
            this, SLOT(handleFilePathsDrop(QStringList, QPointF)));
    connect(&d->screenieGraphicsScene, SIGNAL(rotate(int)),
            this, SLOT(rotate(int)));
    connect(&d->screenieGraphicsScene, SIGNAL(addDistance(qreal)),
            this, SLOT(addDistance(qreal)));
    connect(&d->screenieGraphicsScene, SIGNAL(translate(qreal, qreal)),
            this, SLOT(translate(qreal, qreal)));
    connect(&d->qualityTimer, SIGNAL(timeout()),
            this, SLOT(restoreRenderQuality()));
}
void MusicBackgroundManager::addObserver(QObject *object)
{
    m_observer << object;
    connect(this, SIGNAL(backgroundChanged()), object, SLOT(backgroundChanged()));
}
void MusicBackgroundManager::backgroundHasChanged()
{
    emit backgroundChanged();
}
Ejemplo n.º 15
0
void PaintWidget::updateAllViews( QWidget *from )
{
	emit backgroundChanged( from );
}
Ejemplo n.º 16
0
void BackgroundAction::emitBackgroundChanged(int index)
{
    if (index < colors().count())
        emit backgroundChanged(colors().at(index));
}
Ejemplo n.º 17
0
void MyFracWindow::selectBackground(const QColor& color)
{
	_backgroundColor = color;
	emit backgroundChanged(_backgroundColor.rgb());
}
Ejemplo n.º 18
0
/**
 * The backgroundColorChanged signal is emitted
 * @param c color to set
 */
void DualColorButton::setBackground(const QColor &c)
{
	background_ = c;
	emit backgroundChanged(c);
	update();
}
Ejemplo n.º 19
0
void MyFracWindow::createWidgets()
{
	KDockWidget* dockMain = createDockWidget("main", NULL);
	_tabWidget = new QTabWidget(dockMain);
	dockMain->setWidget(_tabWidget);

	_view2D = new ViewWidget(true, _tabWidget);
	_tabWidget->addTab(_view2D, SmallIconSet("frtab2d"), i18n("2D View"));

	_view3D = new View3DWidget(_tabWidget);
	_tabWidget->addTab(_view3D, SmallIconSet("frtab3d"), i18n("3D View"));

	_dockParams = createDockWidget("params", SmallIcon("frparams"), NULL,
		i18n("Parameters"));
	QWidget* params = createParamsDock(_dockParams);
	_dockParams->setWidget(params);

	_dockDisplay = createDockWidget("display", SmallIcon("frdisplay"), NULL,
		i18n("Display"));
	QWidget* display = createDisplayDock(_dockParams);
	_dockDisplay->setWidget(display);

	_dockPreview = createDockWidget("preview", SmallIcon("viewmag"), NULL, i18n("Preview"));
	ViewWidget* preview = new ViewWidget(false, _dockPreview);
	_dockPreview->setWidget(preview);

	dockMain->setDockSite(KDockWidget::DockCorner);
	dockMain->setEnableDocking(KDockWidget::DockNone);
	setView(dockMain);
	setMainDockWidget(dockMain);

	KDockWidget* dock1 = _dockDisplay->manualDock(_dockParams, KDockWidget::DockCenter);
	KDockWidget* dock2 = _dockPreview->manualDock(dock1, KDockWidget::DockBottom, 65);
	dock2->manualDock(dockMain, KDockWidget::DockRight, 65);

	connect(_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(tabChanged()));

	connect(this, SIGNAL(view2DEnabled(bool)), _view2D, SLOT(setVisible(bool)));
	connect(this, SIGNAL(view3DEnabled(bool)), _view3D, SLOT(setVisible(bool)));
	connect(this, SIGNAL(previewEnabled(bool)), _view2D, SLOT(enablePreview(bool)));

	connect(this, SIGNAL(positionChanged(double, double, double, double)), _view2D, SLOT(setPosition(double, double, double, double)));
	connect(this, SIGNAL(positionChanged(double, double, double, double)), _view3D, SLOT(setPosition(double, double, double, double)));
	connect(this, SIGNAL(positionChanged(double, double, double, double)), preview, SLOT(setPreviewPosition(double, double, double, double)));

	connect(this, SIGNAL(modeChangedMandelbrot()), _view2D, SLOT(setMandelbrotMode()));
	connect(this, SIGNAL(modeChangedMandelbrot()), _view3D, SLOT(setMandelbrotMode()));
	connect(this, SIGNAL(modeChangedJulia(double, double)), _view2D, SLOT(setJuliaMode(double, double)));
	connect(this, SIGNAL(modeChangedJulia(double, double)), _view3D, SLOT(setJuliaMode(double, double)));

	connect(this, SIGNAL(precisionChanged(double, double)), _view2D, SLOT(setQuality(double, double)));
	connect(this, SIGNAL(precisionChanged(double, double)), _view3D, SLOT(setQuality(double, double)));
	connect(this, SIGNAL(precisionChanged(double, double)), preview, SLOT(setQuality(double, double)));

	connect(this, SIGNAL(backgroundChanged(QRgb)), _view2D, SLOT(setBackground(QRgb)));
	connect(this, SIGNAL(backgroundChanged(QRgb)), _view3D, SLOT(setBackground(QRgb)));
	connect(this, SIGNAL(backgroundChanged(QRgb)), preview, SLOT(setBackground(QRgb)));

	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view2D, SLOT(setGradient(const QRgb*, double, double)));
	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), _view3D, SLOT(setGradient(const QRgb*, double, double)));
	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), preview, SLOT(setGradient(const QRgb*, double, double)));

	connect(_view2D, SIGNAL(previewVisible(bool)), preview, SLOT(setVisible(bool)));
	connect(_view2D, SIGNAL(previewPosition(double, double)), preview, SLOT(setJuliaMode(double, double)));

	connect(_view2D, SIGNAL(positionChanged(double, double, double, double)), this, SLOT(setPosition(double, double, double, double)));
	connect(_view2D, SIGNAL(previewDoubleClick(double, double)), this, SLOT(setJuliaMode(double, double)));

	connect(this, SIGNAL(gridSizeChanged(int, int)), _view3D, SLOT(setGridSize(int, int)));
	connect(this, SIGNAL(heightScaleChanged(double)), _view3D, SLOT(setHeightScale(double)));

	_view2D->enableTransform(true);

	KStatusBar* status = statusBar();
	status->setSizeGripEnabled(false);

	QProgressBar* progress = new QProgressBar(100, status);
	progress->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	progress->setMaximumHeight(status->sizeHint().height() - 2);
	progress->setMinimumWidth(120);
	progress->setProgress(100);
	status->addWidget(progress, 0, true);

	connect(_view2D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
	connect(_view3D, SIGNAL(updateProgress(int)), progress, SLOT(setProgress(int)));
}
Ejemplo n.º 20
0
ThemeConfig::ThemeConfig(QWidget *parent) :
    QWidget(parent)
{
    mConfig = KSharedConfig::openConfig(SDDM_CONFIG_FILE, KConfig::SimpleConfig);
    
    configUi = new Ui::ThemeConfig();
    configUi->setupUi(this);
    configUi->messageWidget->setVisible(false);

    ThemesModel *model = new ThemesModel(this);
    configUi->themesListView->setModel(model);

    ThemesDelegate *delegate = new ThemesDelegate(configUi->themesListView);
    delegate->setPreviewSize(QSize(128,128));
    configUi->themesListView->setItemDelegate(delegate);
    model->populate();
    connect(this, &ThemeConfig::themesChanged, model, &ThemesModel::populate);

    connect(configUi->themesListView, SIGNAL(activated(QModelIndex)), SLOT(themeSelected(QModelIndex)));
    connect(configUi->themesListView, SIGNAL(clicked(QModelIndex)), SLOT(themeSelected(QModelIndex)));
    connect(configUi->selectBackgroundButton, SIGNAL(imagePathChanged(QString)), SLOT(backgroundChanged(QString)));

    connect(configUi->getNewButton, &QPushButton::clicked, this, &ThemeConfig::getNewStuffClicked);
    connect(configUi->installFromFileButton, &QPushButton::clicked, this, &ThemeConfig::installFromFileClicked);
    connect(configUi->removeThemeButton, &QPushButton::clicked, this, &ThemeConfig::removeThemeClicked);


    prepareInitialTheme();
}
void MusicBackgroundManager::removeObserver(QObject *object)
{
    m_observer.removeAll(object);
    disconnect(this, SIGNAL(backgroundChanged()), object, SLOT(backgroundChanged()));
}
Ejemplo n.º 22
0
	void PlotItem::SetBackground (const QColor& bg)
	{
		SetNewValue (bg, BackgroundColor_, [this] { emit backgroundChanged (); });
	}