/** * Constructor of the favoriteWindow class, completing its window. * @param profile The current user profile * @param Favorite The favorite we are setting options for * @param parent The parent window */ favoriteWindow::favoriteWindow(Profile *profile, const Favorite &favorite, QWidget *parent) : QDialog(parent), ui(new Ui::favoriteWindow), m_profile(profile), m_favorite(favorite) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); ui->tagLineEdit->setText(m_favorite.getName()); ui->noteSpinBox->setValue(m_favorite.getNote()); ui->lastViewedDateTimeEdit->setDateTime(m_favorite.getLastViewed()); QStringList sourceKeys = profile->getSites().keys(); ui->comboMonitoringSource->addItems(sourceKeys); if (!m_favorite.getMonitors().isEmpty()) { Monitor monitor = m_favorite.getMonitors().first(); ui->spinMonitoringInterval->setValue(qFloor(monitor.interval() / 60)); ui->comboMonitoringSource->setCurrentIndex(sourceKeys.indexOf(monitor.site()->url())); } connect(this, &QDialog::accepted, this, &favoriteWindow::save); }