Ejemplo n.º 1
0
int PTUser::run(int ac, char **av)
{
  MyApplication app(ac, av);
  LoginWidget *login;

  login = new LoginWidget;

  QFile File2("./gui/stylesheetLogin.qss");
  File2.open(QFile::ReadOnly);
  QString StyleSheet2 = QLatin1String(File2.readAll());

  /* Applying it */
  login->setStyleSheet(StyleSheet2);

  /* Opening CSS file for Main Widget*/

  QFile File("./gui/stylesheet.qss");
  File.open(QFile::ReadOnly);
  QString StyleSheet = QLatin1String(File.readAll());

  /* Applying it */
  app.setStyleSheet(StyleSheet);

  /* Show login window */
  login->setAttribute(Qt::WA_DeleteOnClose);
  login->show();

  return app.exec();
}
Ejemplo n.º 2
0
void DlgAbout::DoInitDialog() {
    QString FName,Text;
    QFile   File;

    if (ApplicationConfig->CurrentLanguage!="fr") FName=ApplicationConfig->StartingPath+QDir::separator()+QString("changelog-en.txt");
        else FName=ApplicationConfig->StartingPath+QDir::separator()+QString("changelog-fr.txt");
    File.setFileName(FName);
    if (File.open(QIODevice::ReadOnly|QIODevice::Text)) {
        QTextStream InStream(&File);
        InStream.setCodec("UTF-8");
        Text=InStream.readAll();
        ui->ChangelogED->setText(Text);
        File.close();
    } else {
        ui->tabWidget->removeTab(5);
    }

    Text.clear();
    if (ApplicationConfig->CurrentLanguage!="en") {
        FName=ApplicationConfig->UserConfigPath+QString("%1_LOCALEVERSION.TXT").arg(ApplicationConfig->CurrentLanguage);
        File.setFileName(FName);
        if (!File.exists()) {
            FName=ApplicationConfig->UserConfigPath+QString("%1_VERSION.TXT").arg(ApplicationConfig->CurrentLanguage);
            File.setFileName(FName);
        }
        if (!File.exists()) {
            FName=ApplicationConfig->UserConfigPath+QString("LOCALEVERSION.TXT");
            File.setFileName(FName);
        }
        if (!File.exists()) {
            FName=ApplicationConfig->UserConfigPath+QString("VERSION.TXT");
            File.setFileName(FName);
        }
        if (File.open(QIODevice::ReadOnly|QIODevice::Text)) {
            while (!File.atEnd()) {
                QString Line=File.readLine();
                if (Line.indexOf("=")<0) Line=QApplication::translate("DlgAbout","Interface translation version: ")+Line+"\n\ten\t100%\n"; else {
                    if (Line.indexOf("to translate")) Line.replace("to translate",QApplication::translate("DlgAbout","to translate"));
                    Line="\t"+Line;
                    Line.replace(" = ","\t");
                }
                Text.append(Line);
            }
            File.close();
        }
    }

    if (ApplicationConfig->CurrentLanguage!="en") {
        FName=ApplicationConfig->UserConfigPath+QString("%1_WIKIVERSION.TXT").arg(ApplicationConfig->CurrentLanguage);
        File.setFileName(FName);
        if (!File.exists()) {
            FName=ApplicationConfig->UserConfigPath+QString("WIKIVERSION.TXT");
            File.setFileName(FName);
        }
        if (File.open(QIODevice::ReadOnly|QIODevice::Text)) {
            while (!File.atEnd()) {
                QString Line=File.readLine();
                if (Line.indexOf("=")<0) {
                    if (!Text.isEmpty()) Text.append("\n");
                    Line=QApplication::translate("DlgAbout","WIKI translation version: ")+Line+"\n\ten\t100%\n";
                } else {
                    if (Line.indexOf("to translate")) Line.replace("to translate",QApplication::translate("DlgAbout","to translate"));
                    Line="\t"+Line;
                    Line.replace(" = ","\t");
                }
                Text.append(Line);
            }
            File.close();
        }
    }
    if (!Text.isEmpty()) ui->TranslationED->setText(Text); else ui->tabWidget->removeTab(4);

    FName=QString("clipart")+QDir::separator()+QString("openclipart-0.18-svgonly-readme.txt");
    File.setFileName(FName);
    if (File.open(QIODevice::ReadOnly|QIODevice::Text)) {
        Text=File.readAll();
        ui->OpenclipartED->setText(Text);
        File.close();
    } else {
        ui->tabWidget->removeTab(3);
    }
    FName=QString("background")+QDir::separator()+QString("texturemate")+QDir::separator()+QString("readme.txt");
    File.setFileName(FName);
    if (File.open(QIODevice::ReadOnly|QIODevice::Text)) {
        QString Text=File.readAll();
        ui->TexturemateED->setText(Text);
        File.close();
    } else {
        ui->tabWidget->removeTab(2);
    }
    QFile File2("authors.txt");
    if (File2.open(QIODevice::ReadOnly|QIODevice::Text)) {
        QString Text=File2.readAll();
        ui->CreditsED->setText(Text);
        File2.close();
    } else {
        ui->tabWidget->removeTab(1);
    }

    ui->ApplicationReleaseLabel->setText(QString("%1 (%2)").arg(CurrentAppName).arg(CurrentAppVersion));
    ui->ApplicationNameLabel->setText(APPLICATION_NAME);
    ui->tabWidget->setCurrentIndex(0);
}