diff --git a/interface/interface_en.ts b/interface/interface_en.ts index beada5df43..0a5b7e4057 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -158,4 +158,25 @@ + + SnapshotShareDialog + + + + Share with community + + + + + + Notes about this image + + + + + + Share + + + diff --git a/interface/src/ui/SnapshotShareDialog.cpp b/interface/src/ui/SnapshotShareDialog.cpp index 2af564ff0b..d57951a484 100644 --- a/interface/src/ui/SnapshotShareDialog.cpp +++ b/interface/src/ui/SnapshotShareDialog.cpp @@ -6,6 +6,9 @@ // // +const int NARROW_SNAPSHOT_DIALOG_SIZE = 500; +const int WIDE_SNAPSHOT_DIALOG_WIDTH = 650; + #include "SnapshotShareDialog.h" SnapshotShareDialog::SnapshotShareDialog(QString fileName, QWidget* parent) : QDialog(parent), _fileName(fileName) { @@ -16,11 +19,24 @@ SnapshotShareDialog::SnapshotShareDialog(QString fileName, QWidget* parent) : QD QPixmap snaphsotPixmap(fileName); float snapshotRatio = static_cast(snaphsotPixmap.size().width()) / snaphsotPixmap.size().height(); + + // narrow snapshot + if (snapshotRatio > 1) { + setFixedWidth(WIDE_SNAPSHOT_DIALOG_WIDTH); + ui.snapshotWidget->setFixedWidth(WIDE_SNAPSHOT_DIALOG_WIDTH); + } + float labelRatio = static_cast(ui.snapshotWidget->size().width()) / ui.snapshotWidget->size().height(); // set the same aspect ratio of label as of snapshot if (snapshotRatio > labelRatio) { + int oldHeight = ui.snapshotWidget->size().height(); ui.snapshotWidget->setFixedHeight(ui.snapshotWidget->size().width() / snapshotRatio); + + // if height is less then original, resize the window as well + if (ui.snapshotWidget->size().height() < NARROW_SNAPSHOT_DIALOG_SIZE) { + setFixedHeight(size().height() - (oldHeight - ui.snapshotWidget->size().height())); + } } else { ui.snapshotWidget->setFixedWidth(ui.snapshotWidget->size().height() * snapshotRatio); } diff --git a/interface/ui/shareSnapshot.ui b/interface/ui/shareSnapshot.ui index 85334cbc65..cb8754a46d 100644 --- a/interface/ui/shareSnapshot.ui +++ b/interface/ui/shareSnapshot.ui @@ -9,26 +9,26 @@ 0 0 - 789 - 645 + 502 + 625 - + 0 0 - 789 - 645 + 500 + 625 - 789 - 645 + 502 + 625 @@ -43,189 +43,168 @@ true - - - - -1 - -1 - 792 - 645 - + + + 0 - - - 0 - - - - - - 0 - 0 - - - - - 790 - 510 - - - - - 790 - 510 - - - - background-color: #000 - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - - -1 - 1 - 792 - 512 - + + 0 + + + 0 + + + 0 + + + 0 + + + + + QLayout::SetMinAndMaxSize + + + + + + 0 + 0 + + + + + 500 + 500 + + + + + 30 + 2000 + + + + background-color: #ccc; + + + 0 + + + true + + + Qt::AlignCenter + + + 0 - - - 0 - - - - - - 0 - 0 - - - - - 790 - 510 - - - - - 790 - 510 - - - - background-color: #ccc; - - - 0 - - - true - - - Qt::AlignCenter - - - 0 - - - - - - - - - - - 0 - 0 - - - - - 0 - 30 - - - - - Helvetica - 75 - true - - - - color: #666; - - - Notes about this image - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - 0 - - - 20 - - - - - - - 0 - - - 20 - - - 20 - - - - - - 0 - 0 - - - - - Helvetica - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - background-color: #333333; + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + Helvetica + 75 + true + + + + color: #666; +padding-left:20px; + + + 0 + + + Notes about this image + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + 0 + + + 0 + + + + + + + 0 + + + QLayout::SetFixedSize + + + 20 + + + 20 + + + + + + 0 + 0 + + + + + 16777215 + 60 + + + + + Helvetica + 14 + + + + QFrame::Box + + + QFrame::Plain + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + background-color: #333333; border-width: 0; border-radius: 9px; border-radius: 9px; @@ -235,16 +214,17 @@ color: #FFFFFF; width: 120px; height: 50px; - - - Share - - - - - - - + + + Share + + + + + + + +