Ejemplo n.º 1
0
void ProfileManager::updateCurrentProfile()
{
    QDir profileDir(DataPaths::currentProfilePath());

    if (!profileDir.exists()) {
        QDir newDir(profileDir.path().remove(profileDir.dirName()));
        newDir.mkdir(profileDir.dirName());
    }

    QFile versionFile(profileDir.filePath(QLatin1String("version")));

    // If file exists, just update the profile to current version
    if (versionFile.exists()) {
        versionFile.open(QFile::ReadOnly);
        QString profileVersion = versionFile.readAll();
        versionFile.close();

        updateProfile(Qz::VERSION, profileVersion.trimmed());
    }
    else {
        copyDataToProfile();
    }

    versionFile.open(QFile::WriteOnly);
    versionFile.write(Qz::VERSION);
    versionFile.close();
}
Ejemplo n.º 2
0
void Preferences::createProfile()
{
    QString name = QInputDialog::getText(this, tr("New Profile"), tr("Enter the new profile's name:"));
    name = QzTools::filterCharsFromFilename(name);
    if (name.isEmpty()) {
        return;
    }
    QDir dir(mApp->PROFILEDIR + "profiles/");
    if (QDir(dir.absolutePath() + "/" + name).exists()) {
        QMessageBox::warning(this, tr("Error!"), tr("This profile already exists!"));
        return;
    }
    if (!dir.mkdir(name)) {
        QMessageBox::warning(this, tr("Error!"), tr("Cannot create profile directory!"));
        return;
    }

    dir.cd(name);
    QFile(":data/browsedata.db").copy(dir.absolutePath() + "/browsedata.db");
    QFile(dir.absolutePath() + "/browsedata.db").setPermissions(QFile::ReadUser | QFile::WriteUser);

    QFile versionFile(dir.absolutePath() + "/version");
    versionFile.open(QFile::WriteOnly);
    versionFile.write(QupZilla::VERSION.toUtf8());
    versionFile.close();

    ui->startProfile->insertItem(0, name);
    ui->startProfile->setCurrentIndex(0);
}
Ejemplo n.º 3
0
void VersionFinal::reapply(const bool alreadyReseting)
{
	if (!alreadyReseting)
	{
		beginResetModel();
	}

	clear();

	auto existingOrders = getExistingOrder();
	QList<int> orders = existingOrders.values();
	std::sort(orders.begin(), orders.end());
	QList<VersionFilePtr> newVersionFiles;
	for (auto order : orders)
	{
		auto file = versionFile(existingOrders.key(order));
		newVersionFiles.append(file);
		file->applyTo(this);
	}
	versionFiles.swap(newVersionFiles);
	finalize();
	if (!alreadyReseting)
	{
		endResetModel();
	}
}
Ejemplo n.º 4
0
  /**
   * @returns the Isis version in the format isis?.?.?.?qualifier | date
   */
  QString Environment::isisVersion() {
    TextFile versionFile("$ISISROOT/version");
    QString line1, line2, line3, line4;
    versionFile.GetLine(line1);
    versionFile.GetLine(line2);
    versionFile.GetLine(line3);
    versionFile.GetLine(line4);

    QRegExp validPartOfLine("[^ #]*");
    if (validPartOfLine.indexIn(line1) != -1) {
      line1 = validPartOfLine.cap();
    }
    else {
      IString msg = "$ISISROOT/version line 1, no valid text found";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    if (validPartOfLine.indexIn(line2) != -1) {
      line2 = validPartOfLine.cap();
    }
    else {
      IString msg = "$ISISROOT/version line 2, no valid text found";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    if (validPartOfLine.indexIn(line4) != -1) {
      line4 = validPartOfLine.cap();
    }
    else {
      IString msg = "$ISISROOT/version line 4, no valid text found";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    return line1 + " " + line4 + " | " + line2;
  }
Ejemplo n.º 5
0
void ProfileUpdater::checkProfile()
{
    QDir profileDir(m_profilePath);

    if (!profileDir.exists()) {
        QDir newDir(profileDir.path().remove(profileDir.dirName()));
        newDir.mkdir(profileDir.dirName());
    }

    QFile versionFile(m_profilePath + "version");
    if (versionFile.exists()) {
        versionFile.open(QFile::ReadOnly);
        QString profileVersion = versionFile.readAll();
        versionFile.close();
        versionFile.remove();

        updateProfile(QupZilla::VERSION, profileVersion.trimmed());
    }
    else {
        copyDataToProfile();
    }

    versionFile.open(QFile::WriteOnly);
    versionFile.write(QupZilla::VERSION.toUtf8());
    versionFile.close();
}
Ejemplo n.º 6
0
/** Constructor */
HelpDialog::HelpDialog(QWidget *parent) :
    QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
    ui(new(Ui::HelpDialog))
{
    /* Invoke the Qt Designer generated object setup routine */
    ui->setupUi(this);

    //QFile licenseFile(QLatin1String(":/images/COPYING"));
    QFile licenseFile(QLatin1String(":/help/licence.html"));
    if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&licenseFile);
        ui->license->setText(in.readAll());
    }

    QFile authorsFile(QLatin1String(":/help/authors.html"));
    if (authorsFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&authorsFile);
        ui->authors->setText(in.readAll());
    }

    QFile thanksFile(QLatin1String(":/help/thanks.html"));
    if (thanksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&thanksFile);
        ui->thanks->setText(in.readAll());
    }

    QFile versionFile(QLatin1String(":/help/version.html"));
    if (versionFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&versionFile);
        QString version = in.readAll();

        ui->version->setText(version);
    }

    /* Add version numbers of libretroshare */
    std::list<RsLibraryInfo> libraries;
    RsControl::instance()->getLibraries(libraries);
    addLibraries(ui->libraryLayout, "libretroshare", libraries);

#ifdef ENABLE_WEBUI
    /* Add version numbers of RetroShare */
    // Add versions here. Find a better place.
    libraries.clear();
    libraries.push_back(RsLibraryInfo("Libmicrohttpd", MHD_get_version()));
    addLibraries(ui->libraryLayout, "RetroShare", libraries);
#endif // ENABLE_WEBUI

    /* Add version numbers of plugins */
    if (rsPlugins) {
        for (int i = 0; i < rsPlugins->nbPlugins(); ++i) {
            RsPlugin *plugin = rsPlugins->plugin(i);
            if (plugin) {
                libraries.clear();
                plugin->getLibraries(libraries);
                addLibraries(ui->libraryLayout, plugin->getPluginName(), libraries);
            }
        }
    }
}
Ejemplo n.º 7
0
char const *Platform::GetOSVersion() {
  static char version[9] = {0};

  // macOS doesn't offer a C/C++ call to get the OS version.
  // SystemVersion.plist is used by official applications to get the version.
  // An XML parser would be nice but would add a heavy dependency to read one
  // static value.

  if (version[0] == '\0') {
    std::string line;
    std::ifstream versionFile(
        "/System/Library/CoreServices/SystemVersion.plist");

    if (!versionFile.is_open()) {
      return version;
    }

    // We are looking for:
    // <dict>
    // ...
    // <key>ProductVersion</key>
    // <string>10.10.5</string>
    // ...
    // </dict>

    while (std::getline(versionFile, line)) {
      size_t start = 0;
      size_t end = 0;
      size_t len = 0;

      if (line.find("ProductVersion") == std::string::npos)
        continue;

      if (!std::getline(versionFile, line))
        break;

      start = line.find("<string>");
      end = line.find("</string>");

      if (start == std::string::npos || end == std::string::npos)
        break;

      start += 8;

      len = (end - start) > 8 ? 8 : end - start;

      std::memcpy(version, line.substr(start, end).c_str(), len);
    }

    versionFile.close();
  }

  return version;
}
Ejemplo n.º 8
0
/// @brief 读取程序版本信息
/// @return 程序版本信息
static QString ReadAppVersion()
{
    QFile versionFile(VERSION_FILE_PATH);
    if (!versionFile.open(QIODevice::ReadOnly))
    {
        return "";
    }

    QString version = versionFile.readAll();
    versionFile.close();

    return version.trimmed();
}
Ejemplo n.º 9
0
/** Constructor */
HelpDialog::HelpDialog(QWidget *parent)
:QDialog(parent)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);
  
  //QFile licenseFile(QLatin1String(":/images/COPYING"));
  QFile licenseFile(QLatin1String(":/help/licence.html"));
   if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&licenseFile);
        ui.license->setText(in.readAll());
   }
  QFile authorsFile(QLatin1String(":/help/authors.html"));
   if (authorsFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&authorsFile);
        ui.authors->setText(in.readAll());
   }
  QFile thanksFile(QLatin1String(":/help/thanks.html"));
   if (thanksFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&thanksFile);
	ui.thanks->setText(in.readAll());
   }

  QFile versionFile(QLatin1String(":/help/version.html"));
   if (versionFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
	QTextStream in(&versionFile);
	QString version = in.readAll();

#ifdef ADD_LIBRETROSHARE_VERSION_INFO
	/* get libretroshare version */
	std::map<std::string, std::string>::iterator vit;
	std::map<std::string, std::string> versions;
	const RsConfig &conf = rsiface->getConfig();
	bool retv = rsDisc->getDiscVersions(versions);
	if (retv && versions.end() != (vit = versions.find(conf.ownId)))
	{
	    version += QString::fromStdString("Retroshare library version : \n") + QString::fromStdString(vit->second);
	}
#endif

	ui.version->setText(version);
   }

   ui.label_2->setMinimumWidth(20);


  /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
void GenerateVersionInfo::exec()
{
   writeBeginMsg("正在生成版本文件 ... ");
   QChar ds = QDir::separator();
   QFile versionTplFile(m_buildDir+ds+"Library"+ds+"FengHuang"+ds+"Version.php");
   versionTplFile.open(QFile::ReadWrite);
   QByteArray content = versionTplFile.readAll();
   content.replace("{version}", m_invokeArgs["version"].toLatin1());
   versionTplFile.remove();
   QFile versionFile(m_buildDir+ds+"Library"+ds+"FengHuang"+ds+"Version.php");
   versionFile.open(QFile::WriteOnly|QFile::Truncate);
   versionFile.write(content);
   writeDoneMsg();
}
Ejemplo n.º 11
0
int main(int argc, char** argv)
{
    // Declare the supported options.
    ::boost::program_options::options_description desc("Allowed options");
    desc.add_options()
        ("help,h", "produce help message")
        ("output,o", ::boost::program_options::value< std::string >(), "set output file")
        ("context,f", ::boost::program_options::value< std::string >(), "set context name")
        ("version,v", ::boost::program_options::value< std::string >(), "set version name")
    ;

    // Manage the options
    ::boost::program_options::variables_map vm;
    ::boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
    ::boost::program_options::notify(vm);

    if (vm.count("help")) {
        std::cout << desc << "\n";
        return EXIT_SUCCESS;
    }
    else if(!vm.count("context"))
    {
        std::cout << "You must specify a context name." << "\n";
        return EXIT_FAILURE;
    }
    else if(!vm.count("version"))
    {
        std::cout << "You must specify a version name." << "\n";
        return EXIT_FAILURE;
    }
    else if(!vm.count("output"))
    {
        std::cout << "You must specify a output file." << "\n";
        return EXIT_FAILURE;
    }

    // Generate the result 
    ::boost::filesystem::path versionFile(vm["output"].as< std::string >());
    ::fwAtomsPatch::VersionsManager::generateNewFile(versionFile, vm["context"].as< std::string >(),
            vm["version"].as< std::string >());

    return EXIT_SUCCESS;
}
Ejemplo n.º 12
0
void UpdaterTest::testIsUpdateDownloaded()
{
	if (exists("a_temporary_test_data_directory"))
	{
		remove("a_temporary_test_data_directory\\BumpTopInstaller.msi");
		remove("a_temporary_test_data_directory\\version.txt");
		remove("a_temporary_test_data_directory\\desc.txt");
	}

	vector<string> versionStrings;
	versionStrings.push_back("800");
	MockUpdateServer *mus = new MockUpdateServer(versionStrings);
	Updater *u = new Updater(mus, 99, "a_temporary_test_data_directory", 0, 0, 0);

	create_directory("a_temporary_test_data_directory");

	ofstream installer("a_temporary_test_data_directory//BumpTopInstaller.msi");
	installer << "!!!!!";
	installer.close();

	CPPUNIT_ASSERT_EQUAL(false, u->isUpdateDownloaded());

	ofstream versionFile("a_temporary_test_data_directory//version.txt");
	versionFile << "2000";
	versionFile.close();

	CPPUNIT_ASSERT_EQUAL(false, u->isUpdateDownloaded());

	ofstream descFile("a_temporary_test_data_directory//desc.txt");
	descFile << "best version ever";
	descFile.close();

	CPPUNIT_ASSERT_EQUAL(true, u->isUpdateDownloaded());

	remove("a_temporary_test_data_directory\\BumpTopInstaller.msi");
	remove("a_temporary_test_data_directory\\version.txt");
	remove("a_temporary_test_data_directory\\desc.txt");
	remove("a_temporary_test_data_directory");


}
Ejemplo n.º 13
0
void CSoftwareUpdate::showSoftwareUpdateImageinfo(CMenuWidget * entry)
/* shows entries with current installed version*/
{
	entry->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FLASHUPDATE_CURRENTVERSION_SEP));

	/* get current version SBBBYYYYMMTTHHMM -- formatsting */
	CConfigFile versionFile('\t');

	const char * versionString = (versionFile.loadConfig("/.version")) ? (versionFile.getString( "version", "????????????????").c_str()) : "????????????????";

	dprintf(DEBUG_INFO, "current flash-version: %s\n", versionString);

	static CFlashVersionInfo versionInfo(versionString);
	static CImageInfo imageinfo;
	
	entry->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_IMAGENAME , false, imageinfo.getImageInfo(DISTRIBUTION)));
	entry->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CURRENTVERSIONDATE    , false, versionInfo.getDate()));
	entry->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CURRENTVERSIONTIME    , false, versionInfo.getTime()));
	entry->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CURRENTRELEASECYCLE   , false, versionInfo.getReleaseCycle()));
	/* versionInfo.getType() returns const char * which is never deallocated */
	entry->addItem(new CMenuForwarder(LOCALE_FLASHUPDATE_CURRENTVERSIONSNAPSHOT, false, versionInfo.getType()));
}
Ejemplo n.º 14
0
 LoginWindow::LoginWindow(QWidget *parent, QTranslator *pTranslator, QTimer *pInactivityTimer, const CentralWidgetCallback &callback) :
     IPartner(parent),
     ui(new Ui::LoginWindow),
     m_currentPage(0),
     m_password(),
     m_username(-1),
     m_pTranslator(pTranslator),
     m_pInactivityTimer(pInactivityTimer),
     m_switchCentralWidgetCallback(callback)
 {
     ui->setupUi(this);
     initializeTable();
     // load code build
     QFile versionFile(":VERSION");
     versionFile.open(QIODevice::ReadOnly | QIODevice::Text);
     QTextStream versionStream(&versionFile);
     versionStream.setCodec("UTF-8");
     QString versionStr = versionStream.readAll();
     this->ui->versionLabel->setText(QString("code build %1").arg(versionStr));
     // connect QTimer timeout event
     this->connect(m_pInactivityTimer, &QTimer::timeout, std::bind(&LoginWindow::onInactivityTimeout, this));
 }
Ejemplo n.º 15
0
void ProfileManager::initConfigDir() const
{
    QDir dir(DataPaths::path(DataPaths::Config));

    if (dir.exists() && QFile(dir.filePath(QLatin1String("profiles/profiles.ini"))).exists()) {
        return;
    }

    std::cout << "QupZilla: Creating new profile directory" << std::endl;

    if (!dir.exists()) {
        dir.mkpath(dir.absolutePath());
    }

    dir.mkdir(QLatin1String("profiles"));
    dir.cd(QLatin1String("profiles"));

    // $Config/profiles
    QFile(dir.filePath(QLatin1String("profiles/profiles.ini"))).remove();
    QFile(QLatin1String(":data/profiles.ini")).copy(dir.filePath(QLatin1String("profiles/profiles.ini")));
    QFile(dir.filePath(QLatin1String("profiles/profiles.ini"))).setPermissions(QFile::ReadUser | QFile::WriteUser);

    dir.mkdir(QLatin1String("default"));
    dir.cd(QLatin1String("default"));

    // $Config/profiles/default
    QFile(dir.filePath(QLatin1String("profiles/default/browsedata.db"))).remove();
    QFile(QLatin1String(":data/browsedata.db")).copy(dir.filePath(QLatin1String("profiles/default/browsedata.db")));
    QFile(dir.filePath(QLatin1String("profiles/default/browsedata.db"))).setPermissions(QFile::ReadUser | QFile::WriteUser);

    QFile(QLatin1String(":data/bookmarks.json")).copy(dir.filePath(QLatin1String("profiles/default/bookmarks.json")));
    QFile(dir.filePath(QLatin1String("profiles/default/bookmarks.json"))).setPermissions(QFile::ReadUser | QFile::WriteUser);

    QFile versionFile(dir.filePath(QLatin1String("profiles/default/version")));
    versionFile.open(QFile::WriteOnly);
    versionFile.write(Qz::VERSION);
    versionFile.close();
}
Ejemplo n.º 16
0
void initApplication(QCoreApplication *pApp)
{
    // Set the name of the application

    pApp->setApplicationName(QFileInfo(pApp->applicationFilePath()).baseName());

    // Retrieve and set the version of the application

    QFile versionFile(":version");

    versionFile.open(QIODevice::ReadOnly);

    QString version = QString(versionFile.readLine()).trimmed();

    if (version.endsWith(".0"))
        // There is no actual patch information, so trim it

        version.truncate(version.length()-2);

    versionFile.close();

    pApp->setApplicationVersion(version);
}
Ejemplo n.º 17
0
int ProfileManager::createProfile(const QString &profileName)
{
    QDir dir(DataPaths::path(DataPaths::Profiles));

    if (QDir(dir.absolutePath() + QLatin1Char('/') + profileName).exists()) {
        return -1;
    }
    if (!dir.mkdir(profileName)) {
        return -2;
    }

    dir.mkdir(profileName);
    dir.cd(profileName);
    QFile(QLatin1String(":data/browsedata.db")).copy(dir.filePath(QLatin1String("/browsedata.db")));
    QFile(dir.filePath(QLatin1String("/browsedata.db"))).setPermissions(QFile::ReadUser | QFile::WriteUser);

    QFile versionFile(dir.filePath(QLatin1String("/version")));
    versionFile.open(QFile::WriteOnly);
    versionFile.write(Qz::VERSION);
    versionFile.close();

    return 0;
}
Ejemplo n.º 18
0
wxFileName t4p::VersionFileAsset() {
    wxFileName asset = AssetRootDir();
    wxFileName versionFile(asset.GetPath(), wxT("version.txt"));
    return versionFile;
}
Ejemplo n.º 19
0
Gui::Gui(){

     setupUi(this);

     pref = new Preferences(this);

     myOutput = new QTextStream(stdout);

     if(!QProcessEnvironment().isEmpty())
        shell = QProcess::systemEnvironment().filter("SHELL").first().remove("SHELL=");
     if(shell.isEmpty() && QFile("/bin/bash").exists())
        shell = "/bin/bash";
     else
       *myOutput << "E: No shells found! qprogram-starter might not work as expected...";

   //Versioning
     QFile versionFile(":version");
     versionFile.open(QIODevice::ReadOnly | QIODevice::Text);
     QTextStream in(&versionFile);
     statusBar()->showMessage(tr("Version ") + in.readLine(),15000);
     versionFile.close();

     aborted = false;
     process2Started = false;

     dateEdit->setMinimumDate(QDate::currentDate());
     dateTimeTimer = new QTimer(this);
     dateTimeTimer->start(1000);

     timer = new QTimer(this);

     process1 = new QProcess(this);
     process2 = new QProcess(this);

     logBox1 = new QTextEdit;
     logBox1->setReadOnly(true);
     logBox1->resize(520,450);
     logBox1->setWindowTitle("error log 1");
     logBox1->setWindowModality(Qt::NonModal);

     logBox2 = new QTextEdit;
     logBox2->setReadOnly(true);
     logBox2->resize(520,450);
     logBox2->setWindowTitle("error log 2");
     logBox2->setWindowModality(Qt::NonModal);

     hintMsgBox = new QTextEdit;
     hintMsgBox->setReadOnly(true);
     hintMsgBox->resize(520,450);
     hintMsgBox->setWindowTitle("Info");
     hintMsgBox->setWindowModality(Qt::NonModal);
     hintMsgBox->setHtml(tr("The command in the second text editor (if there is any) will be executed after the first one. The message boxes will close themselves after 10 seconds.<br/>To start a program just type i.e. \"firefox\" or \"firefox www.google.com\" and then click on Start. Commands etc. can be linked by \"&&\" etc. <br/><br/>If the process is \"finished\" although it is still running, then try the --nofork option (i.e. kopete --nofork). Note that this will also occure for some programs like gedit, firefox or gnome-terminal if they are already running.<br/><br/>When you want to start a program or command with sudo, please use for example gksu(do) or kdesu(do).<br/><br/>make examples:<br/>&nbsp;make -C /path/to/project<br/>&nbsp;make clean -C /path/to/project<br/><br/>About Errors:<br/>Because almost every program gives a different error code, it is impossible to say what happend. So just log the output and see what kind of error occured. The output files can be found at <i>~/.qprogram-starter/</i>.<br/><br/>If the shutdown won't work, it means that \"sudo shutdown -P now\" is used. This needs root permissions. You can do the this:<br/><br/>Post the following in a terminal:<pre>EDITOR=nano sudo -E visudo</pre> and add this line:<pre>* ALL = NOPASSWD:/sbin/shutdown</pre> whereas * replaces the username or %groupname.<br/><br/>The configuration-file can be found at <i>~/.qprogram-starter/</i>."));

     connect(action_Configure, SIGNAL(triggered(bool)), pref, SLOT(show()));
     connect(dateTimeTimer, SIGNAL(timeout()), this, SLOT(currentDateAndTime()));
     connect(startB, SIGNAL(clicked(bool)), this, SLOT(run()));
     connect(abortB, SIGNAL(clicked(bool)), this, SLOT(abortProcesses()));
     connect(saveButton, SIGNAL(clicked(bool)), this, SLOT(saveData()));
     connect(timer, SIGNAL(timeout()), this, SLOT(check()));
     connect(browse1, SIGNAL(clicked(bool)), this, SLOT(getProgram1()));
     connect(browse2, SIGNAL(clicked(bool)), this, SLOT(getProgram2()));
     connect(process1, SIGNAL(readyReadStandardOutput()), this, SLOT(output1()));
     connect(process1, SIGNAL(readyReadStandardError()), this, SLOT(errorOutput1()));
     connect(process1, SIGNAL(finished(int)), this, SLOT(checkForProcess2()));
     connect(process1, SIGNAL(error(QProcess::ProcessError)), this, SLOT(message()));
     connect(process2, SIGNAL(readyReadStandardOutput()), this, SLOT(output2()));
     connect(process2, SIGNAL(readyReadStandardError()), this, SLOT(errorOutput2()));
     connect(process2, SIGNAL(finished(int)), this, SLOT(shutdown_or_message()));
     connect(process2, SIGNAL(error(QProcess::ProcessError)), this, SLOT(message()));
     connect(this, SIGNAL(finished()), this, SLOT(shutdown_or_message()));
     connect(action_Hints, SIGNAL(triggered(bool)), this, SLOT(info_hint()));
     connect(showLogsButton, SIGNAL(clicked(bool)), this, SLOT(showLogs()));
}
Ejemplo n.º 20
0
bool VersionFinal::hasFtbPack()
{
	return versionFile("org.multimc.ftb.pack.json") != nullptr;
}
Ejemplo n.º 21
0
pal::string_t pal::get_current_os_rid_platform()
{
    pal::string_t ridOS;
    pal::string_t versionFile(_X("/etc/os-release"));

    if (pal::file_exists(versionFile))
    {
        // Read the file to get ID and VERSION_ID data that will be used
        // to construct the RID.
        std::fstream fsVersionFile;
        
        fsVersionFile.open(versionFile, std::fstream::in);

        // Proceed only if we were able to open the file
        if (fsVersionFile.good())
        {
            pal::string_t line;
            pal::string_t strID(_X("ID="));
            pal::string_t valID;
            pal::string_t strVersionID(_X("VERSION_ID="));
            pal::string_t valVersionID;

            bool fFoundID = false, fFoundVersion = false;

            // Read the first line
            std::getline(fsVersionFile, line);

            // Loop until we are at the end of file
            while (!fsVersionFile.eof())
            {
                // Look for ID if we have not found it already
                if (!fFoundID)
                {
                    size_t pos = line.find(strID);
                    if ((pos != std::string::npos) && (pos == 0))
                    {
                        valID.append(line.substr(3));
                        fFoundID = true;
                    }
                }

                // Look for VersionID if we have not found it already
                if (!fFoundVersion)
                {
                    size_t pos = line.find(strVersionID);
                    if ((pos != std::string::npos) && (pos == 0))
                    {
                        valVersionID.append(line.substr(11));
                        fFoundVersion = true;
                    }
                }

                if (fFoundID && fFoundVersion)
                {
                    // We have everything we need to form the RID - break out of the loop.
                    break;
                }

                // Read the next line
                std::getline(fsVersionFile, line);
            }

            // Close the file now that we are done with it.
            fsVersionFile.close();

            if (fFoundID)
            {
                ridOS.append(valID);
            }
            
            if (fFoundVersion)
            {
                ridOS.append(_X("."));
                ridOS.append(valVersionID);
            }

            if (fFoundID || fFoundVersion)
            {
                // Remove any double-quotes
                ridOS = trim_quotes(ridOS);
            }
        }
    }

    return normalize_linux_rid(ridOS);
}