+
+QString QtCamVideoResolution::aspectRatio() const {
+ return d_ptr->aspectRatio;
+}
+
+QString QtCamVideoResolution::resolution() const {
+ return d_ptr->resolution;
+}
+
+QtCamVideoSettings::QtCamVideoSettings(const QString& id, const QString& suffix,
+ const QString& profileName,
+ const QString& profilePath,
+ const QList<QtCamVideoResolution>& resolutions) :
+ d_ptr(new QtCamVideoSettingsPrivate) {
+
+ d_ptr->id = id;
+ d_ptr->suffix = suffix;
+ d_ptr->profileName = profileName;
+ d_ptr->profilePath = profilePath;
+ d_ptr->resolutions = resolutions;
+}
+
+QtCamVideoSettings::QtCamVideoSettings(const QtCamVideoSettings& other) :
+ d_ptr(other.d_ptr) {
+
+}
+
+QtCamVideoSettings& QtCamVideoSettings::operator=(const QtCamVideoSettings& other) {
+ d_ptr = other.d_ptr;
+
+ return *this;
+}
+
+QtCamVideoSettings::~QtCamVideoSettings() {
+ // QSharedData will take care of reference counting.
+}
+
+QString QtCamVideoSettings::id() const {
+ return d_ptr->id;
+}
+
+QString QtCamVideoSettings::suffix() const {
+ return d_ptr->suffix;
+}
+
+QString QtCamVideoSettings::profileName() const {
+ return d_ptr->profileName;
+}
+
+QString QtCamVideoSettings::profilePath() const {
+ return d_ptr->profilePath;
+}
+
+QtCamVideoResolution QtCamVideoSettings::defaultResolution(const QString& aspectRatio) const {
+ if (aspectRatio.isEmpty()) {
+ return d_ptr->resolutions[0];
+ }
+
+ foreach (const QtCamVideoResolution& r, d_ptr->resolutions) {
+ if (r.aspectRatio() == aspectRatio) {
+ return r;
+ }
+ }
+
+ return d_ptr->resolutions[0];
+}
+
+QList<QtCamVideoResolution> QtCamVideoSettings::resolutions(const QString& aspectRatio) const {
+ if (aspectRatio.isEmpty()) {
+ return d_ptr->resolutions;
+ }
+
+ QList<QtCamVideoResolution> res;
+
+ foreach (const QtCamVideoResolution& r, d_ptr->resolutions) {
+ if (r.aspectRatio() == aspectRatio) {
+ res << r;
+ }
+ }
+
+ return d_ptr->resolutions;
+}
+
+QStringList QtCamVideoSettings::aspectRatios() const {
+ QStringList aspects;
+
+ foreach (const QtCamVideoResolution& r, d_ptr->resolutions) {
+ if (aspects.indexOf(r.aspectRatio()) == -1) {
+ aspects << r.aspectRatio();
+ }
+ }
+
+ return aspects;
+}