File indexing completed on 2025-01-19 03:50:48
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2013-03-02 0007 * Description : Table view: Column configuration dialog 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2013 by Michael G. Hansen <mike at mghansen dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "tableview_column_configuration_dialog.h" 0017 0018 // Qt includes 0019 0020 #include <QDialogButtonBox> 0021 #include <QVBoxLayout> 0022 #include <QPushButton> 0023 0024 // KDE includes 0025 0026 #include <klocalizedstring.h> 0027 0028 // Local includes 0029 0030 #include "tableview_model.h" 0031 #include "tableview_selection_model_syncer.h" 0032 #include "thumbnailloadthread.h" 0033 #include "digikam_debug.h" 0034 0035 namespace Digikam 0036 { 0037 0038 class ItemAlbumModel; 0039 class ItemFilterModel; 0040 0041 class Q_DECL_HIDDEN TableViewConfigurationDialog::Private 0042 { 0043 public: 0044 0045 explicit Private() 0046 : columnIndex (0), 0047 buttons (nullptr), 0048 columnObject (nullptr), 0049 columnConfigurationWidget(nullptr) 0050 { 0051 } 0052 0053 int columnIndex; 0054 0055 QDialogButtonBox* buttons; 0056 0057 TableViewColumn* columnObject; 0058 TableViewColumnConfigurationWidget* columnConfigurationWidget; 0059 }; 0060 0061 TableViewConfigurationDialog::TableViewConfigurationDialog(TableViewShared* const sharedObject, 0062 const int columnIndex, 0063 QWidget* const parentWidget) 0064 : QDialog(parentWidget), 0065 d (new Private()), 0066 s (sharedObject) 0067 { 0068 d->columnIndex = columnIndex; 0069 d->columnObject = s->tableViewModel->getColumnObject(d->columnIndex); 0070 d->columnConfigurationWidget = d->columnObject->getConfigurationWidget(this); 0071 0072 if (d->columnObject) 0073 { 0074 setWindowTitle(i18n("Configure column \"%1\"", d->columnObject->getTitle())); 0075 } 0076 else 0077 { 0078 qCWarning(DIGIKAM_GENERAL_LOG) << "Column object from TableView is null"; 0079 } 0080 0081 d->buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); 0082 d->buttons->button(QDialogButtonBox::Ok)->setDefault(true); 0083 0084 QVBoxLayout* const vbx = new QVBoxLayout(this); 0085 vbx->addWidget(d->columnConfigurationWidget); 0086 vbx->addWidget(d->buttons); 0087 setLayout(vbx); 0088 0089 connect(d->buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), 0090 this, SLOT(accept())); 0091 0092 connect(d->buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), 0093 this, SLOT(reject())); 0094 } 0095 0096 TableViewConfigurationDialog::~TableViewConfigurationDialog() 0097 { 0098 } 0099 0100 TableViewColumnConfiguration TableViewConfigurationDialog::getNewConfiguration() const 0101 { 0102 if (d->columnConfigurationWidget) 0103 { 0104 return d->columnConfigurationWidget->getNewConfiguration(); 0105 } 0106 else 0107 { 0108 qCWarning(DIGIKAM_GENERAL_LOG) << "Configuration widget from TableView is null"; 0109 0110 return TableViewColumnConfiguration(); 0111 } 0112 } 0113 0114 } // namespace Digikam 0115 0116 #include "moc_tableview_column_configuration_dialog.cpp"