Example #1
0
void createLegalFiles( const QString &directory, const QString &name, const QString &email )
{
    QDir input( directory );
    QFile authorsFile( input.filePath( "AUTHORS.txt" ) );
    if ( authorsFile.open( QFile::WriteOnly | QFile::Truncate ) ) {
        QTextStream stream( &authorsFile );
        stream << name << " <" << email << ">";
    }
    authorsFile.close();

    QFile licenseFile( input.filePath( "LICENSE.txt" ) );
    if ( licenseFile.open( QFile::WriteOnly | QFile::Truncate ) ) {
        QTextStream stream( &licenseFile );
        stream << "The ogg files in this directory are licensed under the creative commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. ";
        stream << "See http://creativecommons.org/licenses/by-sa/3.0/ and the file CC-BY-SA-3.0 in this directory.";
    }
    licenseFile.close();

    QFile installFile( input.filePath( "INSTALL.txt" ) );
    if ( installFile.open( QFile::WriteOnly | QFile::Truncate ) ) {
        QTextStream stream( &installFile );
        stream << "To install this voice guidance speaker in Marble, copy the entire directory to the audio/speakers/ directory in Marble's data path.\n\n";
        stream << "For example, if this directory is called 'MySpeaker' and you want to use it on the Nokia N900, copy the directory with all files to /home/user/MyDocs/.local/share/marble/audio/speakers/MySpeaker\n\n";
        stream << "Afterwards start Marble on the N900 and press the routing info box (four icons on the bottom) for two seconds with the pen. Enter the configuration dialog and choose the 'MySpeaker' speaker.\n\n";
        stream << "Check http://edu.kde.org/marble/speakers.php for updates and more speakers.";
    }
    installFile.close();
}
Example #2
0
SimpleAboutDialog::SimpleAboutDialog(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::SimpleAboutDialog)
{
	ui->setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose);
	ui->texteditDevelopers->setHtml(toHtml(PersonInfo::authors(), true));
	QList<PersonInfo> translators = PersonInfo::translators();
	if (translators.isEmpty())
		ui->tabWidget->removeTab(1);
	else
		ui->texteditTranslators->setHtml(toHtml(translators, false));
	ui->labelVersion->setText(QLatin1String(versionString()));
	ui->labelQtVer ->setText(tr("Based on Qt %1 (%2 bit).")
	                         .arg(QLatin1String(qVersion()), QString::number(QSysInfo::WordSize)));
	QFile licenseFile(":/GPL");
	QString license = tr("<div><b>qutIM</b> %1 is licensed under GNU General Public License, version 2"
								" or (at your option) any later version.</div>"
								"<div>qutIM resources such as themes, icons, sounds may come along with a "
								"different license.</div><br><hr><br>");
	// FIXME: Don't want to break translation before release
	license = license.replace("2", "3").arg(versionString());
	if (licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
		license += Qt::escape(QLatin1String(licenseFile.readAll()));
	} else {
		license += QLatin1String("<a href=\"http://www.gnu.org/licenses/gpl-3.0.html\">GPLv3</a>");
	}
	license.replace(QLatin1String("\n\n"), "<br><br>");
	ui->texteditLicense->setHtml(license);
}
Example #3
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);
            }
        }
    }
}
Example #4
0
File: ID.cpp Project: AnnRe/archive
std::string ID::ImportIDAndGetKeyFromFile()
{
	std::ifstream licenseFile("license.txt");
	std::getline(licenseFile, _number);
	std::string key;
	std::getline(licenseFile, key);
	licenseFile.close();
	return key;
}
Example #5
0
bool isUsLicense() {
    QString text = licenseFile();
    QRegExp re( "LicenseKey=([^\n]*)" );
    Q_ASSERT( re.isValid() );
    if ( re.search( text ) >= 0 ) {
	QString key = re.cap( 1 );
	if ( !key.isEmpty() ) {
	    if ( QString( "3579BDFHbdfh" ).find( key[0] ) >= 0 )
		return TRUE;
	}
    }
    return FALSE;
}
Example #6
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
}
Example #7
0
LicenseDialog::LicenseDialog(Plugin *_plugin, QWidget *parent) :
    QDialog(parent), ui(new Ui_LicenseDialog), plugin(_plugin)
{
    ui->setupUi(this);
    //Opening license file
    QFile licenseFile(plugin->getLicensePath().getURLString());
    if (!licenseFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        ui->licenseTextBrowser->setText(tr("License file not found."));
    } else {
        ui->licenseTextBrowser->setText(QString(licenseFile.readAll()));
        licenseFile.close();
    }

    connect(ui->acceptButton,SIGNAL(clicked()),SLOT(sl_accept()));
}
Example #8
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString ProcessingPlugin::getDescription()
{
  QFile licenseFile(":/Processing/ProcessingDescription.txt");
  QFileInfo licenseFileInfo(licenseFile);
  QString text = "<<--Description was not read-->>";

  if ( licenseFileInfo.exists() )
  {
    if ( licenseFile.open(QIODevice::ReadOnly | QIODevice::Text) )
    {
      QTextStream in(&licenseFile);
      text = in.readAll();
    }
  }
  return text;
}
Example #9
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString ProcessingPlugin::getLicense()
{
  QFile licenseFile(":/DREAM3D/DREAM3DLicense.txt");
  QFileInfo licenseFileInfo(licenseFile);
  QString text = "<<--License was not read-->>";

  if ( licenseFileInfo.exists() )
  {
    if ( licenseFile.open(QIODevice::ReadOnly | QIODevice::Text) )
    {
      QTextStream in(&licenseFile);
      text = in.readAll();
    }
  }
  return text;
}
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
    setWindowTitle(tr("About Mupen64Plus-Qt"));
    setMinimumSize(600, 300);

    aboutLayout = new QGridLayout(this);

    icon = new QLabel(this);
    icon->setPixmap(QPixmap(":/images/mupen64plus.png"));

    QFile licenseFile(":/other/LICENSE");
    licenseFile.open(QIODevice::ReadOnly);
    license = new QPlainTextEdit(licenseFile.readAll(), this);
    license->setReadOnly(true);
    licenseFile.close();

    QString description = "<b>Mupen64Plus-Qt</b><br />Version " + Version + "<br /><br />";
    description += tr("A basic launcher for Mupen64Plus using Qt.");
    QString mupen64 = "<a href=\"http://www.mupen64plus.org/\">Mupen64Plus website</a>";
    QString github = "<a href=\"https://github.com/dh4/mupen64plus-qt\">Github repository</a>";

    descriptionLabel = new QLabel(description, this);
    mupen64Link = new QLabel(mupen64, this);
    githubLink = new QLabel(github, this);

    mupen64Link->setOpenExternalLinks(true);
    githubLink->setOpenExternalLinks(true);

    buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);

    aboutLayout->addWidget(icon, 0, 0, 4, 1);
    aboutLayout->addWidget(descriptionLabel, 0, 1);
    aboutLayout->addWidget(license, 1, 1);
    aboutLayout->addWidget(mupen64Link, 3, 1);
    aboutLayout->addWidget(githubLink, 4, 1);
    aboutLayout->addWidget(buttonBox, 5, 1);
    aboutLayout->setColumnStretch(1, 1);
    aboutLayout->setRowStretch(1, 1);
    aboutLayout->setColumnMinimumWidth(0, 150);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(close()));

    setLayout(aboutLayout);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QString UCSBUtilitiesPlugin::getLicense()
{
  /* PLEASE UPDATE YOUR PLUGIN'S LICENSE FILE.
  It is located at UCSBUtilities/Resources/UCSBUtilities/UCSBUtilitiesLicense.txt */

  QFile licenseFile(":/UCSBUtilities/UCSBUtilitiesLicense.txt");
  QFileInfo licenseFileInfo(licenseFile);
  QString text = "<<--License was not read-->>";

  if ( licenseFileInfo.exists() )
  {
    if ( licenseFile.open(QIODevice::ReadOnly | QIODevice::Text) )
    {
      QTextStream in(&licenseFile);
      text = in.readAll();
    }
  }
  return text;
}
Example #12
0
void MainWindow::about()
{
    QStringList authors;
    authors << "Pier Luigi Fiorini <*****@*****.**>";

    VAboutDialog dialog(this);
    dialog.setAuthors(authors);
    dialog.setCopyright(tr("Copyright (C) 2012-2013 Pier Luigi Fiorini"));
    dialog.setDescription(tr("Simple image visualization application."));
    dialog.setLink(QUrl("http://www.maui-project.org/"));

    QFile licenseFile(":/COPYING");
    if (licenseFile.open(QIODevice::ReadOnly)) {
        dialog.setLicenseText(licenseFile.readAll());
        licenseFile.close();
    }

    dialog.exec();
}
Example #13
0
void MainWindow::slotAbout()
{
    QStringList authors;
    authors << "Pier Luigi Fiorini <*****@*****.**>";

    VAboutDialog dialog(this);
    dialog.setAuthors(authors);
    dialog.setCopyright("Pier Luigi Fiorini");
    dialog.setDescription("Hawaii Terminal Emulator.");
    dialog.setLink(QUrl("http://www.maui-project.org/"));

    QFile licenseFile(":/COPYING");
    if (licenseFile.open(QIODevice::ReadOnly)) {
        dialog.setLicenseText(licenseFile.readAll());
        licenseFile.close();
    }

    dialog.exec();
}
Example #14
0
LicenseDialog::LicenseDialog(QWidget *parent) :
    QDialog(parent)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setWindowTitle("License");

    QVBoxLayout* layout = new QVBoxLayout(this);

    QTextEdit* licenseEdit = new QTextEdit(this);
    licenseEdit->setReadOnly(true);
    QFile licenseFile(":/license");
    licenseFile.open(QIODevice::ReadOnly | QIODevice::Text);
    licenseEdit->setText(licenseFile.readAll());
    QFont font("Monospace");
    font.setStyleHint(QFont::TypeWriter);
    licenseEdit->setFont(font);
    layout->addWidget(licenseEdit);

    setMinimumSize(600, 500);
}
Example #15
0
void KAboutDataTest::testSetAddLicense()
{
    // prepare a file with a license text
    QFile licenseFile(QString::fromLatin1(LicenseFileName));
    licenseFile.open(QIODevice::WriteOnly);
    QTextStream licenseFileStream(&licenseFile);
    licenseFileStream << QLatin1String(LicenseFileText);
    licenseFile.close();

    const QString copyrightStatement = QLatin1String(CopyrightStatement);
    const QString lineFeed = QString::fromLatin1("\n\n");

    KAboutData aboutData(AppName, QLatin1String(ProgramName), Version,
                         QLatin1String(ShortDescription), KAboutLicense::Unknown,
                         QLatin1String(CopyrightStatement), QLatin1String(Text),
                         HomePageAddress, BugsEmailAddress);

    // set to GPL2
    aboutData.setLicense(KAboutLicense::GPL_V2);

    QCOMPARE(aboutData.licenses().count(), 1);
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v2"));
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 2"));
//     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL2Text) );
    QVERIFY(!aboutData.licenses().at(0).text().isEmpty());

    // set to Unknown again
    aboutData.setLicense(KAboutLicense::Unknown);

    QCOMPARE(aboutData.licenses().count(), 1);
// We don't know the default text, do we?
//     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString(WarningText) );
    QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::ShortName).isEmpty());
//     QCOMPARE( aboutData.licenses().at(0).name(KAboutLicense::FullName), QString(WarningText) );
    QVERIFY(!aboutData.licenses().at(0).name(KAboutLicense::FullName).isEmpty());
//     QCOMPARE( aboutData.licenses().at(0).text(), QString(WarningText) );
    QVERIFY(!aboutData.licenses().at(0).text().isEmpty());

    // add GPL3
    aboutData.addLicense(KAboutLicense::GPL_V3);

    QCOMPARE(aboutData.licenses().count(), 1);
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v3"));
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 3"));
//     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
    QVERIFY(!aboutData.licenses().at(0).text().isEmpty());

    // add GPL2, Custom and File
    aboutData.addLicense(KAboutLicense::GPL_V2);
    aboutData.addLicenseText(QLatin1String(LicenseText));
    aboutData.addLicenseTextFile(QString::fromLatin1(LicenseFileName));

    QCOMPARE(aboutData.licenses().count(), 4);
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v3"));
    QCOMPARE(aboutData.licenses().at(0).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 3"));
//     QCOMPARE( aboutData.licenses().at(0).text(), QString(GPL3Text) );
    QVERIFY(!aboutData.licenses().at(0).text().isEmpty());
    QCOMPARE(aboutData.licenses().at(1).name(KAboutLicense::ShortName), QString::fromLatin1("GPL v2"));
    QCOMPARE(aboutData.licenses().at(1).name(KAboutLicense::FullName), QString::fromLatin1("GNU General Public License Version 2"));
//     QCOMPARE( aboutData.licenses().at(1).text(), QString(GPL2Text) );
    QVERIFY(!aboutData.licenses().at(1).text().isEmpty());
    QCOMPARE(aboutData.licenses().at(2).name(KAboutLicense::ShortName), QString::fromLatin1("Custom"));
    QCOMPARE(aboutData.licenses().at(2).name(KAboutLicense::FullName), QString::fromLatin1("Custom"));
    QCOMPARE(aboutData.licenses().at(2).text(), QLatin1String(LicenseText));
    QCOMPARE(aboutData.licenses().at(3).name(KAboutLicense::ShortName), QString::fromLatin1("Custom"));
    QCOMPARE(aboutData.licenses().at(3).name(KAboutLicense::FullName), QString::fromLatin1("Custom"));
    QCOMPARE(aboutData.licenses().at(3).text(), QString(copyrightStatement + lineFeed + QLatin1String(LicenseFileText)));
}
KisAboutApplication::KisAboutApplication(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("About Krita"));

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setMargin(0);
    QTabWidget *wdg = new QTabWidget;
    vlayout->addWidget(wdg);

    KisSplashScreen *splash = new KisSplashScreen(qApp->applicationVersion(), QPixmap(splash_screen_xpm), true);
    splash->setWindowFlags(Qt::Widget);
    splash->setFixedSize(splash->sizeHint());
    wdg->addTab(splash, i18n("About"));
    setMinimumSize(wdg->sizeHint());

    QTextEdit *lblAuthors = new QTextEdit();
    lblAuthors->setReadOnly(true);

    QString authors = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Created By</h1></p>"
                          "<p>");

    QFile fileDevelopers(":/developers.txt");
    Q_ASSERT(fileDevelopers.exists());
    fileDevelopers.open(QIODevice::ReadOnly);

    foreach(const QByteArray &author, fileDevelopers.readAll().split('\n')) {
        authors.append(QString::fromUtf8(author));
        authors.append(", ");
    }
    authors.chop(2);
    authors.append(".</p></body></html>");
    lblAuthors->setText(authors);
    wdg->addTab(lblAuthors, i18n("Authors"));

    QTextEdit *lblKickstarter = new QTextEdit();
    lblKickstarter->setReadOnly(true);

    QString backers = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Backed By</h1>"
                          "<p>");

    QFile fileBackers(":/backers.txt");
    Q_ASSERT(fileBackers.exists());
    fileBackers.open(QIODevice::ReadOnly);
    foreach(const QByteArray &backer, fileBackers.readAll().split('\n')) {
        backers.append(QString::fromUtf8(backer));
        backers.append(", ");
    }
    backers.chop(2);
    backers.append(i18n(".</p><p><i>Thanks! You were all <b>awesome</b>!</i></p></body></html>"));
    lblKickstarter->setText(backers);
    wdg->addTab(lblKickstarter, i18n("Backers"));



    QTextEdit *lblCredits = new QTextEdit();
    lblCredits->setReadOnly(true);
    QString credits = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Thanks To</h1>"
                          "<p>");

    QFile fileCredits(":/credits.txt");
    Q_ASSERT(fileCredits.exists());
    fileCredits.open(QIODevice::ReadOnly);

    foreach(const QByteArray &credit, fileCredits.readAll().split('\n')) {
        if (!credit.isEmpty()) {
            QList<QByteArray> creditSplit = credit.split(':');
            Q_ASSERT(creditSplit.size() == 2);
            credits.append(QString::fromUtf8(creditSplit.at(0)));
            credits.append(" (<i>" + QString::fromUtf8(creditSplit.at(1)) + "</i>)");
            credits.append(", ");
        }
    }
    credits.chop(2);
    credits.append(i18n(".</p><p><i>For supporting Krita development with advice, icons, brush sets and more.</i></p></body></html>"));

    lblCredits->setText(credits);
    wdg->addTab(lblCredits, i18n("Also Thanks To"));

    QTextEdit *lblLicense = new QTextEdit();
    lblLicense->setReadOnly(true);
    QString license = i18n("<html>"
                           "<head/>"
                           "<body>"
                           "<h1 align=\"center\"><b>Your Rights</h1>"
                           "<p>Krita is released under the GNU General Public License (version 2 or any later version).</p>"
                           "<p>This license grants people a number of freedoms:</p>"
                           "<ul>"
                           "<li>You are free to use Krita, for any purpose</li>"
                           "<li>You are free to distribute Krita</li>"
                           "<li>You can study how Krita works and change it</li>"
                           "<li>You can distribute changed versions of Krita</li>"
                           "</ul>"
                           "<p>The Krita Foundation and its projects on krita.org are <b>committed</b> to preserving Krita as free software.</p>"
                           "<h1 align=\"center\">Your artwork</h1>"
                           "<p>What you create with Krita is your sole property. All your artwork is free for you to use as you like.</p>"
                           "<p>That means that Krita can be used commercially, for any purpose. There are no restrictions whatsoever.</p>"
                           "<p>Krita’s GNU GPL license guarantees you this freedom. Nobody is ever permitted to take it away, in contrast "
                           "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
                           "<br/><hr/><pre>");

    QFile licenseFile(":/LICENSE");
    Q_ASSERT(licenseFile.exists());
    licenseFile.open(QIODevice::ReadOnly);
    QByteArray ba = licenseFile.readAll();
    license.append(QString::fromUtf8(ba));
    license.append("</pre></body></html>");
    lblLicense->setText(license);

    wdg->addTab(lblLicense, i18n("License"));

    QPushButton *bnClose = new QPushButton(i18n("Close"));
    connect(bnClose, SIGNAL(clicked()), SLOT(close()));

    QHBoxLayout *hlayout = new QHBoxLayout;
    hlayout->setMargin(0);
    hlayout->addStretch(10);
    hlayout->addWidget(bnClose);

    vlayout->addLayout(hlayout);
}
Example #17
0
MainWindow::MainWindow() : QMainWindow()
{
	// Initialize MainWindow
	
	ui = new Ui::MainWindow();
	ui->setupUi(this);
	
	this->setWindowIcon(QIcon(":/icon.ico"));
	this->setWindowTitle("ColAndreas Wizard - " CA_VERSION);
	
	ui->headerImage->setPixmap(QPixmap(":/header.gif"));
	ui->statusBar->hide();
	ui->buttonBack->hide();
	ui->buttonNext->setEnabled(false);
	
	QPalette headerPalette(palette());
	headerPalette.setColor(QPalette::Background, Qt::black);
	ui->headerWidget->setAutoFillBackground(true);
	ui->headerWidget->setPalette(headerPalette);
	
	this->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter,	this->size(), qApp->desktop()->availableGeometry()));
	
	// Initialize licenseWidget
	
	licenseWidget = new QWidget(this);
	ui_license = new Ui::licenseWidget();
	ui_license->setupUi(licenseWidget);
	
	QFile licenseFile(":/license.html");
	licenseFile.open(QIODevice::ReadOnly);
	ui_license->licenseContainer->setHtml(licenseFile.readAll());
	
	ui->contentLayout->addWidget(licenseWidget);
	
	// Initialize settingsWidget
	
	settingsWidget = new QWidget(this);
	ui_settings = new Ui::settingsWidget();
	ui_settings->setupUi(settingsWidget);
	settingsWidget->hide();
	
	#ifdef WIN32
	HKEY key;
	if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Rockstar Games\\GTA San Andreas\\Installation", REG_OPTION_OPEN_LINK, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS)
	{
		DWORD size = MAX_PATH;
		char path[MAX_PATH];

		if(RegQueryValueEx(key, "ExePath", NULL, NULL, (BYTE*) path, &size) == ERROR_SUCCESS)
		{
			gamePath.append(path);
			gamePath.remove('"');
			
			if(gamePath.endsWith('/') || gamePath.endsWith('\\'))
			{
				gamePath.chop(1);
			}
			
			if(!QFile::exists(gamePath + "/gta_sa.exe"))
			{
				gamePath = "";
			}
		}

		RegCloseKey(key);
	}
	ui_settings->gamePathDisplay->setText(gamePath);
	#endif
	
	ui->contentLayout->addWidget(settingsWidget);
	
	// Initialize workWidget
	
	workWidget = new QWidget(this);
	ui_work = new Ui::workWidget();
	ui_work->setupUi(workWidget);
	workWidget->hide();
	ui->contentLayout->addWidget(workWidget);
	
	// Initialize timer
	
	threadTimer = new QTimer(this);
	threadTimer->setInterval(250);
	threadTimer->setSingleShot(false);
	
	// Set-up signals
	
	connect(ui->buttonNext, &QPushButton::released, this, &MainWindow::next);
	connect(ui->buttonBack, &QPushButton::released, this, &MainWindow::back);
	connect(ui->buttonCancel, &QPushButton::released, this, &MainWindow::cancel);
	
	connect(threadTimer, &QTimer::timeout, this, &MainWindow::updateThread);
	connect(ui_license->licenseAcceptRadio, &QRadioButton::toggled, this, &MainWindow::acceptsLicense);
	connect(ui_settings->gameBrowseButton, &QPushButton::released, this, &MainWindow::browseGame);
	connect(ui_settings->outputBrowseButton, &QPushButton::released, this, &MainWindow::browseOutput);
}
Example #18
0
AboutDialog::AboutDialog(QWidget* parent)
    : QDialog(parent)
{
#if defined(Q_OS_WIN)
    resize(530, 620);
    setMinimumSize(530, 620);
#elif defined(Q_OS_MAC)
    resize(660, 690);
    setMinimumSize(660, 690);
#endif

    setWindowModality(Qt::WindowModal);
    QString titleText = tr("About %1").arg(Defs::APP_NAME);
    setWindowTitle(titleText);
    WidgetUtils::removeContextHelpButton(this);

    auto introduction = new QLabel;
    introduction->setText(
        tr("<h2>%1<sup>&reg;</sup> version %2 %3</h2>"
           "<h6>Built on %4 at %5<br />With %7<br /></h6>"
           ).arg(Defs::APP_NAME)
            .arg(Defs::APP_VERSION_STR)
            .arg(Defs::APP_STAGE_STR)
            .arg(QStringLiteral(__DATE__))
            .arg(QStringLiteral(__TIME__))
        #if defined(Q_OS_WIN)
            .arg(Defs::WIN_COMPILER)
        #elif defined(Q_OS_MAC)
            .arg(Defs::MAC_COMPILER)
        #endif
        );
    auto icon = new QLabel;
    auto app_logo_2x = QPixmap(QStringLiteral(":/icons/app-logo-about"));
#if defined(Q_OS_MAC)
    app_logo_2x.setDevicePixelRatio(2.0);
#endif
    icon->setPixmap(app_logo_2x);

    // About information
    auto infoWidget = new QWidget;
    auto infoLabel = new QLabel;
    infoLabel-> setText(
        tr("<br />%1 is an open source software application that is developed, "
           "maintained, supported by LI-COR Biosciences. It originates from "
           "ECO2S, the Eddy COvariance COmmunity Software project, which was "
           "developed as part of the IMECC-EU research project.</p>"
           "<p>We gratefully acknowledge the IMECC consortium, the ECO2S "
           "development team, the University of Tuscia (Italy) and scientists "
           "around the world who assisted with development and testing of the "
           "original version of this software."
           "<p>Copyright &copy; 2011-%2 LI-COR Inc.</p>"
           "<div>Contact LI-COR Inc.:</div><br />"
           "<div style=\"text-indent: 20px;\">4647 Superior Street</div>"
           "<div style=\"text-indent: 20px;\">P.O. Box 4000</div>"
           "<div style=\"text-indent: 20px;\">Lincoln, Nebraska, 68504, USA</div><br />"
           "<div style=\"text-indent: 20px;\">Phone: 1-402-467-3576</div>"
           "<div style=\"text-indent: 20px;\">Toll Free: 800-447-3576</div>"
           "<div style=\"text-indent: 20px;\">Fax: 1-402-467-2819</div>"
           "<div style=\"text-indent: 20px;\">Email: <a href=\"mailto:[email protected]?subject=EddyPro %3\">[email protected]</a></div>"
           "<div style=\"text-indent: 20px;\">Website: <a href=\"http://www.licor.com\">http://www.licor.com</a></div>"
           ).arg(Defs::APP_NAME).arg(Defs::CURRENT_COPYRIGHT_YEAR).arg(Defs::APP_VERSION_STR)
        );
    infoLabel->setOpenExternalLinks(true);
    infoLabel->setWordWrap(true);

    auto infoLayout = new QVBoxLayout;
    infoLayout->addWidget(infoLabel);
    infoLayout->addStretch();
    infoWidget->setLayout(infoLayout);

    // Thanks
    auto thanksWidget = new QWidget;
    auto thanksLabel = new QLabel;
    thanksLabel->setText(
        tr("<br />We would like to thank the whole "
            "Eddy Covariance community, the authors, testers, the users and the "
            "following people (and the missing ones), in no special "
            "order, for their collaboration and source code contribution "
            "to create this free software." ));
    thanksLabel->setWordWrap(true);

    auto thanksEdit = new QTextEdit;
    thanksEdit->setText(
        tr("<h4>Original Authors</h4>"
           "<ul type=\"square\">"
           "<li>Gerardo Fratini ([email protected]): processing engines designer and developer</li>"
           "<li>Antonio Forgione ([email protected]): GUI designer and developer</li>"
           "<li>Dario Papale ([email protected]): project manager and coordinator</li>"
           "</ul>"

           "<h4>Others contributors</h4>"
           "<ul type=\"square\">"
           "<li>Carlo Trotta: code harmonization and documentation</li>"
           "<li>Natascha Kljun: code for footprint estimation, Kljun et al. (2004, BLM)</li>"
           "<li>Taro Nakai: code for angle of attack correction, Nakai et al. (2006, AFM)</li>"
           "<li>Andreas Ibrom: supervision during implementation of a spectral correction procedure, Ibrom et al. (2007, AFM)</li>"
           "<li>Stephen Chan: Revision, refinement and testing of implementation of Massman 2000/2001 spectral correction.</li>"
           "</ul>"

           "<h4>Software validation (intercomparison)</h4>"
           "<ul type=\"square\">"
           "<li>Juha-Pekka Tuovinen</li>"
           "<li>Andreas Ibrom</li>"
           "<li>Ivan Mammarella</li>"
           "<li>Robert Clement</li>"
           "<li>Meelis Molder</li>"
           "<li>Olaf Kolle</li>"
           "<li>Corinna Rebmann</li>"
           "<li>Matthias Mauder</li>"
           "<li>Jan Elbers</li>"
           "</ul>"

           "<h4>User testing and bug notifications</h4>"
           "<ul type=\"square\">"
           "<li>Tarek El-Madany</li>"
           "<li>Sergiy Medinets</li>"
           "<li>Beniamino Gioli</li>"
           "<li>Nicola Arriga</li>"
           "<li>Luca Belelli</li>"
           "<li>Michal Heliasz</li>"
           "<li>Bernard Heinesch</li>"
           "<li>Arnaud Carrara</li>"
           "<li>Patrik Vestin</li>"
           "<li>Matthias Barthel</li>"
           "<li>Karoline Wischnewski</li>"
           "<li>Matthew Wilkinson</li>"
           "<li>Simone Sabbatini</li>"
           "</ul>"

           "<h4>Software discussions</h4>"
           "<ul type=\"square\">"
           "<li>Ian Elbers</li>"
           "<li>George Burba</li>"
           "<li>Christian Wille</li>"
           "</ul>"

           "<h4>Libraries</h4>"
           "<ul type=\"square\">"
           "<li>Arjan van Dijk: libdate module</li>"
           "<li>Michael Baudin, Arjen Markus: m_logging module</li>"
           "<li>University of Chicago: m_levenberg_marquardt from the MINPACK package</li>"
           "<li>netlib.org: FFT routines from the SLATEC Common Mathematical Library</li>"
           "<li>The Qt Company: Qt framework</li>"
           "<li>Boost::math</li>"
           "<li>Trenton Schulz (Trolltech AS): Fader widget</li>"
           "<li>Morgan Leborgne: QProgressIndicator widget</li>"
           "<li>Witold Wysota: Debug helper class</li>"
           "<li>Sergey A. Tachenov: QuaZIP</li>"
           "<li>Mark Summerfield: classes from the book 'Advanced Qt Programming'</li>"
           "</ul>"

           "<h4>Tools</h4>"
           "<ul type=\"square\">"
           "<li>GFortran compiler</li>"
           "<li>MinGW compiler and GDB debugger</li>"
           "<li>Clang compiler</li>"
           "<li>The Qt Company: Qt Creator IDE</li>"
           "<li>Code::Blocks IDE</li>"
           "<li>\n</li>"
           "</ul>"));
    thanksEdit->setReadOnly(true);

    auto thanksLayout = new QVBoxLayout;
    thanksLayout->addWidget(thanksLabel);
    thanksLayout->addWidget(thanksEdit);
    thanksWidget->setLayout(thanksLayout);

    // License
    auto licenseWidget = new QWidget;
    auto licenseLabel = new QLabel;
    licenseLabel->setText(
        tr("<br />The %1 software application is Copyright &copy; 2011-%2 "
           "LI-COR Inc.\n\n"
           "You may use, distribute and copy the %1 programs suite under "
           "the terms of the GNU General Public License version 3, "
           "which is displayed below. If you would like to obtain "
           "a copy of the source package please contact LI-COR "
           "Biosciences at "
           "<a href=\"mailto:[email protected]?subject=%1 %3&body="
           "Please, send me a copy of the source package."
           "\">[email protected]</a>."
        ).arg(Defs::APP_NAME).arg(Defs::CURRENT_COPYRIGHT_YEAR).arg(Defs::APP_VERSION_STR));
    licenseLabel->setWordWrap(true);
    licenseLabel->setOpenExternalLinks(true);

    auto licenseEdit = new QTextEdit;
    QFile licenseFile(QStringLiteral(":/docs/license"));
    qDebug() << licenseFile.open(QIODevice::ReadOnly | QIODevice::Text);
    licenseEdit->setText(QLatin1String(licenseFile.readAll()));
    licenseEdit->setReadOnly(true);
    licenseFile.close();

    auto licenseLayout = new QVBoxLayout;
    licenseLayout->addWidget(licenseLabel);
    licenseLayout->addWidget(licenseEdit);
    licenseWidget->setLayout(licenseLayout);

    // Changelog
    auto changelogWidget = new QWidget;
    auto changelogLabel = new QLabel;
    changelogLabel->setText(
        tr("<br />Software updates include bug fixes, usability "
           "improvements\n\n and feature enhancements. These are summarized "
           "in the change log below."));
    changelogLabel->setWordWrap(true);
    changelogLabel->setOpenExternalLinks(true);

    auto changelogEdit = new QTextEdit;
    QFile changelogFile(QStringLiteral(":/docs/changelog"));
    qDebug() << changelogFile.open(QIODevice::ReadOnly | QIODevice::Text);
    changelogEdit->setText(QLatin1String(changelogFile.readAll()));
    changelogEdit->setReadOnly(true);
    changelogFile.close();

    auto changelogLayout = new QVBoxLayout;
    changelogLayout->addWidget(changelogLabel);
    changelogLayout->addWidget(changelogEdit);
    changelogWidget->setLayout(changelogLayout);

    // Dialog Tabs
    auto tab = new QTabWidget;
    tab->addTab(infoWidget, tr("About"));
    tab->addTab(thanksWidget, tr("Acknowledgments"));
    tab->addTab(licenseWidget, tr("License"));
    tab->addTab(changelogWidget, tr("Changes"));

    auto okButton = WidgetUtils::createCommonButton(this, tr("Ok"));

    auto dialogLayout = new QVBoxLayout(this);
    dialogLayout->addWidget(icon, 0, Qt::AlignCenter);
    dialogLayout->addWidget(introduction, 0, Qt::AlignCenter);
    dialogLayout->addWidget(tab);
    dialogLayout->addWidget(okButton, 0, Qt::AlignCenter);
    dialogLayout->setContentsMargins(30, 30, 30, 30);
    setLayout(dialogLayout);

    connect(okButton, &QPushButton::clicked,
            [=](){ if (this->isVisible()) hide(); });
}