File indexing completed on 2024-04-14 04:56:31

0001 /*
0002     This configuration page takes care of all settings concerning the
0003     user interface
0004 
0005     SPDX-FileCopyrightText: 2006-2022 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 // application specific includes
0010 #include "smb4kconfigpageuserinterface.h"
0011 #include "core/smb4ksettings.h"
0012 
0013 // Qt includes
0014 #include <QCheckBox>
0015 #include <QGridLayout>
0016 #include <QGroupBox>
0017 #include <QLabel>
0018 #include <QRadioButton>
0019 #include <QVBoxLayout>
0020 
0021 // KDE includes
0022 #include <KComboBox>
0023 #include <KLocalizedString>
0024 
0025 Smb4KConfigPageUserInterface::Smb4KConfigPageUserInterface(QWidget *parent)
0026     : QWidget(parent)
0027 {
0028     //
0029     // Layout
0030     //
0031     QVBoxLayout *layout = new QVBoxLayout(this);
0032 
0033     //
0034     // Main Window settings
0035     //
0036     QGroupBox *mainWindowBox = new QGroupBox(i18n("Main Window"), this);
0037     QGridLayout *mainWindowBoxLayout = new QGridLayout(mainWindowBox);
0038 
0039     QLabel *tabOrientationLabel = new QLabel(Smb4KSettings::self()->mainWindowTabOrientationItem()->label(), mainWindowBox);
0040 
0041     KComboBox *tabOrientation = new KComboBox(mainWindowBox);
0042     tabOrientation->setObjectName(QStringLiteral("kcfg_MainWindowTabOrientation"));
0043 
0044     QList<KCoreConfigSkeleton::ItemEnum::Choice> tabOrientationChoices = Smb4KSettings::self()->mainWindowTabOrientationItem()->choices();
0045 
0046     for (const KCoreConfigSkeleton::ItemEnum::Choice &to : qAsConst(tabOrientationChoices)) {
0047         tabOrientation->addItem(to.label);
0048     }
0049 
0050     mainWindowBoxLayout->addWidget(tabOrientationLabel, 0, 0);
0051     mainWindowBoxLayout->addWidget(tabOrientation, 0, 1);
0052 
0053     QCheckBox *showBookmarkLabel = new QCheckBox(Smb4KSettings::self()->showCustomBookmarkLabelItem()->label(), this);
0054     showBookmarkLabel->setObjectName(QStringLiteral("kcfg_ShowCustomBookmarkLabel"));
0055 
0056     mainWindowBoxLayout->addWidget(showBookmarkLabel, 1, 0, 1, 2);
0057 
0058     layout->addWidget(mainWindowBox);
0059 
0060     //
0061     // Network Neighborhood settings
0062     //
0063     QGroupBox *networkNeighborhoodBox = new QGroupBox(i18n("Network Neighborhood"), this);
0064     QGridLayout *networkNeighborhoodBoxLayout = new QGridLayout(networkNeighborhoodBox);
0065 
0066     QLabel *iconSizeNetworkNeighborhoodLabel = new QLabel(Smb4KSettings::self()->networkBrowserIconSizeItem()->label(), networkNeighborhoodBox);
0067     QSlider *iconSizeNetworkNeighborhood = new QSlider(Qt::Horizontal, networkNeighborhoodBox);
0068     iconSizeNetworkNeighborhood->setObjectName(QStringLiteral("kcfg_NetworkBrowserIconSize"));
0069     iconSizeNetworkNeighborhood->setPageStep(16);
0070     iconSizeNetworkNeighborhood->setSingleStep(16);
0071     iconSizeNetworkNeighborhood->setTickPosition(QSlider::TicksBelow);
0072 
0073     networkNeighborhoodBoxLayout->addWidget(iconSizeNetworkNeighborhoodLabel, 0, 0);
0074     networkNeighborhoodBoxLayout->addWidget(iconSizeNetworkNeighborhood, 0, 1);
0075 
0076     QCheckBox *autoExpand = new QCheckBox(Smb4KSettings::self()->autoExpandNetworkItemsItem()->label(), networkNeighborhoodBox);
0077     autoExpand->setObjectName(QStringLiteral("kcfg_AutoExpandNetworkItems"));
0078 
0079     networkNeighborhoodBoxLayout->addWidget(autoExpand, 1, 0);
0080 
0081     QCheckBox *showType = new QCheckBox(Smb4KSettings::self()->showTypeItem()->label(), networkNeighborhoodBox);
0082     showType->setObjectName(QStringLiteral("kcfg_ShowType"));
0083 
0084     networkNeighborhoodBoxLayout->addWidget(showType, 1, 1);
0085 
0086     QCheckBox *showIpAddress = new QCheckBox(Smb4KSettings::self()->showIPAddressItem()->label(), networkNeighborhoodBox);
0087     showIpAddress->setObjectName(QStringLiteral("kcfg_ShowIPAddress"));
0088 
0089     networkNeighborhoodBoxLayout->addWidget(showIpAddress, 2, 0);
0090 
0091     QCheckBox *showComment = new QCheckBox(Smb4KSettings::self()->showCommentItem()->label(), networkNeighborhoodBox);
0092     showComment->setObjectName(QStringLiteral("kcfg_ShowComment"));
0093 
0094     networkNeighborhoodBoxLayout->addWidget(showComment, 2, 1);
0095 
0096     QCheckBox *showNetworkTooltip = new QCheckBox(Smb4KSettings::self()->showNetworkItemToolTipItem()->label(), networkNeighborhoodBox);
0097     showNetworkTooltip->setObjectName(QStringLiteral("kcfg_ShowNetworkItemToolTip"));
0098 
0099     networkNeighborhoodBoxLayout->addWidget(showNetworkTooltip, 3, 0);
0100 
0101     layout->addWidget(networkNeighborhoodBox);
0102 
0103     //
0104     // Shares View settings
0105     //
0106     QGroupBox *sharesViewBox = new QGroupBox(i18n("Shares View"), this);
0107     QGridLayout *sharesViewBoxLayout = new QGridLayout(sharesViewBox);
0108 
0109     QLabel *viewModeLabel = new QLabel(Smb4KSettings::self()->sharesViewModeItem()->label(), sharesViewBox);
0110 
0111     KComboBox *viewMode = new KComboBox(sharesViewBox);
0112     viewMode->setObjectName(QStringLiteral("kcfg_SharesViewMode"));
0113 
0114     QList<KCoreConfigSkeleton::ItemEnum::Choice> sharesViewModeChoices = Smb4KSettings::self()->sharesViewModeItem()->choices();
0115 
0116     for (const KCoreConfigSkeleton::ItemEnum::Choice &vm : qAsConst(sharesViewModeChoices)) {
0117         viewMode->addItem(vm.label);
0118     }
0119 
0120     sharesViewBoxLayout->addWidget(viewModeLabel, 0, 0);
0121     sharesViewBoxLayout->addWidget(viewMode, 0, 1);
0122 
0123     QLabel *iconSizeSharesViewIconViewLabel = new QLabel(Smb4KSettings::self()->sharesViewIconSizeIconViewItem()->label(), sharesViewBox);
0124     QSlider *iconSizeSharesViewIconView = new QSlider(Qt::Horizontal, sharesViewBox);
0125     iconSizeSharesViewIconView->setObjectName(QStringLiteral("kcfg_SharesViewIconSizeIconView"));
0126     iconSizeSharesViewIconView->setPageStep(16);
0127     iconSizeSharesViewIconView->setSingleStep(16);
0128     iconSizeSharesViewIconView->setTickPosition(QSlider::TicksBelow);
0129 
0130     sharesViewBoxLayout->addWidget(iconSizeSharesViewIconViewLabel, 1, 0);
0131     sharesViewBoxLayout->addWidget(iconSizeSharesViewIconView, 1, 1);
0132 
0133     QLabel *iconSizeSharesViewListViewLabel = new QLabel(Smb4KSettings::self()->sharesViewIconSizeListViewItem()->label(), sharesViewBox);
0134     QSlider *iconSizeSharesViewListView = new QSlider(Qt::Horizontal, sharesViewBox);
0135     iconSizeSharesViewListView->setObjectName(QStringLiteral("kcfg_SharesViewIconSizeListView"));
0136     iconSizeSharesViewListView->setPageStep(16);
0137     iconSizeSharesViewListView->setSingleStep(16);
0138     iconSizeSharesViewListView->setTickPosition(QSlider::TicksBelow);
0139 
0140     sharesViewBoxLayout->addWidget(iconSizeSharesViewListViewLabel, 2, 0);
0141     sharesViewBoxLayout->addWidget(iconSizeSharesViewListView, 2, 1);
0142 
0143     QCheckBox *showShareTooltip = new QCheckBox(Smb4KSettings::self()->showShareToolTipItem()->label(), sharesViewBox);
0144     showShareTooltip->setObjectName(QStringLiteral("kcfg_ShowShareToolTip"));
0145 
0146     sharesViewBoxLayout->addWidget(showShareTooltip, 3, 0, 1, 2);
0147 
0148     layout->addWidget(sharesViewBox);
0149     layout->addStretch(100);
0150 }
0151 
0152 Smb4KConfigPageUserInterface::~Smb4KConfigPageUserInterface()
0153 {
0154 }
0155 
0156 /////////////////////////////////////////////////////////////////////////////
0157 // SLOT IMPLEMENTATIONS
0158 /////////////////////////////////////////////////////////////////////////////