about.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * about.cpp - about dialog
  3. * Copyright (C) 2017 caryoscelus
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <fmt/format.h>
  19. #include <QFile>
  20. #include <version.h>
  21. #include "about.h"
  22. #include "ui_about.h"
  23. namespace studio {
  24. AboutDialog::AboutDialog(QWidget* parent) :
  25. QDialog(parent),
  26. ui(std::make_unique<Ui::AboutDialog>())
  27. {
  28. ui->setupUi(this);
  29. auto about_formatted = fmt::format(
  30. ui->about_label->text().toStdString(),
  31. RAINYNITE_STUDIO_VERSION,
  32. RAINYNITE_STUDIO_CODENAME
  33. );
  34. ui->about_label->setText(QString::fromStdString(about_formatted));
  35. QFile license(":/text/COPYING.gpl3");
  36. if (license.open(QIODevice::ReadOnly)) {
  37. ui->license_text->setText(license.readAll());
  38. license.close();
  39. }
  40. connect(ui->close_button, SIGNAL(clicked()), this, SLOT(accept()));
  41. }
  42. AboutDialog::~AboutDialog() {
  43. }
  44. } // namespace studio