コード例 #1
0
void BrowserProcessImpl::EndSession()
{
    // Mark all the profiles as clean.
    ProfileManager* pm = profile_manager();
    std::vector<Profile*> profiles(pm->GetLoadedProfiles());
    for(size_t i=0; i<profiles.size(); ++i)
    {
        profiles[i]->MarkAsCleanShutdown();
    }

    // Tell the metrics service it was cleanly shutdown.
    //MetricsService* metrics = g_browser_process->metrics_service();
    //if(metrics && local_state())
    //{
    //    metrics->RecordStartOfSessionEnd();

    //    // MetricsService lazily writes to prefs, force it to write now.
    //    local_state()->SavePersistentPrefs();
    //}

    // We must write that the profile and metrics service shutdown cleanly,
    // otherwise on startup we'll think we crashed. So we block until done and
    // then proceed with normal shutdown.
    //BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
    //    NewRunnableFunction(PostQuit, MessageLoop::current()));
    MessageLoop::current()->Run();
}
コード例 #2
0
ファイル: profile.cpp プロジェクト: Artox/qtmoko
void Profile::loadProfile(const QString& name)
{
  QSettings profiles("Trolltech","qterminal");
  
  m_name = name;
  profiles.beginGroup(name);
  m_command = profiles.value("command","/bin/bash").toString();
  m_ioLayer = profiles.value("ioLayer","Pty").toByteArray();
  m_term = profiles.value("term","linux").toByteArray();
  m_autoConnect = profiles.value("autoConnect",0).toInt();
  m_colorScheme = profiles.value("colorScheme","Linux").toString();
  m_keyboard = profiles.value("keyboard", "linux").toString();
  m_terminal = 0;
#ifdef QTOPIA_PHONE
  m_fontName = profiles.value("fontName", "dejavu-mono").toString();
  /* probably too small for Universal (480x640) but good for 240x320...*/
  m_fontSize = profiles.value("fontSize", 5).toInt(); 
#else
  m_fontName = profiles.value("fontName", "Courier New").toString();
  m_fontSize = profiles.value("fontSize", 12).toInt();
#endif
  m_fontStyle = profiles.value("fontStyle", 0).toInt();
  m_cursorShape = profiles.value("cursorShape", 0).toInt();
  m_historyLines = profiles.value("historyLines", 50).toInt();
}
コード例 #3
0
QString OptionsManager::lastActiveProfile() const
{
	QDateTime lastModified;
	QString lastProfile;
	foreach(QString profile, profiles())
	{
		QFileInfo info(profilePath(profile) + "/" FILE_OPTIONS);
		if (info.exists() && info.lastModified()>lastModified)
		{
			lastProfile = profile;
			lastModified = info.lastModified();
		}
	}
コード例 #4
0
ファイル: frmconnexion.cpp プロジェクト: CPI4Admin/BomberMan
void frmConnexion::CreationProfil()
{
    QMessageBox msg;
    if(ui->txtPassword->text() == "")
    {
        msg.setText("Vous devez impérativement rentrer un mot de passe.");
        msg.exec();
    }else if(ui->txtPseudo->text() == "")
    {
        msg.setText("Vous devez impérativement rentrer un pseudo.");
        msg.exec();
    }
    else
    {
        /*TODO: Ecrire le fichier profiles.csv*/

        QString pseudo = ui->txtPseudo->text();
        QString motdepasse = ui->txtPassword->text();

        QFile profiles(QApplication::applicationDirPath() +"/profiles.csv");
        if (profiles.open(QIODevice::Append | QIODevice::Text))
        {
            QTextStream flux(&profiles);
            QString contenu = flux.readAll();
            QString texte = contenu + "\n" + pseudo+ ";" + motdepasse+ ";0;0;0;0";
            flux << texte;

            profiles.close();

            currentProfile::getInstance(pseudo,motdepasse,0,0,0,0);

            msg.setText("Connecté au profil: " + currentProfile::getInstance()->getPseudo());
            msg.exec();
            emit connexionOk();
            this->close();
        }
        else
        {
            msg.setText("Problème d'accès au fichier profiles.csv.");
            msg.exec();
        }

    }
}
コード例 #5
0
void ContentBlockingInformationWidget::toggleOption(QAction *action)
{
	if (action && m_window && !action->data().isNull())
	{
		const QString profile(action->data().toString());
		QStringList profiles(m_window->getOption(SettingsManager::ContentBlocking_ProfilesOption).toStringList());

		if (!action->isChecked())
		{
			profiles.removeAll(profile);
		}
		else if (!profiles.contains(profile))
		{
			profiles.append(profile);
		}

		m_window->setOption(SettingsManager::ContentBlocking_ProfilesOption, profiles);
	}
}
コード例 #6
0
ファイル: profile.cpp プロジェクト: Artox/qtmoko
void Profile::saveProfile(const QString& name)
{
  QSettings profiles("Trolltech","qterminal");

  profiles.beginGroup(name);
  profiles.setValue("command",m_command);
  profiles.setValue("ioLayer",QString(m_ioLayer));
  profiles.setValue("term",QString(m_term));
  profiles.setValue("autoConnect",m_autoConnect);
  profiles.setValue("colorScheme",m_colorScheme);
  profiles.setValue("keyboard", m_keyboard);
  profiles.setValue("fontName", m_fontName);
  profiles.setValue("fontSize", m_fontSize);
  profiles.setValue("fontStyle", m_fontStyle);
  profiles.setValue("cursorShape", m_cursorShape);
  profiles.setValue("historyLines", m_historyLines);
  profiles.sync(); 

}
コード例 #7
0
void QgsRasterFormatSaveOptionsWidget::updateProfiles()
{
  // build profiles list = user + builtin(last)
  QString format = mPyramids ? "_pyramids" : mFormat;
  QStringList profileKeys = profiles();
  QMapIterator<QString, QStringList> it( mBuiltinProfiles );
  while ( it.hasNext() )
  {
    it.next();
    QString profileKey = it.key();
    if ( ! profileKeys.contains( profileKey ) && !it.value().isEmpty() )
    {
      // insert key if is for all formats or this format (GTiff)
      if ( it.value()[0] == "" ||  it.value()[0] == format )
      {
        profileKeys.insert( 0, profileKey );
      }
    }
  }
  qSort( profileKeys );

  // populate mOptionsMap and mProfileComboBox
  mOptionsMap.clear();
  mProfileComboBox->blockSignals( true );
  mProfileComboBox->clear();
  Q_FOREACH ( const QString& profileKey, profileKeys )
  {
    QString profileName, profileOptions;
    profileOptions = createOptions( profileKey );
    if ( mBuiltinProfiles.contains( profileKey ) )
    {
      profileName = mBuiltinProfiles[ profileKey ][ 1 ];
      if ( profileOptions.isEmpty() )
        profileOptions = mBuiltinProfiles[ profileKey ][ 2 ];
    }
    else
    {
      profileName = profileKey;
    }
    mOptionsMap[ profileKey ] = profileOptions;
    mProfileComboBox->addItem( profileName, profileKey );
  }
コード例 #8
0
ファイル: MainWindow.cpp プロジェクト: YAYPony/MultiMC5
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
	MultiMCPlatform::fixWM_CLASS(this);
	ui->setupUi(this);

	QString winTitle = QString("MultiMC 5 - Version %1").arg(BuildConfig.printableVersionString());
	if (!BuildConfig.BUILD_PLATFORM.isEmpty())
		winTitle += " on " + BuildConfig.BUILD_PLATFORM;
	setWindowTitle(winTitle);

	// OSX magic.
	// setUnifiedTitleAndToolBarOnMac(true);

	// Global shortcuts
	{
		//FIXME: This is kinda weird. and bad. We need some kind of managed shutdown.
		auto q = new QShortcut(QKeySequence::Quit, this);
		connect(q, SIGNAL(activated()), qApp, SLOT(quit()));
	}

	// The instance action toolbar customizations
	{
		// disabled until we have an instance selected
		ui->instanceToolBar->setEnabled(false);

		// the rename label is inside the rename tool button
		renameButton = new LabeledToolButton();
		renameButton->setText("Instance Name");
		renameButton->setToolTip(ui->actionRenameInstance->toolTip());
		connect(renameButton, SIGNAL(clicked(bool)), SLOT(on_actionRenameInstance_triggered()));
		ui->instanceToolBar->insertWidget(ui->actionLaunchInstance, renameButton);
		ui->instanceToolBar->insertSeparator(ui->actionLaunchInstance);
		renameButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	}

	// Add the news label to the news toolbar.
	{
		newsLabel = new QToolButton();
		newsLabel->setIcon(QIcon::fromTheme("news"));
		newsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
		newsLabel->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
		ui->newsToolBar->insertWidget(ui->actionMoreNews, newsLabel);
		QObject::connect(newsLabel, &QAbstractButton::clicked, this,
						 &MainWindow::newsButtonClicked);
		QObject::connect(MMC->newsChecker().get(), &NewsChecker::newsLoaded, this,
						 &MainWindow::updateNewsLabel);
		updateNewsLabel();
	}

	// Create the instance list widget
	{
		view = new GroupView(ui->centralWidget);

		view->setSelectionMode(QAbstractItemView::SingleSelection);
		// view->setCategoryDrawer(drawer);
		// view->setCollapsibleBlocks(true);
		// view->setViewMode(QListView::IconMode);
		// view->setFlow(QListView::LeftToRight);
		// view->setWordWrap(true);
		// view->setMouseTracking(true);
		// view->viewport()->setAttribute(Qt::WA_Hover);
		auto delegate = new ListViewDelegate();
		view->setItemDelegate(delegate);
		// view->setSpacing(10);
		// view->setUniformItemWidths(true);

		// do not show ugly blue border on the mac
		view->setAttribute(Qt::WA_MacShowFocusRect, false);

		view->installEventFilter(this);

		proxymodel = new InstanceProxyModel(this);
		//		proxymodel->setSortRole(KCategorizedSortFilterProxyModel::CategorySortRole);
		// proxymodel->setFilterRole(KCategorizedSortFilterProxyModel::CategorySortRole);
		// proxymodel->setDynamicSortFilter ( true );

		// FIXME: instList should be global-ish, or at least not tied to the main window...
		// maybe the application itself?
		proxymodel->setSourceModel(MMC->instances().get());
		proxymodel->sort(0);
		view->setFrameShape(QFrame::NoFrame);
		view->setModel(proxymodel);

		view->setContextMenuPolicy(Qt::CustomContextMenu);
		connect(view, SIGNAL(customContextMenuRequested(const QPoint &)), this,
				SLOT(showInstanceContextMenu(const QPoint &)));

		ui->horizontalLayout->addWidget(view);
	}
	// The cat background
	{
		bool cat_enable = MMC->settings()->get("TheCat").toBool();
		ui->actionCAT->setChecked(cat_enable);
		connect(ui->actionCAT, SIGNAL(toggled(bool)), SLOT(onCatToggled(bool)));
		setCatBackground(cat_enable);
	}
	// start instance when double-clicked
	connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this,
			SLOT(instanceActivated(const QModelIndex &)));
	// track the selection -- update the instance toolbar
	connect(view->selectionModel(),
			SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this,
			SLOT(instanceChanged(const QModelIndex &, const QModelIndex &)));

	// track icon changes and update the toolbar!
	connect(MMC->icons().get(), SIGNAL(iconUpdated(QString)), SLOT(iconUpdated(QString)));

	// model reset -> selection is invalid. All the instance pointers are wrong.
	// FIXME: stop using POINTERS everywhere
	connect(MMC->instances().get(), SIGNAL(dataIsInvalid()), SLOT(selectionBad()));

	m_statusLeft = new QLabel(tr("No instance selected"), this);
	m_statusRight = new ServerStatus(this);
	statusBar()->addPermanentWidget(m_statusLeft, 1);
	statusBar()->addPermanentWidget(m_statusRight, 0);

	// Add "manage accounts" button, right align
	QWidget *spacer = new QWidget();
	spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	ui->mainToolBar->addWidget(spacer);

	accountMenu = new QMenu(this);
	manageAccountsAction = new QAction(tr("Manage Accounts"), this);
	manageAccountsAction->setCheckable(false);
	connect(manageAccountsAction, SIGNAL(triggered(bool)), this,
			SLOT(on_actionManageAccounts_triggered()));

	repopulateAccountsMenu();

	accountMenuButton = new QToolButton(this);
	accountMenuButton->setText(tr("Accounts"));
	accountMenuButton->setMenu(accountMenu);
	accountMenuButton->setPopupMode(QToolButton::InstantPopup);
	accountMenuButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	accountMenuButton->setIcon(QIcon::fromTheme("noaccount"));

	QWidgetAction *accountMenuButtonAction = new QWidgetAction(this);
	accountMenuButtonAction->setDefaultWidget(accountMenuButton);

	ui->mainToolBar->addAction(accountMenuButtonAction);

	// Update the menu when the active account changes.
	// Shouldn't have to use lambdas here like this, but if I don't, the compiler throws a fit.
	// Template hell sucks...
	connect(MMC->accounts().get(), &MojangAccountList::activeAccountChanged, [this]
	{ activeAccountChanged(); });
	connect(MMC->accounts().get(), &MojangAccountList::listChanged, [this]
	{ repopulateAccountsMenu(); });

	// Show initial account
	activeAccountChanged();

	auto accounts = MMC->accounts();

    QList<CacheDownloadPtr> skin_dls;
	for (int i = 0; i < accounts->count(); i++)
	{
		auto account = accounts->at(i);
		if (account != nullptr)
		{
			for (auto profile : account->profiles())
			{
				auto meta = MMC->metacache()->resolveEntry("skins", profile.name + ".png");
				auto action = CacheDownload::make(
					QUrl("http://" + URLConstants::SKINS_BASE + profile.name + ".png"), meta);
                skin_dls.append(action);
				meta->stale = true;
			}
		}
	}
	if(!skin_dls.isEmpty())
    {
        auto job = new NetJob("Startup player skins download");
        connect(job, SIGNAL(succeeded()), SLOT(skinJobFinished()));
        connect(job, SIGNAL(failed()), SLOT(skinJobFinished()));
        for(auto action: skin_dls)
            job->addNetAction(action);
        skin_download_job.reset(job);
        job->start();
    }

	// run the things that load and download other things... FIXME: this is NOT the place
	// FIXME: invisible actions in the background = NOPE.
	{
		if (!MMC->minecraftlist()->isLoaded())
		{
			m_versionLoadTask = MMC->minecraftlist()->getLoadTask();
			startTask(m_versionLoadTask);
		}
		if (!MMC->lwjgllist()->isLoaded())
		{
			MMC->lwjgllist()->loadList();
		}

		MMC->newsChecker()->reloadNews();
		updateNewsLabel();

		// set up the updater object.
		auto updater = MMC->updateChecker();
		connect(updater.get(), &UpdateChecker::updateAvailable, this,
				&MainWindow::updateAvailable);
		connect(updater.get(), &UpdateChecker::noUpdateFound, [this]()
		{
			CustomMessageBox::selectable(
				this, tr("No update found."),
				tr("No MultiMC update was found!\nYou are using the latest version."))->exec();
		});
		// if automatic update checks are allowed, start one.
		if (MMC->settings()->get("AutoUpdate").toBool())
			on_actionCheckUpdate_triggered();

		connect(MMC->notificationChecker().get(),
				&NotificationChecker::notificationCheckFinished, this,
				&MainWindow::notificationsChanged);
	}

	setSelectedInstanceById(MMC->settings()->get("SelectedInstance").toString());

	// removing this looks stupid
	view->setFocus();
}
コード例 #9
0
ファイル: card.cpp プロジェクト: KDE/plasma-pa
void Card::setActiveProfileIndex(quint32 profileIndex)
{
    const Profile *profile = qobject_cast<Profile *>(profiles().at(profileIndex));
    context()->setCardProfile(index(), profile->name());
}
コード例 #10
0
ファイル: frmconnexion.cpp プロジェクト: CPI4Admin/BomberMan
void frmConnexion::ConnexionProfil()
{
    QMessageBox msg;
    if(ui->txtPassword->text() == "")
    {
        msg.setText("Vous devez impérativement rentrer un mot de passe.");
        msg.exec();
    }else if(ui->txtPseudo->text() == "")
    {
        msg.setText("Vous devez impérativement rentrer un pseudo.");
        msg.exec();
    }
    else
    {
        /*TODO: Lire le fichier profiles.csv*/
        QFile profiles(QApplication::applicationDirPath() + "/profiles.csv");
        QString pseudo = ui->txtPseudo->text();
        QString motdepasse = ui->txtPassword->text();
        int nbConnexion, nbPartie, nbVictoire, nbDefaite;

        bool trouve = false;

        if(profiles.exists())
        {
            if(profiles.open(QIODevice::ReadOnly | QIODevice::Text))
            {
                QTextStream flux(&profiles);
                while(!flux.atEnd() && !trouve)
                {
                    QString line = flux.readLine();
                    QStringList detailsLine = line.split(";");
                    if(detailsLine[0] == pseudo && detailsLine[1] == motdepasse)
                    {
                        trouve = true;
                        nbConnexion = detailsLine[2].toInt();
                        nbPartie = detailsLine[3].toInt();
                        nbVictoire= detailsLine[4].toInt();
                        nbDefaite = detailsLine[5].toInt();
                    }
                }

                if(trouve)
                {
                    currentProfile::getInstance(pseudo,motdepasse,nbConnexion, nbPartie, nbVictoire, nbDefaite);

                    msg.setText("Connecté au profil: " + currentProfile::getInstance()->getPseudo());
                    msg.exec();
                    emit connexionOk();
                    this->close();
                }
                else
                {
                    msg.setText("Données d'identifications incorrectes.");
                    msg.exec();
                }
            }
            else
            {
                msg.setText("Problème d'accès au fichier profiles.csv");
                msg.exec();
            }
        }
        else
        {
            if (profiles.open(QIODevice::Append | QIODevice::Text))
            {
                QTextStream flux(&profiles);
                QString contenu = flux.readAll();
                QString texte = pseudo+ ";" + motdepasse+ ";0;0;0;0";
                flux << texte;

                profiles.close();

                currentProfile::getInstance(pseudo,motdepasse,0,0,0,0);

                msg.setText("Le fichier profiles.csv et le profil utilisateur " + currentProfile::getInstance()->getPseudo() +" ont été crée.\n Connecté au profil: " + currentProfile::getInstance()->getPseudo());
                msg.exec();
                emit connexionOk();
                this->close();
            }

        }
    }
}