File indexing completed on 2024-05-12 05:44:26
0001 /*************************************************************************** 0002 * Copyright (C) 2006-2009 by Rajko Albrecht * 0003 * ral@alwins-world.de * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 #include "revtreewidget.h" 0021 #include "revgraphview.h" 0022 #include "settings/kdesvnsettings.h" 0023 0024 #include <QTextBrowser> 0025 0026 #include <QList> 0027 #include <QSplitter> 0028 #include <QVariant> 0029 0030 #include <QLayout> 0031 #include <QSizePolicy> 0032 #include <QToolTip> 0033 #include <QWhatsThis> 0034 0035 /* 0036 * Constructs a RevTreeWidget as a child of 'parent', with the 0037 * name 'name' and widget flags set to 'f'. 0038 */ 0039 RevTreeWidget::RevTreeWidget(const svn::ClientP &cl, QWidget *parent) 0040 : QWidget(parent) 0041 { 0042 RevTreeWidgetLayout = new QVBoxLayout(this); //, 11, 6, "RevTreeWidgetLayout"); 0043 0044 m_Splitter = new QSplitter(Qt::Vertical, this); 0045 0046 m_RevGraphView = new RevGraphView(cl, m_Splitter); 0047 m_RevGraphView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 0048 0049 connect(m_RevGraphView, &RevGraphView::dispDetails, this, &RevTreeWidget::setDetailText); 0050 connect(m_RevGraphView, &RevGraphView::makeNorecDiff, this, &RevTreeWidget::makeNorecDiff); 0051 connect(m_RevGraphView, &RevGraphView::makeRecDiff, this, &RevTreeWidget::makeRecDiff); 0052 connect(m_RevGraphView, 0053 SIGNAL(makeCat(svn::Revision, QString, QString, svn::Revision, QWidget *)), 0054 this, 0055 SIGNAL(makeCat(svn::Revision, QString, QString, svn::Revision, QWidget *))); 0056 0057 m_Detailstext = new QTextBrowser(m_Splitter); 0058 m_Detailstext->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 0059 // m_Detailstext->setResizePolicy( QTextBrowser::Manual ); 0060 RevTreeWidgetLayout->addWidget(m_Splitter); 0061 resize(QSize(600, 480).expandedTo(minimumSizeHint())); 0062 QList<int> list = Kdesvnsettings::tree_detail_height(); 0063 if (list.count() == 2 && (list[0] > 0 || list[1] > 0)) { 0064 m_Splitter->setSizes(list); 0065 } 0066 } 0067 0068 /* 0069 * Destroys the object and frees any allocated resources 0070 */ 0071 RevTreeWidget::~RevTreeWidget() 0072 { 0073 // no need to delete child widgets, Qt does it all for us 0074 QList<int> list = m_Splitter->sizes(); 0075 if (list.count() == 2) { 0076 Kdesvnsettings::setTree_detail_height(list); 0077 Kdesvnsettings::self()->save(); 0078 } 0079 } 0080 0081 void RevTreeWidget::setBasePath(const QString &_p) 0082 { 0083 m_RevGraphView->setBasePath(_p); 0084 } 0085 0086 void RevTreeWidget::dumpRevtree() 0087 { 0088 m_RevGraphView->dumpRevtree(); 0089 } 0090 0091 void RevTreeWidget::setDetailText(const QString &_s) 0092 { 0093 m_Detailstext->setText(_s); 0094 QList<int> list = m_Splitter->sizes(); 0095 if (list.count() != 2) { 0096 return; 0097 } 0098 if (list[1] == 0) { 0099 int h = height(); 0100 int th = h / 10; 0101 list[0] = h - th; 0102 list[1] = th; 0103 m_Splitter->setSizes(list); 0104 } 0105 } 0106 0107 #include "moc_revtreewidget.cpp"