progressdialog.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include <QDesktopServices>
  2. #include <QUrl>
  3. #include <QDebug>
  4. #include "progressdialog.h"
  5. #include "ui_progressdialog.h"
  6. #include "settings.h"
  7. ProgressDialog::ProgressDialog(QWidget *parent) :
  8. QDialog(parent),
  9. ui(new Ui::ProgressDialog)
  10. {
  11. ui->setupUi(this);
  12. setWindowTitle("Nokia Hybrid Application Generator");
  13. connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
  14. connect(ui->buttonLog, SIGNAL(clicked()), this, SLOT(openLog()));
  15. connect(ui->buttonSIS, SIGNAL(clicked()), this, SIGNAL(openSIS()));
  16. ui->buttonCancel->setFocus();
  17. }
  18. ProgressDialog::~ProgressDialog()
  19. {
  20. delete ui;
  21. }
  22. void ProgressDialog::changeEvent(QEvent *e)
  23. {
  24. QDialog::changeEvent(e);
  25. switch (e->type()) {
  26. case QEvent::LanguageChange:
  27. ui->retranslateUi(this);
  28. break;
  29. default:
  30. break;
  31. }
  32. }
  33. void ProgressDialog::setFinishedView(GeneratorTarget target, bool success)
  34. {
  35. ui->buttonCancel->setText(tr("Close"));
  36. if (success && (target == BUILD || target == REBUILD))
  37. {
  38. ui->buttonSIS->setEnabled(true);
  39. }
  40. }
  41. void ProgressDialog::setMaximumProgress(int maximum)
  42. {
  43. ui->progressBar->setMaximum(maximum);
  44. }
  45. void ProgressDialog::updateProgress(int current)
  46. {
  47. ui->progressBar->setValue(current);
  48. }
  49. void ProgressDialog::updateStatusText(QString text)
  50. {
  51. ui->label->setText(text);
  52. }
  53. void ProgressDialog::openLog()
  54. {
  55. qDebug() << "Open log";
  56. QDesktopServices::openUrl(QUrl::fromLocalFile(Settings::get(Settings::LogFilePath).toString()));
  57. }