Vuo  2.0.3
VuoInfoDialog.cc
Go to the documentation of this file.
1 
10 #include "VuoInfoDialog.hh"
11 
12 #include "VuoRendererFonts.hh"
13 
23 VuoInfoDialog::VuoInfoDialog(QWidget *parent, QString summary, QString details, QString checkboxLabel, QString settingsKey)
24  : QMessageBox(parent)
25 {
26  this->summary = summary;
27  this->details = details;
28  this->checkboxLabel = checkboxLabel;
29  this->settingsKey = settingsKey;
30 }
31 
36 {
37  auto settings = new QSettings;
38  if (!settings->value(settingsKey, true).toBool())
39  {
40  emit notShown();
41  return;
42  }
43 
45 
46  setWindowFlags(Qt::Sheet);
47  setWindowModality(Qt::WindowModal);
48  setFont(fonts->dialogHeadingFont());
49  setTextFormat(Qt::RichText);
50  setText(summary);
51  setInformativeText("<style>p{" + fonts->getCSS(fonts->dialogBodyFont()) + "}</style>" + details);
52  setIcon(QMessageBox::Information);
53 
54  QCheckBox *cb = new QCheckBox(this);
55  cb->setFont(fonts->dialogBodyFont());
56  cb->setText(checkboxLabel);
57  cb->setChecked(true);
58  setCheckBox(cb);
59 
60  connect(this, &QMessageBox::finished, [=](){
61  if (!cb->isChecked())
62  settings->setValue(settingsKey, false);
63  delete settings;
64  });
65 
66  open();
67 }