1 /* ============================================================
2  *
3  * This file is a part of KDE project
4  *
5  *
6  * Date        : 2008-09-12
7  * Description : a kipi plugin to export to Yandex.Fotki
8  *
9  * Copyright (C) 2015 by Shourya Singh Gupta <shouryasgupta at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * ============================================================ */
22 
23 #include "yfwidget.h"
24 
25 // Qt includes
26 
27 #include <QLabel>
28 #include <QSpinBox>
29 #include <QCheckBox>
30 #include <QGroupBox>
31 #include <QRadioButton>
32 #include <QGridLayout>
33 #include <QHBoxLayout>
34 #include <QVBoxLayout>
35 #include <QComboBox>
36 #include <QApplication>
37 #include <QPushButton>
38 #include <QLineEdit>
39 #include <QButtonGroup>
40 
41 // KDE includes
42 
43 #include <klocalizedstring.h>
44 
45 //local includes
46 
47 #include "yfphoto.h"
48 #include "yfalbum.h"
49 
50 namespace KIPIYandexFotkiPlugin
51 {
52 
YandexFotkiWidget(QWidget * const parent,KIPI::Interface * const iface,const QString & pluginName)53 YandexFotkiWidget::YandexFotkiWidget(QWidget* const parent, KIPI::Interface* const iface, const QString& pluginName)
54     : KPSettingsWidget(parent, iface, pluginName)
55 {
56     QGroupBox* const optionsBox         = getOptionsBox();
57     QGridLayout* const optionsBoxLayout = getOptionsBoxLayout();
58 
59     QSpacerItem* const spacer1 = new QSpacerItem(1, 10, QSizePolicy::Expanding, QSizePolicy::Minimum);
60     QSpacerItem* const spacer2 = new QSpacerItem(1, 10, QSizePolicy::Expanding, QSizePolicy::Minimum);
61     QLabel* const policyLabel  = new QLabel(i18n("Update policy:"), optionsBox);
62 
63     QRadioButton* const policyRadio1  = new QRadioButton(i18n("Update metadata"), optionsBox);
64     policyRadio1->setWhatsThis(i18n("Update metadata of remote file and merge remote tags with local"));
65 
66     QRadioButton* const policyRadio3  = new QRadioButton(i18n("Skip photo"), optionsBox);
67     policyRadio3->setWhatsThis(i18n("Simple skip photo"));
68     QRadioButton* const policyRadio4  = new QRadioButton(i18n("Upload as new"), optionsBox);
69     policyRadio4->setWhatsThis(i18n("Add photo as new"));
70 
71     QLabel* const accessLabel = new QLabel(i18n("Privacy settings:"), optionsBox);
72     m_accessCombo             = new QComboBox(optionsBox);
73     m_accessCombo->addItem(QIcon::fromTheme(QString::fromLatin1("folder")),
74                            i18n("Public access"), YandexFotkiPhoto::ACCESS_PUBLIC);
75     m_accessCombo->addItem(QIcon::fromTheme(QString::fromLatin1("folder-red")),
76                            i18n("Friends access"), YandexFotkiPhoto::ACCESS_FRIENDS);
77     m_accessCombo->addItem(QIcon::fromTheme(QString::fromLatin1("folder-locked")),
78                            i18n("Private access"), YandexFotkiPhoto::ACCESS_PRIVATE);
79 
80     m_hideOriginalCheck    = new QCheckBox(i18n("Hide original photo"), optionsBox);
81     m_disableCommentsCheck = new QCheckBox(i18n("Disable comments"), optionsBox);
82     m_adultCheck           = new QCheckBox(i18n("Adult content"), optionsBox);
83 
84     m_policyGroup          = new QButtonGroup(optionsBox);
85     m_policyGroup->addButton(policyRadio1, POLICY_UPDATE_MERGE);
86     m_policyGroup->addButton(policyRadio3, POLICY_SKIP);
87     m_policyGroup->addButton(policyRadio4, POLICY_ADDNEW);
88 
89     optionsBoxLayout->addItem(spacer1,                  3, 0, 1, 5);
90     optionsBoxLayout->addWidget(accessLabel,            4, 0, 1, 5);
91     optionsBoxLayout->addWidget(m_accessCombo,          5, 1, 1, 4);
92     optionsBoxLayout->addWidget(m_adultCheck,           6, 1, 1, 4);
93     optionsBoxLayout->addWidget(m_hideOriginalCheck,    7, 1, 1, 4);
94     optionsBoxLayout->addWidget(m_disableCommentsCheck, 8, 1, 1, 4);
95     optionsBoxLayout->addItem(spacer2,                  9, 0, 1, 5);
96 
97     optionsBoxLayout->addWidget(policyLabel,            10, 0, 1, 5);
98     optionsBoxLayout->addWidget(policyRadio1,           11, 1, 1, 4);
99     optionsBoxLayout->addWidget(policyRadio3,           13, 1, 1, 4);
100     optionsBoxLayout->addWidget(policyRadio4,           14, 1, 1, 4);
101 
102     getUploadBox()->hide();
103     getSizeBox()->hide();
104 }
105 
~YandexFotkiWidget()106 YandexFotkiWidget::~YandexFotkiWidget()
107 {
108 }
109 
updateLabels(const QString &,const QString &)110 void YandexFotkiWidget::updateLabels(const QString& /*name*/, const QString& /*url*/)
111 {
112 }
113 
114 } // namespace KIPIYandexFotkiPlugin
115