[Facebook] Add hability to choose size of profile

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2017-09-29 14:33:20 +02:00 committed by Dirk Hohndel
parent 9b1a949a39
commit f159802053
3 changed files with 58 additions and 14 deletions

View file

@ -194,8 +194,13 @@ void FacebookManager::sendDive()
ProfileWidget2 *profile = MainWindow::instance()->graphics();
QSize size = dialog.profileSize() == SocialNetworkDialog::SMALL ? QSize(800,600)
: dialog.profileSize() == SocialNetworkDialog::MEDIUM ? QSize(1024,760)
: dialog.profileSize() == SocialNetworkDialog::BIG ? QSize(1280,1024)
: QSize();
auto currSize = profile->size();
profile->resize(1024,768);
profile->resize(size);
profile->setToolTipVisibile(false);
QPixmap pix = profile->grab();
profile->setToolTipVisibile(true);
@ -320,6 +325,15 @@ SocialNetworkDialog::SocialNetworkDialog(QWidget *parent) :
connect(ui->album, &QLineEdit::editingFinished, this, &SocialNetworkDialog::albumChanged);
}
SocialNetworkDialog::Size SocialNetworkDialog::profileSize() const
{
QString currText = ui->profileSize->currentText();
return currText.startsWith(tr("Small")) ? SMALL :
currText.startsWith(tr("Medium")) ? MEDIUM :
/* currText.startsWith(tr("Big")) ? */ BIG;
}
void SocialNetworkDialog::albumChanged()
{
QAbstractButton *button = ui->buttonBox->button(QDialogButtonBox::Ok);

View file

@ -66,9 +66,13 @@ private:
class SocialNetworkDialog : public QDialog {
Q_OBJECT
public:
enum Size {SMALL, MEDIUM, BIG};
SocialNetworkDialog(QWidget *parent = 0);
QString text() const;
QString album() const;
Size profileSize() const;
public slots:
void selectionChanged();
void albumChanged();

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>528</width>
<height>418</height>
<width>591</width>
<height>619</height>
</rect>
</property>
<property name="windowTitle">
@ -15,10 +15,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,0,0,0,0,0,0,0,0,0">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<property name="margin">
<number>1</number>
</property>
<item row="7" column="0">
<widget class="QComboBox" name="profileSize">
<item>
<property name="text">
<string>Small</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>Big</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
@ -32,63 +51,63 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Album</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="5" column="0">
<widget class="QLineEdit" name="album">
<property name="toolTip">
<string>The profile picture will be posted in this album (required)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Include</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="9" column="0">
<widget class="QCheckBox" name="date">
<property name="text">
<string>Date and time</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="10" column="0">
<widget class="QCheckBox" name="duration">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="11" column="0">
<widget class="QCheckBox" name="Location">
<property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="12" column="0">
<widget class="QCheckBox" name="Divemaster">
<property name="text">
<string>Divemaster</string>
</property>
</widget>
</item>
<item row="9" column="0">
<item row="13" column="0">
<widget class="QCheckBox" name="Buddy">
<property name="text">
<string>Buddy</string>
</property>
</widget>
</item>
<item row="10" column="0">
<item row="14" column="0">
<widget class="QCheckBox" name="Notes">
<property name="text">
<string>Notes</string>
@ -108,9 +127,16 @@
</property>
</widget>
</item>
<item row="2" column="1" rowspan="9">
<item row="4" column="1" rowspan="11">
<widget class="QPlainTextEdit" name="text"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Image Size</string>
</property>
</widget>
</item>
</layout>
</item>
<item>