コード例 #1
0
ファイル: TrayUI.cpp プロジェクト: TetragrammatonHermit/pcbsd
void TrayUI::watcherMessage(SystemFlags::SYSFLAG flag, SystemFlags::SYSMESSAGE msg){
  //reset the noInternet flag (prevent false positives, since something obviously just changed)
  bool oldstat = noInternet;
  if(flag != SystemFlags::NetRestart){ noInternet = false; }
  bool runcheck = false;
  switch(flag){
	case SystemFlags::NetRestart:
	  if(msg==SystemFlags::Error){ noInternet = true; }
	  else{ noInternet = false; }
	  if(!noInternet && oldstat){ checkForUpdates(); } //only re-check if no internet previously available
	  break;
	case SystemFlags::PkgUpdate:
	  if(msg==SystemFlags::Working){ PKGSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ PKGSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;
	case SystemFlags::SysUpdate:
	  if(msg==SystemFlags::Working){ SYSSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ SYSSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;	
	case SystemFlags::WardenUpdate:
	  if(msg==SystemFlags::Working){ WARDENSTATUS=1; }
	  else if(msg==SystemFlags::Updating){ WARDENSTATUS=3; }
	  else{ runcheck=true; } //check it
	  break;	
  }
  if(runcheck){ checkForUpdates(); }
  qDebug() << "System Status Change:" << SYSSTATUS << PKGSTATUS << WARDENSTATUS << noInternet;
  //Update the tray icon
  updateTrayIcon();
  //Update the tooltip
  updateToolTip();
}
コード例 #2
0
void MeteorShowersMgr::init()
{
	loadTextures();

	m_meteorShowers = new MeteorShowers(this);
	m_configDialog = new MSConfigDialog(this);
	m_searchDialog = new MSSearchDialog(this);

	createActions();
	loadConfig();

	// timer to hide the alert messages
	m_messageTimer = new QTimer(this);
	m_messageTimer->setSingleShot(true);
	m_messageTimer->setInterval(9000);
	m_messageTimer->stop();
	connect(m_messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout()));

	// MeteorShowers directory
	QString userDir = StelFileMgr::getUserDir() + "/modules/MeteorShowers";
	StelFileMgr::makeSureDirExistsAndIsWritable(userDir);

	// Loads the JSON catalog
	m_catalogPath = userDir + "/showers.json";
	if (!loadCatalog(m_catalogPath))
	{
		displayMessage(q_("The current catalog of Meteor Showers is invalid!"), "#bb0000");
		restoreDefaultCatalog(m_catalogPath);
	}

	// Sets up the download manager
	m_downloadMgr = new QNetworkAccessManager(this);
	connect(m_downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateFinished(QNetworkReply*)));

	// every 5 min, check if it's time to update
	QTimer* updateTimer = new QTimer(this);
	updateTimer->setInterval(300000);
	connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdates()));
	updateTimer->start();
	checkForUpdates();

	// always check if we are on Earth
	StelCore* core = StelApp::getInstance().getCore();
	m_onEarth = core->getCurrentPlanet().data()->getEnglishName() == "Earth";
	connect(core, SIGNAL(locationChanged(StelLocation)),
		this, SLOT(locationChanged(StelLocation)));

	// enable at startup?
	setEnablePlugin(getEnableAtStartup());
}
コード例 #3
0
ファイル: TrayUI.cpp プロジェクト: yater/pcbsd
void TrayUI::watcherFileChange(QString file){
  if(file == PCBSD_CONF_FILE){
     UpdateAUNotice();
  }else if( file == SYSCACHE_LOG_FILE ){
    QTimer::singleShot(0,this, SLOT(checkForUpdates()) );
  }
}
コード例 #4
0
UpdateManager::UpdateManager(QObject *parent) :
	QObject(parent),
	isAutomaticCheck(false)
{
	// is this the first time this version was run?
	QSettings settings;
	settings.beginGroup("UpdateManager");
	if (settings.contains("DontCheckForUpdates") && settings.value("DontCheckForUpdates") == "TRUE")
		return;
	if (settings.contains("LastVersionUsed")) {
		// we have checked at least once before
		if (settings.value("LastVersionUsed").toString() != subsurface_git_version()) {
			// we have just updated - wait two weeks before you check again
			settings.setValue("LastVersionUsed", QString(subsurface_git_version()));
			settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate));
		} else {
			// is it time to check again?
			QString nextCheckString = settings.value("NextCheck").toString();
			QDateTime nextCheck = QDateTime::fromString(nextCheckString, Qt::ISODate);
			if (nextCheck > QDateTime::currentDateTime())
				return;
		}
	}
	settings.setValue("LastVersionUsed", QString(subsurface_git_version()));
	settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate));
	checkForUpdates(true);
}
コード例 #5
0
ファイル: MdViewerWidget.cpp プロジェクト: trnielsen/mantid
/**
 * This function is responsible for setting up all the connections between
 * ParaView's pqPipelineBrowser and pqProxyTabWidget and cetatin main window
 * widgets.
 */
void MdViewerWidget::setParaViewComponentsForView()
{
  // Extra setup stuff to hook up view to other items
  this->ui.proxyTabWidget->setupDefaultConnections();
  this->ui.proxyTabWidget->setView(this->currentView->getView());
  this->ui.proxyTabWidget->setShowOnAccept(true);
  this->ui.pipelineBrowser->setActiveView(this->currentView->getView());
  QObject::connect(this->ui.proxyTabWidget->getObjectInspector(),
                   SIGNAL(postaccept()),
                   this, SLOT(checkForUpdates()));
  QObject::connect(this->currentView, SIGNAL(triggerAccept()),
                   this->ui.proxyTabWidget->getObjectInspector(),
                   SLOT(accept()));

  if (this->currentView->inherits("MultiSliceView"))
  {
    QObject::connect(this->ui.pipelineBrowser,
                     SIGNAL(clicked(const QModelIndex &)),
                     static_cast<MultiSliceView *>(this->currentView),
                     SLOT(selectIndicator()));
    QObject::connect(this->ui.proxyTabWidget->getObjectInspector(),
                     SIGNAL(accepted()),
                     static_cast<MultiSliceView *>(this->currentView),
                     SLOT(updateSelectedIndicator()));
  }
コード例 #6
0
/**
 * Constructor of the sourcesWindow, generating checkboxes and delete buttons
 * @param	selected	Bool list of currently selected websites, in the alphabetical order
 * @param	sites		QStringList of sites names
 * @param	parent		The parent window
 */
sourcesWindow::sourcesWindow(QList<bool> selected, QMap<QString, Site*> *sites, QWidget *parent) : QDialog(parent), ui(new Ui::sourcesWindow), m_selected(selected), m_sites(sites)
{
	ui->setupUi(this);

	bool checkall = true;
	for (int i = 0; i < selected.count(); i++)
	{
		if (!selected.at(i))
		{
			checkall = false;
			break;
		}
	}
	if (checkall)
	{ ui->checkBox->setChecked(true); }

    QSettings settings(savePath("settings.ini"), QSettings::IniFormat);

	addCheckboxes();

	ui->gridLayout->setColumnStretch(0, 1);
	connect(ui->checkBox, SIGNAL(clicked()), this, SLOT(checkClicked()));
	checkUpdate();

	// Check for updates in the model files
	checkForUpdates();

	ui->buttonOk->setFocus();
}
コード例 #7
0
ファイル: updatewindow.cpp プロジェクト: sonic414/lmc-clone
void lmcUpdateWindow::init(void) {
	setWindowIcon(QIcon(IDR_APPICON));
	ui->lblOutput->setBackgroundRole(QPalette::Base);
	ui->lblOutput->setAutoFillBackground(true);

	setUIText();
	checkForUpdates();
}
コード例 #8
0
ファイル: WorkflowJSON.cpp プロジェクト: NREL/OpenStudio
 bool WorkflowJSON_Impl::saveAs(const openstudio::path& p)
 {
   if (setOswPath(p, true)) {
     checkForUpdates();
     return save();
   }
   return false;
 }
コード例 #9
0
ファイル: main_window.cpp プロジェクト: gz818/itest
void MainWindow::httpRequestFailed(bool silent)
{
    if (silent)
        return;

    switch (QMessageBox::critical(this, "iTest", tr("Failed to check for updates."), tr("&Try again"), tr("Cancel"), 0, 1)) {
        case 0: // Try again
            checkForUpdates(); break;
        case 1: // Cancel
            break;
    }
}
コード例 #10
0
ファイル: TrayUI.cpp プロジェクト: Jheengut/pcbsd
void TrayUI::watcherMessage(SystemFlags::SYSFLAG flag, SystemFlags::SYSMESSAGE msg){
  //reset the noInternet flag (prevent false positives, since something obviously just changed)
    // - PBI system uses cached files - not a good indicator of internet availability
  bool oldstat = noInternet;
  if(flag != SystemFlags::PbiUpdate && flag != SystemFlags::NetRestart){ noInternet = false; }
  switch(flag){
	case SystemFlags::NetRestart:
	  if(msg==SystemFlags::Error){ noInternet = true; }
	  else{ noInternet = false; }
	  if(!noInternet && oldstat){ checkForUpdates(); } //only re-check if no internet previously available
	  break;
	case SystemFlags::PkgUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ PKGSTATUS=2; }
	  else if(msg==SystemFlags::Working){ PKGSTATUS=1; }
	  else if(msg==SystemFlags::Success){ PKGSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ PKGSTATUS=3; }
	  else if(msg==SystemFlags::Error){ PKGSTATUS=0; noInternet=true; }
	  else{ startPKGCheck(); } //unknown - check it
	  break;
	case SystemFlags::SysUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ SYSSTATUS=2; }
	  else if(msg==SystemFlags::Working){ SYSSTATUS=1; }
	  else if(msg==SystemFlags::Success){ SYSSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ SYSSTATUS=3; }
	  else if(msg==SystemFlags::Error){ SYSSTATUS=0; noInternet=true; }
	  else{ startSYSCheck(); } //unknown - check it
	  break;	
	case SystemFlags::PbiUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ PBISTATUS=2; }
	  else if(msg==SystemFlags::Working){ PBISTATUS=1; }
	  else if(msg==SystemFlags::Success){ PBISTATUS=0; }
	  else if(msg==SystemFlags::Updating){ PBISTATUS=3; }
	  else if(msg==SystemFlags::Error){ PBISTATUS=0; } //nothing special for PBI errors yet
	  else{ startPBICheck(); } //unknown - check it
	  break;	
	case SystemFlags::WardenUpdate:
	  if(msg==SystemFlags::UpdateAvailable){ WARDENSTATUS=2; }
	  else if(msg==SystemFlags::Working){ WARDENSTATUS=1; }
	  else if(msg==SystemFlags::Success){ WARDENSTATUS=0; }
	  else if(msg==SystemFlags::Updating){ WARDENSTATUS=3; }
	  else if(msg==SystemFlags::Error){ WARDENSTATUS=0; noInternet=true; }
	  else{ startWardenCheck(); } //unknown - check it
	  break;	
  }
  qDebug() << "System Status Change:" << SYSSTATUS << PKGSTATUS << PBISTATUS <<WARDENSTATUS;
  //Update the tray icon
  updateTrayIcon();
  //Update the tooltip
  updateToolTip();
}
コード例 #11
0
ファイル: formupdate.cpp プロジェクト: pmattern/rssguard
FormUpdate::FormUpdate(QWidget *parent)
  : QDialog(parent), m_downloader(nullptr), m_readyToInstall(false), m_ui(new Ui::FormUpdate) {
  m_ui->setupUi(this);
  m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Download update"), QDialogButtonBox::ActionRole);
  m_btnUpdate->setToolTip(tr("Download new installation files."));
  m_ui->m_lblCurrentRelease->setText(APP_VERSION);

  // Set flags and attributes.
  setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint);
  setWindowIcon(qApp->icons()->fromTheme(QSL("help-about")));

  connect(m_btnUpdate, SIGNAL(clicked()), this, SLOT(startUpdate()));
  checkForUpdates();
}
コード例 #12
0
ファイル: MainWindow.cpp プロジェクト: KDE/muon
void MainWindow::setupActions()
{
    QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection());
    actionCollection()->addAction("file_quit", quitAction);

    QAction *focusSearchAction = KStandardAction::find(this, SLOT(setFocusSearchEdit()), actionCollection());
    actionCollection()->addAction("find", focusSearchAction);

    m_safeUpgradeAction = actionCollection()->addAction("safeupgrade");
    m_safeUpgradeAction->setIcon(QIcon::fromTheme("go-up"));
    m_safeUpgradeAction->setText(i18nc("@action Marks upgradeable packages for upgrade", "Cautious Upgrade"));
    connect(m_safeUpgradeAction, SIGNAL(triggered()), this, SLOT(markUpgrade()));

    m_distUpgradeAction = actionCollection()->addAction("fullupgrade");
    m_distUpgradeAction->setIcon(QIcon::fromTheme("go-top"));
    m_distUpgradeAction->setText(i18nc("@action Marks upgradeable packages, including ones that install/remove new things",
                                       "Full Upgrade"));
    connect(m_distUpgradeAction, SIGNAL(triggered()), this, SLOT(markDistUpgrade()));

    m_autoRemoveAction = actionCollection()->addAction("autoremove");
    m_autoRemoveAction->setIcon(QIcon::fromTheme("trash-empty"));
    m_autoRemoveAction->setText(i18nc("@action Marks packages no longer needed for removal",
                                      "Remove Unnecessary Packages"));
    connect(m_autoRemoveAction, SIGNAL(triggered()), this, SLOT(markAutoRemove()));

    m_previewAction = actionCollection()->addAction("preview");
    m_previewAction->setIcon(QIcon::fromTheme("document-preview-archive"));
    m_previewAction->setText(i18nc("@action Takes the user to the preview page", "Preview Changes"));
    connect(m_previewAction, SIGNAL(triggered()), this, SLOT(previewChanges()));

    m_applyAction = actionCollection()->addAction("apply");
    m_applyAction->setIcon(QIcon::fromTheme("dialog-ok-apply"));
    m_applyAction->setText(i18nc("@action Applys the changes a user has made", "Apply Changes"));
    connect(m_applyAction, SIGNAL(triggered()), this, SLOT(startCommit()));

    QAction* updateAction = actionCollection()->addAction("update");
    updateAction->setIcon(QIcon::fromTheme("system-software-update"));
    updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates"));
    actionCollection()->setDefaultShortcut(updateAction, QKeySequence(Qt::CTRL + Qt::Key_R));
    connect(updateAction, SIGNAL(triggered()), SLOT(checkForUpdates()));
    updateAction->setEnabled(QAptActions::self()->isConnected());
    connect(QAptActions::self(), SIGNAL(shouldConnect(bool)), updateAction, SLOT(setEnabled(bool)));

    KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());

    setActionsEnabled(false);

    setupGUI(StandardWindowOption(KXmlGuiWindow::Default & ~KXmlGuiWindow::StatusBar));
}
コード例 #13
0
UpdateDialog::UpdateDialog(SettingsModel *settings, QWidget *parent)
    :
    QDialog(parent),
    ui(new Ui::UpdateDialog),
    m_thread(NULL),
    m_settings(settings),
    m_logFile(new QStringList()),
    m_betaUpdates(settings ? (settings->autoUpdateCheckBeta() || lamexp_version_demo()) : lamexp_version_demo()),
    m_success(false),
    m_firstShow(true),
    m_updateReadyToInstall(false),
    m_updaterProcess(NULL),
    m_binaryUpdater(lamexp_lookup_tool("wupdate.exe")),
    m_binaryWGet(lamexp_lookup_tool("wget.exe")),
    m_binaryGnuPG(lamexp_lookup_tool("gpgv.exe")),
    m_binaryKeys(lamexp_lookup_tool("gpgv.gpg"))
{
    if(m_binaryUpdater.isEmpty())
    {
        THROW("Tools not initialized correctly!");
    }

    //Init the dialog, from the .ui file
    ui->setupUi(this);
    setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);

    //Disable "X" button
    lamexp_enable_close_button(this, false);

    //Init animation
    m_animator = new QMovie(":/images/Loading3.gif");
    ui->labelAnimationCenter->setMovie(m_animator);
    m_animator->start();

    //Indicate beta updates
    if(m_betaUpdates)
    {
        setWindowTitle(windowTitle().append(" [Beta]"));
    }

    //Enable button
    connect(ui->retryButton, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
    connect(ui->installButton, SIGNAL(clicked()), this, SLOT(applyUpdate()));
    connect(ui->infoLabel, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));
    connect(ui->logButton, SIGNAL(clicked()), this, SLOT(logButtonClicked()));

    //Enable progress bar
    connect(ui->progressBar, SIGNAL(valueChanged(int)), this, SLOT(progressBarValueChanged(int)));
}
コード例 #14
0
ファイル: main.cpp プロジェクト: Vlad-Iliescu/qt_gest
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QPixmap pixmap(":/splash");

    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();


    // check for updates
    QString path = a.applicationDirPath();
    if (0 && checkForUpdates(path)) {
        QProcess updater;
        updater.startDetached("wyUpdate");

        if (updater.waitForStarted()) {

        }
        a.quit();
    }
    // end check for updates

    QtGest *mw = 0;
    Login *ld = new Login();

    splash->finish(ld);

    int status;

    do {
        if (ld->exec()) {
            if (!mw) {
                mw = new QtGest();
            }

            mw->resetPrivileges();
            mw->setWindowTitle(QString("QtGest - %1").arg(ld->getUsername()));
            mw->setUsername(ld->getUsername());
            mw->showMaximized();
            a.exec();
            status = 1;
        } else {
            status = 0;
        }
    } while (status != 0);

    return status;
}
コード例 #15
0
ファイル: TrayUI.cpp プロジェクト: TetragrammatonHermit/pcbsd
void TrayUI::slotItemClicked(QAction* act){
  QString code = act->whatsThis();
  if(code=="quit"){
    //Close the tray
    slotClose();
  }else if(code=="update"){
    //Check for updates
    checkForUpdates();
  }else if(code.isEmpty()){
    return;
  }else{
    //Launch one of the external applications
    launchApp(code);
  }
  
}
コード例 #16
0
void
MainWindow::setupMenu() {
  connect(ui->actionGUIExit,            SIGNAL(triggered()), this, SLOT(close()));
  connect(ui->actionGUIPreferences,     SIGNAL(triggered()), this, SLOT(editPreferences()));

#if defined(HAVE_CURL_EASY_H)
  connect(ui->actionGUICheckForUpdates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
#else
  ui->actionGUICheckForUpdates->setVisible(false);
#endif  // HAVE_CURL_EASY_H

  connect(ui->actionHelpFAQ,                   &QAction::triggered, this, &MainWindow::visitHelpURL);
  connect(ui->actionHelpKnownProblems,         &QAction::triggered, this, &MainWindow::visitHelpURL);
  connect(ui->actionHelpMkvmergeDocumentation, &QAction::triggered, this, &MainWindow::visitHelpURL);
  connect(ui->actionHelpWebSite,               &QAction::triggered, this, &MainWindow::visitHelpURL);
}
コード例 #17
0
ファイル: updates.cpp プロジェクト: markwal/GpxUi
// ../Update.exe --download=https://markwal.github.io/GpxUi
// ../Update.exe --update=https://markwal.github.io/GpxUi
Updates::Updates(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Updates)
{
    ui->setupUi(this);

    QSettings settings;
    ui->cboxAutoUpdate->setChecked(settings.value("auto_update", true).toBool());

    pprocess = new QProcess(this);
    pprocess->setProcessChannelMode(QProcess::MergedChannels);
    connect(pprocess, SIGNAL(readyRead()), SLOT(readStdout()));
    connect(pprocess, SIGNAL(finished(int)), SLOT(finished(int)));

    checkForUpdates();
}
コード例 #18
0
ファイル: TrayUI.cpp プロジェクト: yater/pcbsd
// ===============
//     PRIVATE SLOTS
// ===============
void TrayUI::watcherDirChange(){
  bool check = false;
  if(lastDirCheck.isNull()){ 
    //First time this has had a ping - always run it once
    check = true;
  }else{
    //Check that it is a relevant flag that was updated
    QDir procdir(UPDATE_PROC_DIR);
      QFileInfoList flags = procdir.entryInfoList(QStringList() << UPDATE_PROC_FLAG_FILE_FILTER, QDir::Files, QDir::Time);
      for(int i=0; i<flags.length(); i++){
        if(lastDirCheck < flags[i].lastModified()){
	  check=true; 
	  break;
	}
      }
  }
  if(check){ QTimer::singleShot(0,this, SLOT(checkForUpdates()) );  }
  lastDirCheck = QDateTime::currentDateTime();
}
コード例 #19
0
ファイル: TrayUI.cpp プロジェクト: TetragrammatonHermit/pcbsd
void TrayUI::slotCheckTimer()
{    
    int secsTo = QTime::currentTime().secsTo(nextCheckTime);
    //qDebug()<<secsTo;
    if (secsTo <= 0)
    {
        //It is time to check updates
        if ((PKGSTATUS == 3) || (PKGSTATUS==1)
          ||(WARDENSTATUS == 3) || (WARDENSTATUS == 1)
          ||(SYSSTATUS == 3) || (SYSSTATUS == 1))
        {
            //if busy now check after a minute
            nextCheckTime.addSecs(60);
            return;
        }
        qDebug()<<"Checking updates by schedule";
        checkForUpdates();
        nextCheckTime = QTime::currentTime().addSecs(currentCheckInterval * 60);
    }
}
コード例 #20
0
ファイル: HelpAppliance.cpp プロジェクト: arielmr/fotowall
HelpAppliance::HelpAppliance(QObject *parent)
  : QObject(parent)
  , m_helpScene(new HelpScene)
  , m_dummyWidget(new QWidget)
{
    // create the gui components over a dummy widget
    ui.setupUi(m_dummyWidget);
    ui.tutorialButton->setVisible(App::onlineServices->checkForTutorial());
    connect(App::onlineServices, SIGNAL(tutorialFound(bool)), ui.tutorialButton, SLOT(setVisible(bool)));
    connect(ui.webButton, SIGNAL(clicked()), App::onlineServices, SLOT(openWebpage()));
    connect(ui.blogButton, SIGNAL(clicked()), App::onlineServices, SLOT(openBlog()));
    connect(ui.tutorialButton, SIGNAL(clicked()), App::onlineServices, SLOT(openTutorial()));
    connect(ui.updateButton, SIGNAL(clicked()), App::onlineServices, SLOT(checkForUpdates()));

    // listen to scene events
    connect(m_helpScene->helpItem, SIGNAL(closeMe()), this, SLOT(slotClose()));

    // customize appliance
    sceneSet(m_helpScene);
    topbarAddWidget(ui.helpBox);
    setFocusToScene();
}
コード例 #21
0
UpdaterDialog::UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const char *const updateUrl)
:
	QDialog(parent),
	ui(new Ui::UpdaterDialog()),
	m_sysinfo(sysinfo),
	m_updateUrl(updateUrl),
	m_status(MUtils::UpdateChecker::UpdateStatus_NotStartedYet),
	m_thread(NULL),
	m_updaterProcess(NULL),
	m_success(false),
	m_firstShow(true)
{
	//Init the dialog, from the .ui file
	ui->setupUi(this);
	setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));

	//Fix size
	setFixedSize(size());

	//Enable buttons
	connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->buttonDownload, SIGNAL(clicked()), this, SLOT(installUpdate()));
	connect(ui->buttonRetry, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
	
	//Enable info label
	connect(ui->labelUrl, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
	
	//Init animation
	m_animator.reset(new QMovie(":/images/loading.gif"));
	ui->labelLoadingCenter->setMovie(m_animator.data());

	//Init buttons
	ui->buttonCancel->setEnabled(false);
	ui->buttonRetry->hide();
	ui->buttonDownload->hide();

	//Start animation
	SHOW_ANIMATION(true);
}
コード例 #22
0
ファイル: GeneralPage.cpp プロジェクト: Bodyfarm/vidalia
void
GeneralPage::updateNow()
{
  emit checkForUpdates();
}
コード例 #23
0
ファイル: main_window.cpp プロジェクト: gz818/itest
MainWindow::MainWindow()
{
    // User interface ----------------------------------------------------------
    if (tr("LTR") == "RTL") {
        qApp->setLayoutDirection(Qt::RightToLeft);
    }
    setupUi(this);
    network_access_manager = new QNetworkAccessManager(this);
    default_printer = NULL;
#ifdef Q_OS_MAC
    this->setUnifiedTitleAndToolBarOnMac(true);
#endif
    progressBar = new QProgressBar(this);
    progressBar->setTextVisible(false);
    progressBar->resize(QSize(30, 10));
    statusBar()->addPermanentWidget(progressBar, 0);
    statusBar()->setFixedHeight(20);
    progressBar->setFixedWidth(150);
    progressBar->setFixedHeight(15);
    progressBar->setVisible(false);
    LQCategoryComboBox->setVisible(false);
    SQStatisticsLabel->setVisible(false);
    currentSvgChanged();
    btnApply = SQButtonBox->button(QDialogButtonBox::Apply);
    btnApply->setText(tr("Apply"));
    btnApply->setStatusTip(tr("Apply any changes you have made to the question"));
    btnApply->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    btnDiscard = SQButtonBox->button(QDialogButtonBox::Discard);
    btnDiscard->setText(tr("Discard"));
    btnDiscard->setStatusTip(tr("Discard any changes you have made to the question"));
    btnDiscard->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    SQQuestionTextEdit->setTitle(tr("Question:"));
    SQQuestionTextEdit->textEdit()->setStatusTip(tr("Text of the selected question"));
    ECTextEdit->setTitle(tr("Comments:"));
    ECTextEdit->textEdit()->setStatusTip(tr("Use this field for your comments, notes, reminders..."));
    EFTreeWidget->setMouseTracking(true);
    EFTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed);
    EFTreeWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
    EFTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    EFButtonBox->button(QDialogButtonBox::Apply)->setText(tr("Apply"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setStatusTip(tr("Apply any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_ok.png")));
    EFButtonBox->button(QDialogButtonBox::Discard)->setText(tr("Discard"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setStatusTip(tr("Discard any changes you have made to the categories"));
    EFButtonBox->button(QDialogButtonBox::Discard)->setIcon(QIcon(QString::fromUtf8(":/images/images/button_cancel.png")));
    // Initialize variables ----------------------------------------------------
    // URLs
    docs_url = tr("http://itest.sourceforge.net/documentation/%1/en/").arg("1.4");
    // i18n
    QTranslator translator; translator.load(":/i18n/iTest-i18n.qm");
    itest_i18n.insert("English", "en");
    itest_i18n.insert(translator.translate("LanguageNames", "Slovak"), "sk");
    itest_i18n.insert(translator.translate("LanguageNames", "Russian"), "ru");
    itest_i18n.insert(translator.translate("LanguageNames", "Turkish"), "tr");
    itest_i18n.insert(translator.translate("LanguageNames", "Portuguese"), "pt");
    itest_i18n.insert(translator.translate("LanguageNames", "Spanish"), "es");
    itest_i18n.insert(translator.translate("LanguageNames", "Italian"), "it");
    itest_i18n.insert(translator.translate("LanguageNames", "Latvian"), "lv");
    itest_i18n.insert(translator.translate("LanguageNames", "Ukrainian"), "uk");
    itest_i18n.insert(translator.translate("LanguageNames", "Czech"), "cs");
    itest_i18n.insert(translator.translate("LanguageNames", "Hungarian"), "hu");
    itest_i18n.insert(translator.translate("LanguageNames", "German"), "de");
    // CURRENT_DB
    current_db_open = false;
    current_db_session = NULL;
    current_db_class = NULL;
    current_db_categories.resize(20);
    current_db_categories_enabled.resize(20);
    // Connect slots -----------------------------------------------------------
    tbtnAddQuestion->setDefaultAction(actionAdd);
    tbtnDuplicateQuestion->setDefaultAction(actionDuplicate);
    tbtnDeleteQuestion->setDefaultAction(actionDelete);
    QObject::connect(actionAdd, SIGNAL(triggered()), this, SLOT(addQuestion()));
    QObject::connect(actionDelete, SIGNAL(triggered()), this, SLOT(deleteQuestion()));
    QObject::connect(actionDuplicate, SIGNAL(triggered()), this, SLOT(duplicateQuestion()));
    QObject::connect(btnApply, SIGNAL(released()), this, SLOT(applyQuestionChanges()));
    QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(applyQuestionChanges()));
    QObject::connect(btnDiscard, SIGNAL(released()), this, SLOT(discardQuestionChanges()));
    QObject::connect(actionDiscard, SIGNAL(triggered()), this, SLOT(discardQuestionChanges()));

    QObject::connect(actionNew, SIGNAL(triggered()), this, SLOT(newDB()));
    QObject::connect(btnNew, SIGNAL(released()), this, SLOT(newDB()));
    QObject::connect(actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    QObject::connect(btnOpenOther, SIGNAL(released()), this, SLOT(open()));
    QObject::connect(btnOpenSelected, SIGNAL(released()), this, SLOT(openRecent()));
    QObject::connect(actionSave, SIGNAL(triggered()), this, SLOT(save()));
    QObject::connect(actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
    QObject::connect(actionSave_a_copy, SIGNAL(triggered()), this, SLOT(saveCopy()));
    QObject::connect(actionExport_CSV, SIGNAL(triggered()), this, SLOT(exportCSV()));
    QObject::connect(actionClose, SIGNAL(triggered()), this, SLOT(closeDB()));
    QObject::connect(actionQuit, SIGNAL(triggered()), this, SLOT(quit()));
    QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    QObject::connect(recentDBsListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(openRecent(QListWidgetItem *)));
    QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion()));

    QObject::connect(actionFrom_A_to_Z, SIGNAL(triggered()), this, SLOT(sortQuestionsAscending()));
    QObject::connect(actionFrom_Z_to_A, SIGNAL(triggered()), this, SLOT(sortQuestionsDescending()));
    QObject::connect(actionBy_category, SIGNAL(triggered()), this, SLOT(sortQuestionsByCategory()));

    tbtnAddSVG->setDefaultAction(actionAdd_SVG);
    tbtnRemoveSVG->setDefaultAction(actionRemove_SVG);
    tbtnEditSVG->setDefaultAction(actionEdit_SVG);
    tbtnExportSVG->setDefaultAction(actionExport_SVG);
    QObject::connect(actionAdd_SVG, SIGNAL(triggered()), this, SLOT(addSvg()));
    QObject::connect(actionRemove_SVG, SIGNAL(triggered()), this, SLOT(removeSvg()));
    QObject::connect(actionEdit_SVG, SIGNAL(triggered()), this, SLOT(editSvg()));
    QObject::connect(actionExport_SVG, SIGNAL(triggered()), this, SLOT(exportSvg()));
    QObject::connect(SQSVGListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(previewSvg(QListWidgetItem *)));
    QObject::connect(SQSVGListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(currentSvgChanged()));

    tbtnMoveUp->setDefaultAction(actionMove_up);
    tbtnMoveDown->setDefaultAction(actionMove_down);
    QObject::connect(actionMove_up, SIGNAL(triggered()), this, SLOT(moveUp()));
    QObject::connect(actionMove_down, SIGNAL(triggered()), this, SLOT(moveDown()));
    QObject::connect(actionMove_to_top, SIGNAL(triggered()), this, SLOT(moveToTop()));
    QObject::connect(actionMove_to_bottom, SIGNAL(triggered()), this, SLOT(moveToBottom()));
    QObject::connect(actionHide, SIGNAL(triggered()), this, SLOT(hideQuestion()));
    QObject::connect(actionShow_hidden, SIGNAL(triggered()), this, SLOT(filterLQSearch()));

    rbtngrpFilterLQ = new QButtonGroup(this);
    rbtngrpFilterLQ->addButton(LQAllRadioButton);
    rbtngrpFilterLQ->addButton(LQEasyRadioButton);
    rbtngrpFilterLQ->addButton(LQMediumRadioButton);
    rbtngrpFilterLQ->addButton(LQDifficultRadioButton);
    rbtngrpFilterLQ->addButton(LQCategoryRadioButton);

    actgrpFilterLQ = new QActionGroup(this);
    actgrpFilterLQ->addAction(actionShow_all);
    actgrpFilterLQ->addAction(actionShow_easy);
    actgrpFilterLQ->addAction(actionShow_medium);
    actgrpFilterLQ->addAction(actionShow_difficult);
    actgrpFilterLQ->addAction(actionShow_category);

    QObject::connect(rbtngrpFilterLQ, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(filterLQ(QAbstractButton *)));
    QObject::connect(actgrpFilterLQ, SIGNAL(triggered(QAction *)), this, SLOT(filterLQAction(QAction *)));
    QObject::connect(LQCategoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterLQCategoryChanged()));
    QObject::connect(LQSearchLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterLQSearch()));
    QObject::connect(tbtnSearchByGroup, SIGNAL(released()), this, SLOT(searchByGroup()));

    actgrpPage = new QActionGroup(this);
    actgrpPage->addAction(actionEdit_questions);
    actgrpPage->addAction(actionEdit_comments);
    actgrpPage->addAction(actionEdit_categories);
    actgrpPage->addAction(actionEdit_test);
    actgrpPage->addAction(actionSaved_sessions);
    actgrpPage->addAction(actionEdit_classes);

    QObject::connect(actgrpPage, SIGNAL(triggered(QAction *)), this, SLOT(setPage(QAction *)));

    //QObject::connect(btnApply, SIGNAL(released()), this, SLOT(setDatabaseModified()));
    //QObject::connect(actionApply, SIGNAL(triggered()), this, SLOT(setDatabaseModified()));
    QObject::connect(ECTextEdit, SIGNAL(textChanged()), this, SLOT(setDatabaseModified()));

    QObject::connect(actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
    QObject::connect(network_access_manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(httpRequestFinished(QNetworkReply *)));
    QObject::connect(actionDocumentation, SIGNAL(triggered()), this, SLOT(openDocumentation()));
    QObject::connect(SQStatisticsLabel, SIGNAL(linkActivated(QString)), this, SLOT(adjustQuestionDifficulty()));
    QObject::connect(actionPrint_questions, SIGNAL(triggered()), this, SLOT(showPrintQuestionsDialogue()));
    QObject::connect(actionOverall_statistics, SIGNAL(triggered()), this, SLOT(overallStatistics()));
    QObject::connect(actionChange_language, SIGNAL(triggered()), this, SLOT(changeLanguage()));

    QObject::connect(mainStackedWidget, SIGNAL(currentChanged(int)), this, SLOT(currentPageChanged(int)));
    // Disable all -------------------------------------------------------------
    setAllEnabled(false);
    // Categories -------------------------------------------------------------------
    setupCategoriesPage();
    // Server ------------------------------------------------------------------
    setupServer();
    // Session viewer ----------------------------------------------------------
    setupSessionViewer();
    // Class viewer ------------------------------------------------------------
    setupClassViewer();
    // -------------------------------------------------------------------------
#ifdef Q_OS_MAC
    show();
#endif
    // Load settings -----------------------------------------------------------
    loadSettings();
    // Ready -------------------------------------------------------------------
    statusBar()->showMessage(tr("Ready"), 10000);
    // Check app args ----------------------------------------------------------
    if (qApp->arguments().count() > 1) {
        openFile(qApp->arguments().at(1));
    }
    // -------------------------------------------------------------------------
#ifndef Q_OS_MAC
    show();
#endif
}
コード例 #24
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //objet pour la gestion des réglages
    settingsTable = new QSettings("outadoc", "FreeStance");

    options = new Options(this);
    about = new About(this);
    help = new Help(this);
    settings = new AppSettings;

    //on vérifie les mises à jour
    checkForUpdates();

    bool hasBeenSet = settingsTable->value("hasBeenSet", false).toBool();
    //si le programme n'a jamais été utilisé...
    if(hasBeenSet != true)
    {
        settingsTable->setValue("hasBeenSet", false);
        options->show();
    }

    //on centre la fenêtre
    QDesktopWidget *widget = QApplication::desktop();
    int desktop_width = widget->width();
    int desktop_height = widget->height();
    int x = desktop_width / 2 - width() / 2;
    int y = desktop_height / 2 - height() / 2 - 25;
    move(QPoint(x, y));

    //on récupère le dernier profil utilisé pour l'utiliser par défaut dans le programme
    if(settings->getProfileToUse() == 1)
    {
        ui->actionProfil_1->setChecked(true);
        ui->actionProfil_2->setChecked(false);
        ui->actionProfil_3->setChecked(false);
    }

    else if (settings->getProfileToUse() == 2)
    {
        ui->actionProfil_1->setChecked(false);
        ui->actionProfil_2->setChecked(true);
        ui->actionProfil_3->setChecked(false);
    }

    else if(settings->getProfileToUse() == 3)
    {
        ui->actionProfil_1->setChecked(false);
        ui->actionProfil_2->setChecked(false);
        ui->actionProfil_3->setChecked(true);
    }

    //url pour les programmes tv
    setProgrammetvNetUrl(QUrl(tr("http://www.programme-tv.net/programme/free-13/")));
    setProgrammeTvUrl(QUrl(tr("http://dev.outadoc.fr/freestance/tvprog.html")));
    setCesoirtvComUrl(QUrl(tr("http://cesoirtv.com/")));
    setTvmagComUrl(QUrl(tr("http://www.tvmag.com/programme-tv/guide-tele.html?boId=2")));
    setTvexpressComUrl(QUrl(tr("http://tv-express.com/")));
    setHomepage(getTvexpressComUrl());

    //chargement du guide epg
    webbrowser = new QWebView;
    vbox = new QVBoxLayout;
    vbox->addWidget(webbrowser);
    ui->web_frame->setLayout(vbox);
    ui->prgrbar_browser->setVisible(false);
    webbrowser->load(getHomepage());

    //connections pour l'epg
    connect(ui->b_refresh, SIGNAL(clicked()), webbrowser, SLOT(reload()));
    connect(ui->b_prev, SIGNAL(clicked()), webbrowser, SLOT(back()));
    connect(ui->b_fw, SIGNAL(clicked()), webbrowser, SLOT(forward()));
    connect(ui->cbox_site, SIGNAL(currentIndexChanged(int)), this, SLOT(changeWebsite(int)));
    connect(webbrowser, SIGNAL(loadStarted()), this, SLOT(beginLoading()));
    connect(webbrowser, SIGNAL(loadProgress(int)), this, SLOT(loading(int)));
    connect(webbrowser, SIGNAL(loadFinished(bool)), this, SLOT(stopLoading(bool)));
    connect(ui->actionPr_f_rences, SIGNAL(triggered()), options, SLOT(show()));
    connect(ui->actionV_rifier_les_mises_jour, SIGNAL(triggered()), SLOT(checkForUpdates()));

    //on affiche la version dans le bas
    ui->lbl_actual_version->setText(VERSION);

    //le stay on top ne marche pas pour le moment, donc
    ui->actionToujours_au_dessus->setVisible(false);
}
コード例 #25
0
ファイル: MainApp.cpp プロジェクト: STJrInuyasha/SLADE
/* MainApp::OnInit
 * Application initialization, run when program is started
 *******************************************************************/
bool MainApp::OnInit()
{
	// Set locale to C so that the tokenizer will work properly
	// even in locales where the decimal separator is a comma.
	setlocale(LC_ALL, "C");

	// Init global variables
	Global::error = "";
	ArchiveManager::getInstance();
	init_ok = false;

	// Init variables
	action_invalid = new SAction("invalid", "Invalid Action", "", "Something's gone wrong here");

	// Setup system options
	wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1);

	// Set application name (for wx directory stuff)
#ifdef __WINDOWS__
	wxApp::SetAppName("SLADE3");
#else
	wxApp::SetAppName("slade3");
#endif

	// Handle exceptions using wxDebug stuff, but only in release mode
#ifdef NDEBUG
	wxHandleFatalExceptions(true);
#endif

	// Init application directories
	if (!initDirectories())
		return false;

	// Load image handlers
	wxInitAllImageHandlers();

	// Init logfile
	initLogFile();

	// Init keybinds
	KeyBind::initBinds();

	// Load configuration file
	wxLogMessage("Loading configuration");
	readConfigFile();
	Global::log_verbosity = log_verbosity;

	// Check that SLADE.pk3 can be found
	wxLogMessage("Loading resources");
	theArchiveManager->init();
	if (!theArchiveManager->resArchiveOK())
	{
		wxMessageBox("Unable to find slade.pk3, make sure it exists in the same directory as the SLADE executable", "Error", wxICON_ERROR);
		return false;
	}

	// Init lua
	Lua::init();

	// Calculate scaling factor (from system ppi)
	wxMemoryDC dc;
	Global::ppi_scale = (double)(dc.GetPPI().x) / 96.0;

	// Show splash screen
	theSplashWindow->init();
	theSplashWindow->show("Starting up...");

	// Init SImage formats
	SIFormat::initFormats();

	// Load program icons
	wxLogMessage("Loading icons");
	loadIcons();

	// Load program fonts
	Drawing::initFonts();

	// Load entry types
	wxLogMessage("Loading entry types");
	EntryDataFormat::initBuiltinFormats();
	EntryType::loadEntryTypes();

	// Load text languages
	wxLogMessage("Loading text languages");
	TextLanguage::loadLanguages();

	// Init text stylesets
	wxLogMessage("Loading text style sets");
	StyleSet::loadResourceStyles();
	StyleSet::loadCustomStyles();

	// Init colour configuration
	wxLogMessage("Loading colour configuration");
	ColourConfiguration::init();

	// Init nodebuilders
	NodeBuilders::init();

	// Init game executables
	Executables::init();

	// Init actions
	initActions();
	theMainWindow;

	// Init base resource
	wxLogMessage("Loading base resource");
	theArchiveManager->initBaseResource();
	wxLogMessage("Base resource loaded");

	// Show the main window
	theMainWindow->Show(true);
	SetTopWindow(theMainWindow);
	theSplashWindow->SetParent(theMainWindow);
	theSplashWindow->CentreOnParent();

	// Open any archives on the command line
	// argv[0] is normally the executable itself (i.e. Slade.exe)
	// and opening it as an archive should not be attempted...
	for (int a = 1; a < argc; a++)
	{
		string arg = argv[a];
		theArchiveManager->openArchive(arg);
	}

	// Hide splash screen
	theSplashWindow->hide();

	init_ok = true;
	wxLogMessage("SLADE Initialisation OK");

	// Init game configuration
	theGameConfiguration->init();

	// Show Setup Wizard if needed
	if (!setup_wizard_run)
	{
		SetupWizardDialog dlg(theMainWindow);
		dlg.ShowModal();
		setup_wizard_run = true;
	}

	// Check for updates
#ifdef __WXMSW__
	wxHTTP::Initialize();
	if (update_check)
		checkForUpdates(false);
#endif

	// Bind events
	Bind(wxEVT_MENU, &MainApp::onMenu, this);
	Bind(wxEVT_COMMAND_VERSIONCHECK_COMPLETED, &MainApp::onVersionCheckCompleted, this);

	return true;
}
コード例 #26
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    pDetectorProgress = NULL;
    mLogAllXmlRpcOutput = false;
    mDbUpdated = false;
    // mSyncRequests tracks how many sync requests have been made
    // in order to know when to re-enable the widgets
    mSyncRequests = 0;
    // mSyncPosition is used to iterate through the backend list,
    // so we only sync one repository at a time, rather than flinging
    // requests at all of them at once.
    mSyncPosition = 0;
    mUploading = false;
    QSettings settings("Entomologist");

    pManager = new QNetworkAccessManager();
    connect(pManager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)),
            this, SLOT(handleSslErrors(QNetworkReply *, const QList<QSslError> &)));

    ui->setupUi(this);

    QToolBar *toolBar = new QToolBar("Main Toolbar");
    toolBar->setObjectName("Main ToolBar");
    toolBar->setIconSize(QSize(32,32));
    refreshButton = toolBar->addAction(style()->standardIcon(QStyle::SP_BrowserReload), "");
    refreshButton->setToolTip("Resync all trackers");
    uploadButton = toolBar->addAction(style()->standardIcon(QStyle::SP_ArrowUp), "");
    uploadButton->setToolTip("Upload changes");
    changelogButton = toolBar->addAction(style()->standardIcon(QStyle::SP_FileDialogInfoView), "");
    changelogButton->setToolTip("Show changelog");
    toolBar->setMovable(false);
    addToolBar(Qt::TopToolBarArea, toolBar);


    setupTrayIcon();
    // Setup the "Show" menu and "Work Offline"
    ui->actionMy_Bugs->setChecked(settings.value("show-my-bugs", true).toBool());
    ui->actionMy_Reports->setChecked(settings.value("show-my-reports", true).toBool());
    ui->actionMy_CCs->setChecked(settings.value("show-my-ccs", true).toBool());
    ui->actionMonitored_Components->setChecked(settings.value("show-my-monitored", true).toBool());
    ui->action_Work_Offline->setChecked(settings.value("work-offline", false).toBool());

    // Set the default network status
    pStatusIcon = new QLabel();
    pStatusIcon->setPixmap(QPixmap(":/online"));
    pStatusMessage = new QLabel("");
    ui->statusBar->addPermanentWidget(pStatusMessage);
    ui->statusBar->addPermanentWidget(pStatusIcon);

    // We use a spinner animation to show that we're doing things
    pSpinnerMovie = new QMovie(this);
    pSpinnerMovie->setFileName(":/spinner");
    pSpinnerMovie->setScaledSize(QSize(48,48));
    ui->spinnerLabel->setMovie(pSpinnerMovie);
    ui->spinnerLabel->hide();
    ui->syncingLabel->hide();

    // Set up the resync timer
    pUpdateTimer = new QTimer(this);
    connect(pUpdateTimer, SIGNAL(timeout()),
            this, SLOT(resync()));
    setTimer();

    // Keyboard shortcuts for search bar focus / upload changes.
    QShortcut* searchFocus;
    QShortcut* uploadChange;
    QShortcut *logXmlRpc;

    searchFocus = new QShortcut(QKeySequence(Qt::META + Qt::Key_Space),this);
    searchFocus->setContext(Qt::ApplicationShortcut);
    connect(searchFocus,SIGNAL(activated()),this,SLOT(searchFocusTriggered()));

    uploadChange = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this);
    uploadChange->setContext(Qt::ApplicationShortcut);
    connect(uploadChange,SIGNAL(activated()),this,SLOT(upload()));

    logXmlRpc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this);
    logXmlRpc->setContext(Qt::ApplicationShortcut);
    connect(logXmlRpc, SIGNAL(activated()), this, SLOT(toggleXmlRpcLogging()));

    // Menu actions
    connect(ui->action_Add_Tracker, SIGNAL(triggered()),
            this, SLOT(addTrackerTriggered()));
    connect(ui->action_Refresh_Tracker,SIGNAL(triggered()),
            this, SLOT(resync()));
    connect(ui->actionShow_ToDo_List, SIGNAL(triggered()),
            this, SLOT(showTodoList()));
    connect(ui->action_About, SIGNAL(triggered()),
            this, SLOT(aboutTriggered()));
    connect(ui->action_Web_Site, SIGNAL(triggered()),
            this, SLOT(websiteTriggered()));
    connect(ui->action_Preferences, SIGNAL(triggered()),
            this, SLOT(prefsTriggered()));
    connect(ui->action_Quit, SIGNAL(triggered()),
            this, SLOT(quitEvent()));
    connect(ui->actionMy_Bugs, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMy_CCs, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMy_Reports, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMonitored_Components, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionEdit_Monitored_Components, SIGNAL(triggered()),
            this, SLOT(showEditMonitoredComponents()));
    connect(ui->action_Work_Offline, SIGNAL(triggered()),
            this, SLOT(workOfflineTriggered()));

    // Set up the search button
    connect(changelogButton, SIGNAL(triggered()),
            this, SLOT(changelogTriggered()));

    connect(ui->trackerTab, SIGNAL(showMenu(int)),
            this, SLOT(showMenu(int)));
    ui->trackerTab->removeTab(0);
    ui->trackerTab->removeTab(0);

    // And finally set up the various other widgets
    connect(refreshButton, SIGNAL(triggered()),
            this, SLOT(resync()));
    connect(uploadButton, SIGNAL(triggered()),
            this, SLOT(upload()));
    restoreGeometry(settings.value("window-geometry").toByteArray());
    // Set the network status bar and check for updates if possible
    if (isOnline())
        if (settings.value("update-check", true).toBool() == true)
            checkForUpdates();

    setupDB();
    toggleButtons();

    // Now we need the todo list widget
    pToDoDock = new QDockWidget(tr("ToDo List"), this);
    pToDoDock->setObjectName("ToDoDock");
    pToDoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    pToDoListWidget = new ToDoListWidget(pToDoDock);
    pToDoDock->setWidget(pToDoListWidget);
    addDockWidget(Qt::LeftDockWidgetArea, pToDoDock);
    pToDoDock->hide();
    restoreState(settings.value("entomologist-state").toByteArray());
    connect(pToDoDock, SIGNAL(visibilityChanged(bool)),
            this, SLOT(dockVisibilityChanged(bool)));
    if (pToDoDock->isVisible())
        ui->actionShow_ToDo_List->setText("Hide ToDo List");
    else
        ui->actionShow_ToDo_List->setText("Show ToDo List");

    pSearchTab = new SearchTab(this);
    connect(pSearchTab, SIGNAL(openSearchedBug(QString,QString)),
            this, SLOT(openSearchedBug(QString,QString)));

    loadTrackers();
    ui->trackerTab->addTab(pSearchTab, QIcon(":/search"), "Search");

    if ((settings.value("startup-sync", false).toBool() == true)
       || (mDbUpdated))
        syncNextTracker();
}
コード例 #27
0
ファイル: TrayUI.cpp プロジェクト: yater/pcbsd
void TrayUI::slotCheckJailsClicked(){
  settings->setValue("/PC-BSD/SystemUpdater/checkJails",checkJails->isChecked());
  settings->sync();
  QTimer::singleShot(0,this, SLOT(checkForUpdates()) ); //since the types of checks has changed	
}
コード例 #28
0
ファイル: TrayUI.cpp プロジェクト: yater/pcbsd
//PUBLIC
TrayUI::TrayUI() : QSystemTrayIcon(){
  qDebug() << "Starting Up System Updater Tray...";
  PerformingCheck = false; //initial value
  settings = new QSettings("PCBSD");
    settings->sync();
  watcher = new QFileSystemWatcher();
    connect(watcher, SIGNAL( fileChanged(QString) ), this, SLOT(watcherFileChange(QString)) ); //specific file changed
    connect(watcher, SIGNAL( directoryChanged(QString) ), this, SLOT(watcherDirChange()) ); //directory changed
	
  checkTimer = new QTimer(this);
    checkTimer->setInterval(5*60000); //every 5 minutes
    connect(checkTimer, SIGNAL(timeout()), this, SLOT(checkForUpdates()) );
	
  //Create the Menu
  mainMenu = new QMenu();
    this->setContextMenu( mainMenu ); 
    connect(mainMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemClicked(QAction*)) );
  //Populate the menu
  QAction *tmp = mainMenu->addAction(QIcon(":/images/updated.png"), tr("Start the Update Manager") );
	tmp->setWhatsThis("sys");
  mainMenu->addSeparator();
  tmp = mainMenu->addAction(QIcon(":/images/appcafe.png"), tr("Start the AppCafe") );
	tmp->setWhatsThis("pkg");
  tmp = mainMenu->addAction(QIcon(":/images/warden.png"), tr("Start the Warden") );
	tmp->setWhatsThis("warden");
  mainMenu->addSeparator();
  tmp = mainMenu->addAction(QIcon(":/images/view-refresh.png"), tr("Check for Updates") );
	tmp->setWhatsThis("update");
  mainMenu->addSeparator();
  // - Now the special checkboxes
  runAtStartup = new QCheckBox(tr("Run At Startup"));
    runAtStartup->setChecked(settings->value("/PC-BSD/SystemUpdater/runAtStartup",true).toBool() );
    connect(runAtStartup, SIGNAL(clicked()), this, SLOT(slotRunAtStartupClicked()) );
  rasA = new QWidgetAction(this);
    rasA->setDefaultWidget(runAtStartup);
  mainMenu->addAction(rasA);
  showNotifications = new QCheckBox(tr("Display Notifications"));
    showNotifications->setChecked(settings->value("/PC-BSD/SystemUpdater/displayPopup",true).toBool() );
    connect(showNotifications, SIGNAL(clicked()), this, SLOT(slotShowMessagesClicked()) );
  snA = new QWidgetAction(this);
    snA->setDefaultWidget(showNotifications);
  mainMenu->addAction(snA);
  checkJails = new QCheckBox(tr("Check Jails"));
    checkJails->setChecked(settings->value("/PC-BSD/SystemUpdater/watchJails",false).toBool() );
    connect(checkJails, SIGNAL(clicked()), this, SLOT(slotCheckJailsClicked()) );
 cjA = new QWidgetAction(this);
    cjA->setDefaultWidget(checkJails);
  mainMenu->addAction(cjA);
  mainMenu->addSeparator();
  torMode = new QCheckBox(tr("Routing through Tor"));
    torMode->setChecked( CSTAT.InTorMode() );
    connect(torMode, SIGNAL(clicked()), this, SLOT(slotToggleTorMode()) );
  tmA = new QWidgetAction(this);
    tmA->setDefaultWidget(torMode);
  mainMenu->addAction(tmA);
  mainMenu->addAction(QIcon(":/images/tor.png"), tr("Check Tor connection"), this, SLOT(slotCheckTorStatus()) );
  mainMenu->addSeparator();
  // - Now the quit option
  tmp = mainMenu->addAction(tr("Quit") );
	tmp->setWhatsThis("quit");
  //Initialize the backend systems  
  UpdateAUNotice(); //make sure that we get an icon/info right away
  QTimer::singleShot(1000, this, SLOT(BackendResync()) ); //wait one second before prodding syscache to start a sync
  QTimer::singleShot(15000, this, SLOT(checkForUpdates()) ); //Wait 15 seconds to perform the first update check
  checkTimer->start();
}
コード例 #29
0
ファイル: TrayUI.cpp プロジェクト: TetragrammatonHermit/pcbsd
//PUBLIC
TrayUI::TrayUI() : QSystemTrayIcon(){
  qDebug() << "Starting Up System Updater Tray...";
  //Set all the initial flags ( <0 means do initial checks if appropriate)
  PKGSTATUS=-1;
  SYSSTATUS=-1;
  WARDENSTATUS=-1;
  noInternet = false; //assume internet is available until we get a failure
  wasworking = false;
  //Load the tray settings file
  settings = new QSettings("PCBSD");
    settings->sync(); //make sure to load it right away
  //Setup the checktimer
  chktime = new QTimer(this);
	chktime->setInterval(1000 * 60 * 60 * 24); //every 24 hours
	connect(chktime, SIGNAL(timeout()), this, SLOT(checkForUpdates()) );
  //Generate the Menu
  menu = new QMenu(0);
  this->setContextMenu(menu);
  connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemClicked(QAction*)) );
  //Now fill the menu with items
    // - System Update Manager
  QAction* act = new QAction( QIcon(":/images/sysupdater.png"), tr("Start the Update Manager"), this);
	act->setWhatsThis("sys"); //system updater code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - AppCafe
  act = new QAction( QIcon(":/images/appcafe.png"), tr("Start the AppCafe"), this);
	act->setWhatsThis("pkg"); // PKG code
	menu->addAction(act);
    // - Warden
  act = new QAction( QIcon(":/images/warden.png"), tr("Start the Warden"), this);
	act->setWhatsThis("warden"); //warden code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Check for Updates
  act = new QAction( QIcon(":/images/view-refresh.png"), tr("Check For Updates"), this);
	act->setWhatsThis("update"); //update check code
	menu->addAction(act);
    // - Separator
  menu->addSeparator();
    // - Run At Startup Checkbox
  runAtStartup = new QCheckBox(tr("Run At Startup"), 0);
    runAtStartup->setChecked( settings->value("/PC-BSD/SystemUpdater/runAtStartup",true).toBool() );
    connect(runAtStartup, SIGNAL(clicked()), this, SLOT(slotRunAtStartupClicked()) );
  rasAct = new QWidgetAction(this);
    rasAct->setDefaultWidget(runAtStartup);
    menu->addAction(rasAct);
    // - Display Notifications Checkbox
  showNotifications = new QCheckBox(tr("Display Notifications"), 0);
    showNotifications->setChecked( settings->value("/PC-BSD/SystemUpdater/displayPopup",true).toBool() );
    connect(showNotifications, SIGNAL(clicked()), this, SLOT(slotShowMessagesClicked()) );
  snAct = new QWidgetAction(this);
    snAct->setDefaultWidget(showNotifications);
    menu->addAction(snAct);   

  makeScheduleMenu();
  menu->addAction(tr("Automatic updates check"))->setMenu(schedule_menu);

    // - Separator
  menu->addSeparator();
    // - Warden
  act = new QAction( tr("Quit"), this);
	act->setWhatsThis("quit"); //system updater code
	menu->addAction(act);

  //Now Update the tray visuals
  updateTrayIcon();
  updateToolTip();
  //Start up the system flag watcher and connect the signals/slots
  watcher = new SystemFlagWatcher(this);
	connect(watcher,SIGNAL(FlagChanged(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)),this,SLOT(watcherMessage(SystemFlags::SYSFLAG, SystemFlags::SYSMESSAGE)) );
  //watcher->checkForRecent(10); //Check for flags in the last 10 minutes
  
  //Now connect the tray clicked signal
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)) );
  connect(this, SIGNAL(messageClicked()), this, SLOT(launchApp()) );
  
  //Startup the initial checks in 1 minute
  QTimer::singleShot(60000, this, SLOT(startupChecks()));

  //Periodically check timer start
  checkTimer=new QTimer(this);
  checkTimer->setInterval(60000); // 1min
  connect(checkTimer, SIGNAL(timeout()), this, SLOT(slotCheckTimer()));
  checkTimer->start();

}
コード例 #30
0
ファイル: updatewindow.cpp プロジェクト: sonic414/lmc-clone
void lmcUpdateWindow::btnRecheck_clicked(void) {
	checkForUpdates();
}