File indexing completed on 2022-11-22 14:07:11

0001 /*
0002     SPDX-FileCopyrightText: 2022 Julius K├╝nzel <jk.kdedev@smartlab.uber.space>
0003 
0004     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_editrenderpreset_ui.h"
0010 
0011 class RenderPresetModel;
0012 class Monitor;
0013 
0014 class RenderPresetDialog : public QDialog, Ui::EditRenderPreset_UI
0015 {
0016     Q_OBJECT
0017 public:
0018     enum Mode {
0019         New = 0,
0020         Edit,
0021         SaveAs
0022     };
0023     explicit RenderPresetDialog(QWidget *parent, RenderPresetModel *preset = nullptr, Mode mode = Mode::New);
0024     /** @returns the name that was finally under which the preset has been saved */
0025     ~RenderPresetDialog() override;
0026     QString saveName();
0027 
0028 protected:
0029     bool eventFilter(QObject *o, QEvent *e) override;
0030 
0031 private:
0032     QString m_saveName;
0033     QStringList m_uiParams;
0034     Monitor *m_monitor;
0035     double m_fixedResRatio;
0036     bool m_manualPreset;
0037 
0038     void setPixelAspectRatio(int num, int den);
0039     void updateDisplayAspectRatio();
0040 
0041 private slots:
0042     void slotUpdateParams();
0043 };