[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(); 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(); auto currSize = profile->size();
profile->resize(1024,768); profile->resize(size);
profile->setToolTipVisibile(false); profile->setToolTipVisibile(false);
QPixmap pix = profile->grab(); QPixmap pix = profile->grab();
profile->setToolTipVisibile(true); profile->setToolTipVisibile(true);
@ -320,6 +325,15 @@ SocialNetworkDialog::SocialNetworkDialog(QWidget *parent) :
connect(ui->album, &QLineEdit::editingFinished, this, &SocialNetworkDialog::albumChanged); 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() void SocialNetworkDialog::albumChanged()
{ {
QAbstractButton *button = ui->buttonBox->button(QDialogButtonBox::Ok); QAbstractButton *button = ui->buttonBox->button(QDialogButtonBox::Ok);

View file

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

View file

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