コード例 #1
0
ファイル: themechooser.cpp プロジェクト: StefanRoss/mythtv
ThemeUpdateChecker::ThemeUpdateChecker() :
    m_updateTimer(new QTimer(this))
{
    m_mythVersion = MYTH_SOURCE_PATH;

    // FIXME: For now, treat git master the same as svn trunk
    if (m_mythVersion == "master")
        m_mythVersion = "trunk";

    if (m_mythVersion != "trunk")
    {
        m_mythVersion = MYTH_BINARY_VERSION; // Example: 0.25.20101017-1
        m_mythVersion.replace(QRegExp("\\.[0-9]{8,}.*"), "");
    }

    m_infoPackage = gCoreContext->GenMythURL(gCoreContext->GetSetting("MasterServerIP"),
                                             0,
                                             "remotethemes/themes.zip",
                                             "Temp");

    gCoreContext->SaveSetting("ThemeUpdateStatus", "");
                                 
    connect(m_updateTimer, SIGNAL(timeout()), SLOT(checkForUpdate()));
    m_updateTimer->start(60 * 60 * 1000); // Run once an hour

    // Run once 15 seconds from now
    QTimer::singleShot(15 * 1000, this, SLOT(checkForUpdate()));
}
コード例 #2
0
void PresenceSource::onIconNameChanged(const QString& iconName)
{
    setData("AccountIcon", iconName);

    // Required to trigger emission of update signal after changing data
    checkForUpdate();
}
コード例 #3
0
void PresenceSource::onStateChanged(bool state)
{
    setData("Enabled", state);

    // Required to trigger emission of update signal after changing data
    checkForUpdate();
}
コード例 #4
0
void PresenceSource::onAvatarChanged(
        const Tp::Avatar &avatar)
{
    // Update the data of this source
    // Is the data empty?
    if (avatar.avatarData.isEmpty()) {
        // Set an empty string
        setData("AccountAvatar", "");
    } else {
        // Create a temp file and use it to feed the engine
        if (!m_tempAvatar.isNull()) {
            m_tempAvatar.data()->deleteLater();
        }
        m_tempAvatar = new KTemporaryFile();
        m_tempAvatar.data()->setAutoRemove(true);
        m_tempAvatar.data()->open();
        m_tempAvatar.data()->write(avatar.avatarData);
        m_tempAvatar.data()->flush();

        setData("AccountAvatar", m_tempAvatar.data()->fileName());
    }

    // Required to trigger emission of update signal after changing data
    checkForUpdate();
}
コード例 #5
0
void HttpContainer::fetchFinished(KJob *job)
{
    if (!job->error()) {
        // We now set the data on the source with the retrieved data and some
        // additional stats. Note that we don't include the source name, as that
        // is implied as this object *is* the DataContainer. setData is called
        // with just key/value pairs.
        setData("Contents", m_data);
        setData("Size", job->processedAmount(KJob::Bytes));

        // Since we only create TransferJobs, it's safe to just static_cast here.
        // In many real-world situations, this isn't the safest thing to do and a
        // qobject_cast with a test on the result is often safer and cleaner.
        KIO::TransferJob *tjob = static_cast<KIO::TransferJob *>(job);
        setData("Error Page", tjob->isErrorPage());
        setData("Mimetype", tjob->mimetype());

        // Let DataContainer know we have data that needs storing
        setNeedsToBeStored(true);

        // Notify DataContainer that now is a good time to check to see that
        // data has been updated. This will cause visualizations to be updated.
        checkForUpdate();

        // Clean up behind ourselves so there isn't unecessary memory usage
        m_data.clear();
    }
}
コード例 #6
0
bool UpdateChecker::install()
{
    // create action
    QAction* a = MonkeyCore::menuBar()->action( "mHelp/aUpdateChecker",  tr( "Check for update..." ), QIcon( ":/icons/UpdateChecker.png" ), QString::null, infos().Description );
    connect( a, SIGNAL( triggered() ), this, SLOT( checkForUpdate_triggered() ) );
    QTimer::singleShot( 15000, this, SLOT( checkForUpdate() ) );
    return true;
}
コード例 #7
0
void PresenceSource::onDisplayNameChanged(
        const QString &displayName)
{
    // Update the data of this source
    setData("DisplayName", displayName);
    kDebug() << "DisplayName changed to " << displayName;

    // Required to trigger emission of update signal after changing data
    checkForUpdate();
}
コード例 #8
0
ファイル: tasksource.cpp プロジェクト: aarontc/kde-workspace
void TaskSource::updateDesktop()
{
    if (!m_task) {
        return;
    }
 
    const bool onCurrentDesktop = m_task.data()->isOnCurrentDesktop();
    if (data()["onCurrentDesktop"].toBool() != onCurrentDesktop) {
        setData("onCurrentDesktop", onCurrentDesktop);
        checkForUpdate();
    }
}
コード例 #9
0
ファイル: tasksource.cpp プロジェクト: aarontc/kde-workspace
void TaskSource::updateActivity()
{
    if (!m_task) {
        return;
    }
 
    const bool onCurrentActivity = m_task.data()->isOnCurrentActivity();
    if (data()["onCurrentActivity"].toBool() != onCurrentActivity) {
        setData("onCurrentActivity", onCurrentActivity);
        checkForUpdate();
    }
}
コード例 #10
0
void PresenceSource::onAccountCurrentPresenceChanged(
        const Tp::Presence &presence)
{
    // Update the data of this source
    setData("PresenceType", presenceTypeToString(presence.type()));
    setData("PresenceTypeID", presenceTypeToID(presence.type()));
    setData("PresenceStatus", presence.status());
    setData("PresenceStatusMessage", presence.statusMessage());

    // Required to trigger emission of update signal after changing data
    checkForUpdate();
}
コード例 #11
0
ファイル: settings.cpp プロジェクト: flavio/qtwitter
Settings::Settings( Core *coreSettings, QWidget *parent ) :
        QDialog( parent ),
        updateAccountsOnExit( false ),
        core( coreSettings ),
        pluginManagerTab(0)
{
    // Sorry, but this has to be here and not in Qtwitter::Qtwitter() for the core to be aware
    // of the signal emitted in Settings::Settings()
    connect( this, SIGNAL(createAccounts(QWidget*)), core, SLOT(createAccounts(QWidget*)) );

    ui.setupUi( this );

    themes.insert( Themes::STYLESHEET_COCOA.first,   Themes::STYLESHEET_COCOA.second);
    themes.insert( Themes::STYLESHEET_GRAY.first,    Themes::STYLESHEET_GRAY.second);
    themes.insert( Themes::STYLESHEET_GREEN.first,   Themes::STYLESHEET_GREEN.second);
    themes.insert( Themes::STYLESHEET_PURPLE.first,  Themes::STYLESHEET_PURPLE.second);
    themes.insert( Themes::STYLESHEET_SKY.first,     Themes::STYLESHEET_SKY.second);

    for (int i = 0; i < themes.keys().size(); ++i ) {
        ui.colorBox->addItem( themes.keys()[i] );
    }

    createLanguageMenu();

#ifdef Q_WS_X11
    QHBoxLayout *hlayout = new QHBoxLayout;

    useCustomBrowserCheckBox = new QCheckBox( tr( "Use custom web browser" ), ui.networkTab );
    selectBrowserEdit = new QLineEdit( ui.networkTab );
    selectBrowserButton = new QPushButton( tr( "Browse" ), ui.networkTab );

    hlayout->addWidget(selectBrowserEdit);
    hlayout->addWidget(selectBrowserButton);
    ui.verticalLayout_2->addWidget(useCustomBrowserCheckBox);
    ui.verticalLayout_2->addLayout(hlayout);

    selectBrowserEdit->setEnabled( false );
    selectBrowserButton->setEnabled( false );


    connect( useCustomBrowserCheckBox, SIGNAL(toggled(bool)), selectBrowserEdit, SLOT(setEnabled(bool)) );
    connect( useCustomBrowserCheckBox, SIGNAL(toggled(bool)), selectBrowserButton, SLOT(setEnabled(bool)) );
    connect( selectBrowserButton, SIGNAL(clicked()), this, SLOT(setBrowser()) );
#endif

    connect( ui.languageCombo, SIGNAL( currentIndexChanged( int )), this, SLOT( switchLanguage( int ) ) );
    connect( ui.colorBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeTheme(QString)) );
    connect( ui.checkNowButton, SIGNAL(clicked()), this, SLOT(checkForUpdate()) );
    ui.portEdit->setValidator( new QIntValidator( 1, 65535, this ) );

    emit createAccounts( ui.widget );
    //  loadConfig();
}
コード例 #12
0
void JobView::timerEvent(QTimerEvent *event)
{
    if (event->timerId() == m_updateTimer.timerId()) {
        m_updateTimer.stop();
        checkForUpdate();

        if (m_state == Stopped) {
            emit becameUnused(objectName());
        }
    } else {
        Plasma::DataContainer::timerEvent(event);
    }
}
コード例 #13
0
void RedshiftContainer::updateStatus(RedshiftController::RedshiftState state, int temperature)
{
    switch (state) {
        case RedshiftController::Stopped: setData("Status", "Stopped"); break;
        case RedshiftController::Running: setData("Status", "Running"); break;
        case RedshiftController::RunningManual: setData("Status", "RunningManual"); break;
        default: setData("Status", "Stopped");
    }
    setData("Temperature", temperature);
    //Check if any data is actually changed, and, if so, the dataUpdated signal is automatically emitted
    //in order to inform the connected plasmoids of the change.
    checkForUpdate();
}
コード例 #14
0
ファイル: waveformSlider.cpp プロジェクト: vkolev/nulloy
NWaveformSlider::NWaveformSlider(QWidget *parent) : QAbstractSlider(parent)
{
	m_waveBuilder = NULL;
	m_bufImage.resize(7);

	setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	setMinimumHeight(50);

	m_timer = new QTimer(this);
	connect(m_timer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
	m_timer->start(50);

	m_oldSize = QSize(0, 0);
	reset();
}
コード例 #15
0
ファイル: tasksource.cpp プロジェクト: aarontc/kde-workspace
void TaskSource::updateStartup(::TaskManager::TaskChanges startupChanges)
{
    ::TaskManager::Startup *startup = m_startup.data();
    if (!startup) {
        return;
    }
 
    switch (startupChanges) {
        case TaskManager::TaskUnchanged:
            setData("text", startup->text());
            setData("bin", startup->bin());
            setData("icon", startup->icon());
    }
    checkForUpdate();
}
コード例 #16
0
ファイル: imagesource.cpp プロジェクト: KDE/kdeplasma-addons
void ImageSource::loadImage(const QString &who, const KUrl &url)
{
    if (who.isEmpty()) {
        return;
    }
    if (!m_imageCache) {
        m_imageCache = new KImageCache("plasma_engine_preview", 10485760); // Re-use previewengine's cache
    }

    // Make sure we only start one job per user
    if (m_loadedPersons.contains(who)) {
        return;
    }

    const QString cacheKey = who + "@" + url.pathOrUrl();

    // Check if the image is in the cache, if so return it
    QImage preview = QImage(QSize(48, 48), QImage::Format_ARGB32_Premultiplied);
    preview.fill(Qt::transparent);
    if (m_imageCache->findImage(cacheKey, &preview)) {
        // cache hit
        //kDebug() << "cache hit: " << cacheKey;
        setData(who, polishImage(preview));
        Q_EMIT dataChanged();
        checkForUpdate();
        return;
    }
    if (!url.isValid()) {
        return;
    }
    m_loadedPersons << who;
    //FIXME: since kio_http bombs the system with too many request put a temporary
    // arbitrary limit here, revert as soon as BUG 192625 is fixed
    // Note: seems fixed.
    if (m_runningJobs < 500) {
        m_runningJobs++;
        KIO::Job *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
        job->setAutoDelete(true);
        m_jobs[job] = who;
        connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
                this, SLOT(recv(KIO::Job*,QByteArray)));
        connect(job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*)));
        job->start();
    } else {
コード例 #17
0
ファイル: gui.cpp プロジェクト: wgml/inzynier
GUI::GUI(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::GUI)
{
    ui->setupUi(this);
    this->automaticMode = true;
    this->ui->automaticModeCheckBox->setChecked(this->automaticMode);

    this->currentVehicle = -1;
    this->GUIupdate();

    this->timer = new QTimer(this);
    this->timer->start(10);

    connect(timer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));

    InputThread i(this->vehicles);
    this->inputThread = std::thread{i};
}
コード例 #18
0
ファイル: ocupdater.cpp プロジェクト: msphn/client
void OCUpdater::backgroundCheckForUpdate()
{
    int dlState = downloadState();

    // do the real update check depending on the internal state of updater.
    switch (dlState) {
    case Unknown:
    case UpToDate:
    case DownloadFailed:
    case DownloadTimedOut:
        qCInfo(lcUpdater) << "Checking for available update";
        checkForUpdate();
        break;
    case DownloadComplete:
        qCInfo(lcUpdater) << "Update is downloaded, skip new check.";
        break;
    case UpdateOnlyAvailableThroughSystem:
        qCInfo(lcUpdater) << "Update is only available through system, skip check.";
        break;
    }
}
コード例 #19
0
ファイル: waveformSlider.cpp プロジェクト: chillin2/nulloy
NWaveformSlider::NWaveformSlider(QWidget *parent) : QAbstractSlider(parent)
{
    m_radius = 0;
    m_fileDrop = false;
    m_background = QBrush(Qt::darkBlue);
    m_waveBackground = QBrush(Qt::darkGreen);
    m_waveBorderColor = QColor(Qt::green);
    m_progressPlayingBackground = QBrush(Qt::darkCyan);
    m_progressPausedBackground = QBrush(Qt::darkYellow);
    m_remainingPlayingBackground = QBrush(Qt::NoBrush);
    m_remainingPausedBackground = QBrush(Qt::NoBrush);
    m_groovePlayingColor = QColor(Qt::transparent);
    m_groovePausedColor = QColor(Qt::transparent);
    m_playingComposition = QPainter::CompositionMode_Screen;
    m_pausedComposition = QPainter::CompositionMode_Screen;
    m_fileDropBorderColor = QColor(Qt::transparent);
    m_fileDropBackground = QBrush(Qt::NoBrush);

    setMinimum(0);
    setMaximum(10000);

    m_waveBuilder = dynamic_cast<NWaveformBuilderInterface *>(NPluginLoader::getPlugin(N::WaveformBuilder));

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
    m_timer->setInterval(IDLE_INTERVAL);
    m_timer->start();

    setAcceptDrops(true);
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    setMinimumHeight(50);
    setMinimumWidth(150);

    m_oldSize = QSize(0, 0);
    init();
}
コード例 #20
0
/*
 Init our module
*/
void Quasars::init()
{
	upgradeConfigIni();

	try
	{
		StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Quasars");

		// If no settings in the main config file, create with defaults
		if (!conf->childGroups().contains("Quasars"))
		{
			qDebug() << "Quasars: no Quasars section exists in main config file - creating with defaults";
			restoreDefaultConfigIni();
		}

		// populate settings from main config file.
		readSettingsFromConfig();

		catalogJsonPath = StelFileMgr::findFile("modules/Quasars", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/quasars.json";
		if (catalogJsonPath.isEmpty())
			return;

		texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
		Quasar::markerTexture = StelApp::getInstance().getTextureManager().createTexture(":/Quasars/quasar.png");

		// key bindings and other actions
		addAction("actionShow_Quasars", N_("Quasars"), N_("Show quasars"), "quasarsVisible", "Ctrl+Alt+Q");
		addAction("actionShow_Quasars_ConfigDialog", N_("Quasars"), N_("Quasars configuration window"), configDialog, "visible");

		GlowIcon = new QPixmap(":/graphicGui/glow32x32.png");
		OnIcon = new QPixmap(":/Quasars/btQuasars-on.png");
		OffIcon = new QPixmap(":/Quasars/btQuasars-off.png");

		setFlagShowQuasars(getEnableAtStartup());
		setFlagShowQuasarsButton(flagShowQuasarsButton);
	}
	catch (std::runtime_error &e)
	{
		qWarning() << "Quasars: init error:" << e.what();
		return;
	}

	// A timer for hiding alert messages
	messageTimer = new QTimer(this);
	messageTimer->setSingleShot(true);   // recurring check for update
	messageTimer->setInterval(9000);      // 6 seconds should be enough time
	messageTimer->stop();
	connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout()));

	// If the json file does not already exist, create it from the resource in the Qt resource
	if(QFileInfo(catalogJsonPath).exists())
	{
		if (!checkJsonFileFormat() || getJsonFileFormatVersion()<CATALOG_FORMAT_VERSION)
		{
			restoreDefaultJsonFile();
		}
	}
	else
	{
		qDebug() << "Quasars: quasars.json does not exist - copying default file to" << QDir::toNativeSeparators(catalogJsonPath);
		restoreDefaultJsonFile();
	}

	qDebug() << "Quasars: loading catalog file:" << QDir::toNativeSeparators(catalogJsonPath);

	readJsonFile();

	// Set up download manager and the update schedule
	downloadMgr = new QNetworkAccessManager(this);
	connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*)));
	updateState = CompleteNoUpdates;
	updateTimer = new QTimer(this);
	updateTimer->setSingleShot(false);   // recurring check for update
	updateTimer->setInterval(13000);     // check once every 13 seconds to see if it is time for an update
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
	updateTimer->start();

	GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
}
コード例 #21
0
ファイル: Novae.cpp プロジェクト: ikuya/stellarium
/*
 Init our module
*/
void Novae::init()
{
	try
	{
		StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Novae");

		// If no settings in the main config file, create with defaults
		if (!conf->childGroups().contains("Novae"))
		{
			qDebug() << "Novae: no Novae section exists in main config file - creating with defaults";
			restoreDefaultConfigIni();
		}

		// populate settings from main config file.
		readSettingsFromConfig();

		novaeJsonPath = StelFileMgr::findFile("modules/Novae", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/novae.json";
		if (novaeJsonPath.isEmpty())
			return;

		texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
		addAction("actionShow_Novae_ConfigDialog", N_("Bright Novae"), N_("Bright Novae configuration window"), configDialog, "visible");
	}
	catch (std::runtime_error &e)
	{
		qWarning() << "Novae: init error:" << e.what();
		return;
	}

	// A timer for hiding alert messages
	messageTimer = new QTimer(this);
	messageTimer->setSingleShot(true);   // recurring check for update
	messageTimer->setInterval(9000);      // 6 seconds should be enough time
	messageTimer->stop();
	connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout()));

	// If the json file does not already exist, create it from the resource in the Qt resource
	if(QFileInfo(novaeJsonPath).exists())
	{
		if (!checkJsonFileFormat() || getJsonFileVersion()<CATALOG_FORMAT_VERSION)
		{
			restoreDefaultJsonFile();
		}
	}
	else
	{
		qDebug() << "Novae: novae.json does not exist - copying default file to" << QDir::toNativeSeparators(novaeJsonPath);
		restoreDefaultJsonFile();
	}

	qDebug() << "Novae: loading catalog file:" << QDir::toNativeSeparators(novaeJsonPath);

	readJsonFile();

	// Set up download manager and the update schedule
	downloadMgr = new QNetworkAccessManager(this);
	connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*)));
	updateState = CompleteNoUpdates;
	updateTimer = new QTimer(this);
	updateTimer->setSingleShot(false);   // recurring check for update
	updateTimer->setInterval(13000);     // check once every 13 seconds to see if it is time for an update
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
	updateTimer->start();

	GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
}
コード例 #22
0
ファイル: main.cpp プロジェクト: stream009/launchy
LaunchyWidget::LaunchyWidget(CommandFlags command) :
#ifdef Q_WS_WIN
	QWidget(NULL, Qt::FramelessWindowHint | Qt::Tool),
#endif
#ifdef Q_WS_X11
        QWidget(NULL, Qt::FramelessWindowHint),
#endif
#ifdef Q_WS_MAC
        QWidget(NULL, Qt::FramelessWindowHint),
#endif

	frameGraphic(NULL),
	trayIcon(NULL),
	alternatives(NULL),
	updateTimer(NULL),
	dropTimer(NULL),
	condensedTempIcon(NULL)
{
	setObjectName("launchy");
	setWindowTitle(tr("Launchy"));
#ifdef Q_WS_WIN
	setWindowIcon(QIcon(":/resources/launchy128.png"));
#endif
#ifdef Q_WS_MAC
        setWindowIcon(QIcon("../Resources/launchy_icon_mac.icns"));
        //setAttribute(Qt::WA_MacAlwaysShowToolWindow);
#endif

	setAttribute(Qt::WA_AlwaysShowToolTips);
	setAttribute(Qt::WA_InputMethodEnabled);
	if (platform->supportsAlphaBorder())
	{
		setAttribute(Qt::WA_TranslucentBackground);
	}
	setFocusPolicy(Qt::ClickFocus);

	createActions();

	gMainWidget = this;
	menuOpen = false;
	optionsOpen = false;
	dragging = false;
	gSearchText = "";

	alwaysShowLaunchy = false;

	connect(&iconExtractor, SIGNAL(iconExtracted(int, QIcon)), this, SLOT(iconExtracted(int, QIcon)));

	fader = new Fader(this);
	connect(fader, SIGNAL(fadeLevel(double)), this, SLOT(setFadeLevel(double)));

	optionsButton = new QPushButton(this);
	optionsButton->setObjectName("opsButton");
	optionsButton->setToolTip(tr("Launchy Options"));
	optionsButton->setGeometry(QRect());
	connect(optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsDialog()));

	closeButton = new QPushButton(this);
	closeButton->setObjectName("closeButton");
	closeButton->setToolTip(tr("Close Launchy"));
	closeButton->setGeometry(QRect());
	connect(closeButton, SIGNAL(clicked()), qApp, SLOT(quit()));

	output = new QLabel(this);
	output->setObjectName("output");
	output->setAlignment(Qt::AlignHCenter);

	input = new CharLineEdit(this);
#ifdef Q_WS_MAC
        QMacStyle::setFocusRectPolicy(input, QMacStyle::FocusDisabled);
#endif
	input->setObjectName("input");
	connect(input, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(inputKeyPressEvent(QKeyEvent*)));
	connect(input, SIGNAL(focusIn(QFocusEvent*)), this, SLOT(focusInEvent(QFocusEvent*)));
	connect(input, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*)));
	connect(input, SIGNAL(inputMethod(QInputMethodEvent*)), this, SLOT(inputMethodEvent(QInputMethodEvent*)));

	outputIcon = new QLabel(this);
	outputIcon->setObjectName("outputIcon");

	workingAnimation = new AnimationLabel(this);
	workingAnimation->setObjectName("workingAnimation");
	workingAnimation->setGeometry(QRect());

	// Load settings
	settings.load();

	// If this is the first time running or a new version, call updateVersion
	if (gSettings->value("version", 0).toInt() != LAUNCHY_VERSION)
	{
		updateVersion(gSettings->value("version", 0).toInt());
		command |= ShowLaunchy;
	}

	alternatives = new CharListWidget(this);
	alternatives->setObjectName("alternatives");
	alternatives->setWindowFlags(Qt::Window | Qt::Tool | Qt::FramelessWindowHint);
	alternatives->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	alternatives->setTextElideMode(Qt::ElideLeft);
	alternatives->setUniformItemSizes(true);
	listDelegate = new IconDelegate(this);
	defaultListDelegate = alternatives->itemDelegate();
	setSuggestionListMode(gSettings->value("GenOps/condensedView", 0).toInt());
	altScroll = alternatives->verticalScrollBar();
	altScroll->setObjectName("altScroll");
	connect(alternatives, SIGNAL(currentRowChanged(int)), this, SLOT(alternativesRowChanged(int)));
	connect(alternatives, SIGNAL(keyPressed(QKeyEvent*)), this, SLOT(alternativesKeyPressEvent(QKeyEvent*)));
	connect(alternatives, SIGNAL(focusOut(QFocusEvent*)), this, SLOT(focusOutEvent(QFocusEvent*)));

	alternativesPath = new QLabel(alternatives);
	alternativesPath->setObjectName("alternativesPath");
	alternativesPath->hide();
	listDelegate->setAlternativesPathWidget(alternativesPath);

	// Load the plugins
	plugins.loadPlugins();

	// Set the general options
	if (setAlwaysShow(gSettings->value("GenOps/alwaysshow", false).toBool()))
		command |= ShowLaunchy;
	setAlwaysTop(gSettings->value("GenOps/alwaystop", false).toBool());

	// Check for udpates?
	if (gSettings->value("GenOps/updatecheck", true).toBool())
	{
		checkForUpdate();
	}

	// Set the hotkey
	QKeySequence hotkey = getHotkey();
	if (!setHotkey(hotkey))
	{
		QMessageBox::warning(this, tr("Launchy"), tr("The hotkey %1 is already in use, please select another.").arg(hotkey.toString()));
		command = ShowLaunchy | ShowOptions;
	}

	// Set the timers
	updateTimer = new QTimer(this);
	dropTimer = new QTimer(this);
	dropTimer->setSingleShot(true);
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateTimeout()));
	connect(dropTimer, SIGNAL(timeout()), this, SLOT(dropTimeout()));
	int time = gSettings->value("GenOps/updatetimer", 10).toInt();
	if (time > 0)
		updateTimer->start(time * 60000);

	// Load the catalog
	catalog.reset(CatalogBuilder::createCatalog());
	catalog->load(settings.catalogFilename());

	// Load the history
	history.load(settings.historyFilename());

	// Load the skin
	applySkin(gSettings->value("GenOps/skin", "Default").toString());

	// Move to saved position
	loadPosition(gSettings->value("Display/pos", QPoint(0,0)).toPoint());
	loadOptions();

	executeStartupCommand(command);
}
コード例 #23
0
ファイル: ocupdater.cpp プロジェクト: sebasje/mirall
void OCUpdater::backgroundCheckForUpdate()
{
    // FIXME
    checkForUpdate();
}
コード例 #24
0
ファイル: MainWindow.cpp プロジェクト: YAYPony/MultiMC5
void MainWindow::on_actionCheckUpdate_triggered()
{
	auto updater = MMC->updateChecker();

	updater->checkForUpdate(true);
}
コード例 #25
0
ファイル: tasksource.cpp プロジェクト: aarontc/kde-workspace
void TaskSource::updateTask(::TaskManager::TaskChanges taskChanges)
{
    ::TaskManager::Task *taskPtr = m_task.data();
    if (!taskPtr) {
        return;
    }
 
    // only a subset of task information is exported
    switch (taskChanges) {
        case TaskManager::EverythingChanged:
            setData("name", taskPtr->name());
            setData("visibleName", taskPtr->visibleName());
            setData("visibleNameWithState", taskPtr->visibleNameWithState());
            setData("maximized", taskPtr->isMaximized());
            setData("minimized", taskPtr->isMinimized());
           // setData("cascade",taskPtr->isCascade());
           // setData("unclutter",taskPtr->isUnclutter());
            setData("shaded", taskPtr->isShaded());
            setData("fullScreen", taskPtr->isFullScreen());
            setData("alwaysOnTop", taskPtr->isAlwaysOnTop());
            setData("keptBelowOthers", taskPtr->isKeptBelowOthers());
            setData("active", taskPtr->isActive());
            setData("onTop", taskPtr->isOnTop());
            setData("onCurrentDesktop", taskPtr->isOnCurrentDesktop());
            setData("onAllDesktops", taskPtr->isOnAllDesktops());
            setData("desktop",qMax(0,taskPtr->desktop()));
            setData("onCurrentActivity", taskPtr->isOnCurrentActivity());
            setData("onAllActivities", taskPtr->isOnAllActivities());
            setData("activities", taskPtr->activities());
            setData("icon", taskPtr->icon());
            setData("actionMinimize", taskPtr->info().actionSupported(NET::ActionMinimize));
            setData("actionMaximize", taskPtr->info().actionSupported(NET::ActionMax));
            setData("actionShade", taskPtr->info().actionSupported(NET::ActionShade));
            setData("actionResize", taskPtr->info().actionSupported(NET::ActionResize));
           // setData("actionCascade", taskPtr->info().actionSupported(NET::ActionCascade));
          //            setData("actionUnclutter", taskPtr->info().actionSupported(NET::ActionUnclutter));
            setData("actionMove", taskPtr->info().actionSupported(NET::ActionMove));
            setData("actionClose", taskPtr->info().actionSupported(NET::ActionClose));
            setData("actionChangeDesktop", taskPtr->info().actionSupported(NET::ActionChangeDesktop));
            setData("actionFullScreen", taskPtr->info().actionSupported(NET::ActionFullScreen));
            break;
        case TaskManager::IconChanged:
            setData("icon", taskPtr->icon());
            break;
        case TaskManager::NameChanged:
            setData("name", taskPtr->name());
            setData("visibleName", taskPtr->visibleName());
            setData("visibleNameWithState", taskPtr->visibleNameWithState());
            break;
        case TaskManager::StateChanged:
            setData("maximized", taskPtr->isMaximized());
            setData("minimized", taskPtr->isMinimized());
            setData("shaded", taskPtr->isShaded());
            setData("fullScreen", taskPtr->isFullScreen());
            setData("alwaysOnTop", taskPtr->isAlwaysOnTop());
            setData("keptBelowOthers", taskPtr->isKeptBelowOthers());
            setData("active", taskPtr->isActive());
            setData("onTop", taskPtr->isOnTop());
            setData("visibleNameWithState", taskPtr->visibleNameWithState());
            break;
        case TaskManager::DesktopChanged:
            setData("onCurrentDesktop", taskPtr->isOnCurrentDesktop());
            setData("onAllDesktops", taskPtr->isOnAllDesktops());
            setData("desktop", taskPtr->desktop());
            break;
        case TaskManager::ActivitiesChanged:
            setData("onCurrentActivity", taskPtr->isOnCurrentActivity());
            setData("onAllActivities", taskPtr->isOnAllActivities());
            setData("activities", taskPtr->activities());
        case TaskManager::ActionsChanged:
            setData("actionMinimize", taskPtr->info().actionSupported(NET::ActionMinimize));
            setData("actionMaximize", taskPtr->info().actionSupported(NET::ActionMax));
            setData("actionShade", taskPtr->info().actionSupported(NET::ActionShade));
            setData("actionResize", taskPtr->info().actionSupported(NET::ActionResize));
            setData("actionMove", taskPtr->info().actionSupported(NET::ActionMove));
            setData("actionClose", taskPtr->info().actionSupported(NET::ActionClose));
            setData("actionChangeDesktop", taskPtr->info().actionSupported(NET::ActionChangeDesktop));
            setData("actionFullScreen", taskPtr->info().actionSupported(NET::ActionFullScreen));
           // setData("actionCascade", taskPtr->info().actionSupported(NET::ActionCascade));
         //   setData("actionUnclutter", taskPtr->info().actionSupported(NET::ActionUnclutter));
            break;
        default:
            break;
    }
    checkForUpdate();
}
コード例 #26
0
ファイル: SearchView.cpp プロジェクト: JennYung/minitube
SearchView::SearchView(QWidget *parent) : QWidget(parent) {

    QFont biggerFont = FontUtils::big();
    QFont smallerFont = FontUtils::smallBold();

#if defined(APP_MAC) | defined(APP_WIN)
    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);
#endif

    QBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    // hidden message widget
    message = new QLabel(this);
    message->hide();
    mainLayout->addWidget(message);

#ifdef APP_DEMO
    QLabel *buy = new QLabel(this);
    buy->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    buy->setText(QString("<a style='color:palette(text);text-decoration:none' href='%1'>%2</a>").arg(
            QString(Constants::WEBSITE) + "#download",
            tr("Get the full version").toUpper()
            ));
    buy->setOpenExternalLinks(true);
    buy->setMargin(7);
    buy->setAlignment(Qt::AlignRight);
    buy->setStyleSheet("QLabel {"
                       "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CCD6E0, stop: 1 #ADBCCC);"
                       "border-bottom-left-radius: 8px;"
                       "border-bottom-right-radius: 8px;"
                       "font-size: 10px;"
                       "margin-right: 50px;"
                       "}");
    mainLayout->addWidget(buy, 0, Qt::AlignRight);
#endif

    mainLayout->addStretch();
    mainLayout->addSpacing(PADDING);

    QBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setAlignment(Qt::AlignCenter);
    mainLayout->addLayout(hLayout);

    QLabel *logo = new QLabel(this);
    logo->setPixmap(QPixmap(":/images/app.png"));
    hLayout->addWidget(logo, 0, Qt::AlignTop);
    hLayout->addSpacing(PADDING);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->setAlignment(Qt::AlignCenter);
    hLayout->addLayout(layout);

    QLabel *welcomeLabel =
            new QLabel("<h1 style='font-weight:normal'>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       // .replace("<a ", "<a style='color:palette(text)'")
                       .replace("<a href", "<a style='text-decoration:none; color:palette(text); font-weight:bold' href")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h1>", this);
    welcomeLabel->setOpenExternalLinks(true);
    layout->addWidget(welcomeLabel);

    layout->addSpacing(PADDING / 2);

    QBoxLayout *tipLayout = new QHBoxLayout();
    tipLayout->setSpacing(10);

    //: "Enter", as in "type". The whole frase says: "Enter a keyword to start watching videos"
    QLabel *tipLabel = new QLabel(tr("Enter"), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);

    typeCombo = new QComboBox(this);
    typeCombo->addItem(tr("a keyword"));
    typeCombo->addItem(tr("a channel"));
    typeCombo->setFont(biggerFont);
    connect(typeCombo, SIGNAL(currentIndexChanged(int)), SLOT(searchTypeChanged(int)));
    tipLayout->addWidget(typeCombo);

    tipLabel = new QLabel(tr("to start watching videos."), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);
    layout->addLayout(tipLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *searchLayout = new QHBoxLayout();
    searchLayout->setAlignment(Qt::AlignVCenter);

    queryEdit = new SearchLineEdit(this);
    queryEdit->setFont(biggerFont);
    queryEdit->setMinimumWidth(queryEdit->fontInfo().pixelSize()*15);
    queryEdit->sizeHint();
    queryEdit->setFocus(Qt::OtherFocusReason);
    connect(queryEdit, SIGNAL(search(const QString&)), this, SLOT(watch(const QString&)));
    connect(queryEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));

    youtubeSuggest = new YouTubeSuggest(this);
    channelSuggest = new ChannelSuggest(this);
    searchTypeChanged(0);

    searchLayout->addWidget(queryEdit);
    searchLayout->addSpacing(10);

    watchButton = new QPushButton(tr("Watch"), this);
    watchButton->setDefault(true);
    watchButton->setEnabled(false);
    watchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(watchButton, SIGNAL(clicked()), this, SLOT(watch()));
    searchLayout->addWidget(watchButton);

    layout->addItem(searchLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *otherLayout = new QHBoxLayout();
    otherLayout->setMargin(0);
    otherLayout->setSpacing(10);

    recentKeywordsLayout = new QVBoxLayout();
    recentKeywordsLayout->setSpacing(5);
    recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    QPalette palette = recentKeywordsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentKeywordsLabel->setPalette(palette);
#else
    recentKeywordsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentKeywordsLabel->hide();
    recentKeywordsLabel->setFont(smallerFont);
    recentKeywordsLayout->addWidget(recentKeywordsLabel);

    otherLayout->addLayout(recentKeywordsLayout);

    // recent channels
    recentChannelsLayout = new QVBoxLayout();
    recentChannelsLayout->setSpacing(5);
    recentChannelsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentChannelsLabel = new QLabel(tr("Recent channels").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    palette = recentChannelsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentChannelsLabel->setPalette(palette);
#else
    recentChannelsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentChannelsLabel->hide();
    recentChannelsLabel->setFont(smallerFont);
    recentChannelsLayout->addWidget(recentChannelsLabel);

    otherLayout->addLayout(recentChannelsLayout);

    layout->addLayout(otherLayout);

    mainLayout->addSpacing(PADDING);
    mainLayout->addStretch();

    setLayout(mainLayout);

    updateChecker = 0;

#ifndef APP_MAC_STORE
    checkForUpdate();
#endif

}
コード例 #27
0
ファイル: UpdateChecker.cpp プロジェクト: Glought/MultiMC5
void UpdateChecker::chanListDownloadFinished(bool notifyNoUpdate)
{
	QByteArray data;
	{
		ByteArrayDownloadPtr dl =
			std::dynamic_pointer_cast<ByteArrayDownload>(chanListJob->first());
		data = dl->m_data;
		chanListJob.reset();
	}

	QJsonParseError jsonError;
	QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
	if (jsonError.error != QJsonParseError::NoError)
	{
		// TODO: Report errors to the user.
		QLOG_ERROR() << "Failed to parse channel list JSON:" << jsonError.errorString() << "at"
					 << jsonError.offset;
		return;
	}

	QJsonObject object = jsonDoc.object();

	bool success = false;
	int formatVersion = object.value("format_version").toVariant().toInt(&success);
	if (formatVersion != CHANLIST_FORMAT || !success)
	{
		QLOG_ERROR()
			<< "Failed to check for updates. Channel list format version mismatch. We're using"
			<< CHANLIST_FORMAT << "server has" << formatVersion;
		return;
	}

	// Load channels into a temporary array.
	QList<ChannelListEntry> loadedChannels;
	QJsonArray channelArray = object.value("channels").toArray();
	for (QJsonValue chanVal : channelArray)
	{
		QJsonObject channelObj = chanVal.toObject();
		ChannelListEntry entry{channelObj.value("id").toVariant().toString(),
							   channelObj.value("name").toVariant().toString(),
							   channelObj.value("description").toVariant().toString(),
							   channelObj.value("url").toVariant().toString()};
		if (entry.id.isEmpty() || entry.name.isEmpty() || entry.url.isEmpty())
		{
			QLOG_ERROR() << "Channel list entry with empty ID, name, or URL. Skipping.";
			continue;
		}
		loadedChannels.append(entry);
	}

	// Swap  the channel list we just loaded into the object's channel list.
	m_channels.swap(loadedChannels);

	m_chanListLoading = false;
	m_chanListLoaded = true;
	QLOG_INFO() << "Successfully loaded UpdateChecker channel list.";

	// If we're waiting to check for updates, do that now.
	if (m_checkUpdateWaiting)
		checkForUpdate(notifyNoUpdate);

	emit channelListLoaded();
}
コード例 #28
0
ファイル: listupdater.cpp プロジェクト: Axovera/hajeb
void ListUpdater::update() {
    checkForUpdate();
}
コード例 #29
0
ファイル: waveformSlider.cpp プロジェクト: chillin2/nulloy
void NWaveformSlider::resizeEvent(QResizeEvent *event)
{
    QAbstractSlider::resizeEvent(event);
    checkForUpdate();
}
コード例 #30
0
ファイル: Satellites.cpp プロジェクト: incadoi/stellarium
void Satellites::init()
{
	QSettings* conf = StelApp::getInstance().getSettings();

	try
	{
		// TODO: Compatibility with installation-dir modules? --BM
		// It seems that the original code couldn't handle them either.
		QString dirPath = StelFileMgr::getUserDir() + "/modules/Satellites";
		// TODO: Ideally, this should return a QDir object
		StelFileMgr::makeSureDirExistsAndIsWritable(dirPath);
		dataDir.setPath(dirPath);

		// If no settings in the main config file, create with defaults
		if (!conf->childGroups().contains("Satellites"))
		{
			//qDebug() << "Stellites: created section in config file.";
			restoreDefaultSettings();
		}

		// populate settings from main config file.
		loadSettings();

		// absolute file name for inner catalog of the satellites
		catalogPath = dataDir.absoluteFilePath("satellites.json");
		// absolute file name for qs.mag file
		qsMagFilePath = dataDir.absoluteFilePath("qs.mag");

		// Load and find resources used in the plugin
		texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png");
		Satellite::hintTexture = StelApp::getInstance().getTextureManager().createTexture(":/satellites/hint.png");

		// key bindings and other actions
		StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
		QString satGroup = N_("Satellites");
		addAction("actionShow_Satellite_Hints", satGroup, N_("Satellite hints"), "hintsVisible", "Ctrl+Z");
		addAction("actionShow_Satellite_Labels", satGroup, N_("Satellite labels"), "labelsVisible", "Shift+Z");
		addAction("actionShow_Satellite_ConfigDialog_Global", satGroup, N_("Satellites configuration window"), configDialog, "visible", "Alt+Z");

		// Gui toolbar button
		toolbarButton = new StelButton(NULL,
					       QPixmap(":/satellites/bt_satellites_on.png"),
					       QPixmap(":/satellites/bt_satellites_off.png"),
					       QPixmap(":/graphicGui/glow32x32.png"),
					       "actionShow_Satellite_Hints");
		gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
	}
	catch (std::runtime_error &e)
	{
		qWarning() << "Satellites::init error: " << e.what();
		return;
	}

	// A timer for hiding alert messages
	messageTimer = new QTimer(this);
	messageTimer->setSingleShot(true);   // recurring check for update
	messageTimer->setInterval(9000);      // 6 seconds should be enough time
	messageTimer->stop();
	connect(messageTimer, SIGNAL(timeout()), this, SLOT(hideMessages()));

	// If the json file does not already exist, create it from the resource in the QT resource
	if(QFileInfo(catalogPath).exists())
	{
		if (!checkJsonFileFormat() || readCatalogVersion() != SATELLITES_PLUGIN_VERSION)
		{
			displayMessage(q_("The old satellites.json file is no longer compatible - using default file"), "#bb0000");
			restoreDefaultCatalog();
		}
	}
	else
	{
		qDebug() << "Satellites::init satellites.json does not exist - copying default file to " << QDir::toNativeSeparators(catalogPath);
		restoreDefaultCatalog();
	}
	
	if(!QFileInfo(qsMagFilePath).exists())
	{
		restoreDefaultQSMagFile();
	}

	qDebug() << "Satellites: loading catalog file:" << QDir::toNativeSeparators(catalogPath);

	// create satellites according to content os satellites.json file
	loadCatalog();

	// Set up download manager and the update schedule
	downloadMgr = new QNetworkAccessManager(this);
	connect(downloadMgr, SIGNAL(finished(QNetworkReply*)),
	        this, SLOT(saveDownloadedUpdate(QNetworkReply*)));
	updateState = CompleteNoUpdates;
	updateTimer = new QTimer(this);
	updateTimer->setSingleShot(false);   // recurring check for update
	updateTimer->setInterval(13000);     // check once every 13 seconds to see if it is time for an update
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
	updateTimer->start();

	earth = GETSTELMODULE(SolarSystem)->getEarth();
	GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);

	// Handle changes to the observer location:
	connect(StelApp::getInstance().getCore(),
	        SIGNAL(locationChanged(StelLocation)),
	        this,
	        SLOT(updateObserverLocation(StelLocation)));
}