[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevelop/lib/plugins/vcs/cvs
From: Robert Gruber <rgruber () users ! sourceforge ! net>
Date: 2007-04-12 6:17:34
Message-ID: 1176358654.041279.22170.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 652872 by rgruber:
Implemented close button of tabwidget in CvsMainView
CvsJobs store the output as QString instead of QStringList
Added LogView that provides a nice view on the output of cvs log
M +2 -0 CMakeLists.txt
M +2 -1 cvs_part.cpp
M +1 -1 cvsgenericoutputview.cpp
M +4 -4 cvsjob.cpp
M +1 -1 cvsjob.h
M +30 -1 cvsmainview.cpp
M +10 -0 cvsmainview.h
M +1 -1 editorsview.cpp
A logview.cpp [License: GPL (v2+)]
A logview.h [License: GPL (v2+)]
A logview.ui
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/CMakeLists.txt #652871:652872
@@ -16,6 +16,7 @@
cvsproxy.cpp
diffoptionsdlg.cpp
editorsview.cpp
+ logview.cpp
commitdlg.cpp
updateoptionsdlg.cpp
)
@@ -25,6 +26,7 @@
cvsgenericoutputview.ui
diffoptionsdlg.ui
editorsview.ui
+ logview.ui
commitdlg.ui
updateoptionsdlg.ui
)
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvs_part.cpp #652871:652872
@@ -29,6 +29,7 @@
#include "cvsjob.h"
#include "diffoptionsdlg.h"
#include "editorsview.h"
+#include "logview.h"
#include "commitdlg.h"
#include "updateoptionsdlg.h"
#include "cvsgenericoutputview.h"
@@ -276,7 +277,7 @@
CvsJob* job = d->m_proxy->log( url );
if (job) {
job->start();
- CvsGenericOutputView* view = new CvsGenericOutputView(this, job);
+ LogView* view = new LogView(this, job);
emit addNewTabToMainView( view, i18n("Log") );
}
}
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsgenericoutputview.cpp #652871:652872
@@ -42,7 +42,7 @@
CvsJob * cvsjob = dynamic_cast<CvsJob*>(job);
if (cvsjob) {
appendText( cvsjob->cvsCommand() );
- appendText( cvsjob->output().join("\n") );
+ appendText( cvsjob->output() );
if (job->error() == 0) {
appendText( i18n("Job exited normally") );
} else {
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsjob.cpp #652871:652872
@@ -38,7 +38,7 @@
QString rsh;
QString directory;
bool isRunning;
- QStringList outputLines;
+ QString outputLines;
};
@@ -122,7 +122,7 @@
}
-QStringList CvsJob::output() const
+QString CvsJob::output() const
{
return d->outputLines;
}
@@ -188,7 +188,7 @@
QString output = QString::fromLocal8Bit(buffer, buflen);
// accumulate output
- d->outputLines += output.split("\n");
+ d->outputLines += output;
kDebug()<< k_funcinfo <<"received output: "<<endl;
kDebug()<<output<<endl;
}
@@ -201,7 +201,7 @@
QString output = QString::fromLocal8Bit(buffer, buflen);
// accumulate output
- d->outputLines += output.split("\n");
+ d->outputLines += output;
kDebug()<< k_funcinfo <<"received error: "<<endl;
kDebug()<<output<<endl;
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsjob.h #652871:652872
@@ -56,7 +56,7 @@
/**
* @return The whole output of the job
*/
- QStringList output() const;
+ QString output() const;
public slots:
void cancel();
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsmainview.cpp #652871:652872
@@ -35,6 +35,16 @@
// create a default output view
m_mainview = new CvsGenericOutputView(m_part);
tabwidget->addTab( m_mainview, i18n("CVS") );
+
+ // add a close button as corner widget
+ m_closeButton = new QToolButton(tabwidget);
+ m_closeButton->setIcon( KIcon( "tab-remove" ) );
+ m_closeButton->adjustSize();
+ m_closeButton->setAutoRaise(true);
+ m_closeButton->setEnabled(false);
+ tabwidget->setCornerWidget( m_closeButton );
+ connect(m_closeButton, SIGNAL( clicked() ),
+ this, SLOT( slotTabClose() ));
}
CvsMainView::~CvsMainView()
@@ -46,14 +56,33 @@
void CvsMainView::slotAddTab(QWidget * tab, QString label)
{
kDebug() << k_funcinfo << label << endl;
- tabwidget->addTab( tab, label );
+
+ int idx = tabwidget->addTab( tab, label );
+ tabwidget->setCurrentIndex(idx);
+
+ if (tabwidget->count() > 1)
+ m_closeButton->setEnabled(true);
}
void CvsMainView::slotJobFinished(KJob * job)
{
kDebug() << k_funcinfo <<endl;
m_mainview->slotJobFinished(job);
+ tabwidget->setCurrentIndex(0);
}
+void CvsMainView::slotTabClose()
+{
+ int idx = tabwidget->currentIndex();
+
+ // don't allow to close the first tab
+ if (idx != 0)
+ tabwidget->removeTab( idx );
+
+ // if only the first tab remains, disable the close button
+ if (tabwidget->count() <= 1)
+ m_closeButton->setEnabled(false);
+}
+
#include "cvsmainview.moc"
//kate: space-indent on; indent-width 4; replace-tabs on; auto-insert-doxygen on; indent-mode cstyle;
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/cvsmainview.h #652871:652872
@@ -14,6 +14,7 @@
#include <QWidget>
#include <KJob>
+#include <QToolButton>
#include "ui_cvsmainview.h"
@@ -25,9 +26,12 @@
* It only constists out of a KTabWidget.
*
* When created, a CvsGenericOutputView will be inserted.
+ *
* Inserting text into that default output view is possible via the
* slotJobFinished() slot.
*
+ * Additional tabs can be added via slotAddTab().
+ *
* @author Robert Gruber <rgruber@users.sourceforge.net>
*/
class CvsMainView : public QWidget, private Ui::CvsMainViewBase {
@@ -48,9 +52,15 @@
*/
void slotJobFinished(KJob* job);
+ /**
+ * Closes the current active tab (if it's not the first tab)
+ */
+ void slotTabClose();
+
private:
CvsPart* m_part;
CvsGenericOutputView* m_mainview;
+ QToolButton* m_closeButton;
};
#endif
--- trunk/KDE/kdevelop/lib/plugins/vcs/cvs/editorsview.cpp #652871:652872
@@ -67,7 +67,7 @@
"([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+(.*)");
QString lastfilename;
- QStringList lines = cvsjob->output();
+ QStringList lines = cvsjob->output().split("\n");
QMultiMap<QString,CvsLocker> lockedFiles;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic