File indexing completed on 2025-01-19 03:53:14

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2018-06-29
0007  * Description : a tool to export images to Twitter social network
0008  *
0009  * SPDX-FileCopyrightText: 2018 by Tarek Talaat <tarektalaat93 at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "twitterwidget.h"
0016 
0017 // Qt includes
0018 
0019 #include <QLabel>
0020 #include <QGroupBox>
0021 
0022 // Local includes
0023 
0024 namespace DigikamGenericTwitterPlugin
0025 {
0026 
0027 TwWidget::TwWidget(QWidget* const parent,
0028                    DInfoInterface* const iface,
0029                    const QString& toolName)
0030     : WSSettingsWidget(parent, iface, toolName)
0031 {
0032     getUploadBox()->hide();
0033     getSizeBox()->hide();
0034 
0035     /* (Feb 2019)
0036      * Temporarily hide album box because Twitter API has no functionality for albums
0037      */
0038     getAlbumBox()->hide();
0039 }
0040 
0041 TwWidget::~TwWidget()
0042 {
0043 }
0044 
0045 void TwWidget::updateLabels(const QString& name, const QString& url)
0046 {
0047     QString web(QLatin1String("https://www.twitter.com/"));
0048 
0049     if (!url.isEmpty())
0050     {
0051         web = url;
0052     }
0053 
0054     getHeaderLbl()->setText(QString::fromLatin1(
0055         "<b><h2><a href='%1'>"
0056         "<font color=\"#9ACD32\">Twitter</font>"
0057         "</a></h2></b>").arg(web));
0058 
0059     if (name.isEmpty())
0060     {
0061         getUserNameLabel()->clear();
0062     }
0063     else
0064     {
0065         getUserNameLabel()->setText(QString::fromLatin1("<b>%1</b>").arg(name));
0066     }
0067 }
0068 
0069 } // namespace DigikamGenericTwitterPlugin
0070 
0071 #include "moc_twitterwidget.cpp"