Browse Source

fixes #375:

- désactiver la recherche des erreurs en cours de saisie, mais l'activer à l'enregistrement et/ou à la demande : '''Non réalisé. Il est possible d'augmenter le temps de frappe pour que le rafraichissement soit plus lent'''
 - pouvoir figer la zone du journal des erreurs : '''Fait à partir d'une option dans l'onglet "Editeur"'''
 - décaller le texte de l'éditeur en même temps que le journal s'ouvre : '''Fait'''
master
Ulrich Van Den Hekke 12 years ago
parent
commit
373a976c52
  1. 2
      ext/qcodeedit/lib/qeditor.cpp
  2. 8
      framework/core/appsettings.cpp
  3. 1
      framework/core/appsettings.h
  4. 1
      framework/core/config.xml
  5. 6
      xinx/customdialog/customeditorimpl.cpp
  6. 16
      xinx/customdialog/ui/customeditor.ui
  7. 124
      xinx/errordockimpl.cpp
  8. 53
      xinx/errordockimpl.h
  9. 226
      xinx/logdialogimpl.cpp
  10. 47
      xinx/mainformimpl.cpp
  11. 8
      xinx/mainformimpl.h
  12. 87
      xinx/rcslogdockimpl.cpp
  13. 53
      xinx/rcslogdockimpl.h
  14. 146
      xinx/searchdockimpl.cpp
  15. 24
      xinx/searchdockimpl.h
  16. 33
      xinx/ui/errordock.ui
  17. 101
      xinx/ui/logform.ui
  18. 35
      xinx/ui/rcsdock.ui
  19. 53
      xinx/ui/searchdock.ui
  20. 18
      xinx/xinx.pro

2
ext/qcodeedit/lib/qeditor.cpp

@ -3304,7 +3304,7 @@ void QEditor::resizeEvent(QResizeEvent *)
//qDebug("page step : %i", viewportSize.height() / ls);
//if ( isCursorVisible() && flag(LineWrap) )
// ensureCursorVisible();
ensureCursorVisible();
}
/*!

8
framework/core/appsettings.cpp

@ -203,6 +203,7 @@ AppSettings::struct_editor AppSettings::getDefaultEditor()
value.closeButtonOnEachTab = false;
value.automaticModelRefreshTimeout = 1000;
value.wrapLine = false;
value.closeErrorDockAutomatically = true;
return value;
}
@ -226,6 +227,7 @@ AppSettings::struct_editor AppSettings::getSettingsEditor(AppSettingsSettings *
value.closeButtonOnEachTab = settings->value("Close Button on each Tab", defaultValue.closeButtonOnEachTab).toBool();
value.automaticModelRefreshTimeout = settings->value("Automatic Model Refresh Timeout", defaultValue.automaticModelRefreshTimeout).toInt();
value.wrapLine = settings->value ("Wrap Line", defaultValue.wrapLine).toBool();
value.closeErrorDockAutomatically = settings->value( "Close Error Dock Automatically", defaultValue.closeErrorDockAutomatically ).toBool();
settings->endGroup();
return value;
@ -237,7 +239,7 @@ void AppSettings::setSettingsEditor(AppSettingsSettings * settings, const QStrin
settings->beginGroup(path);
settings->setValue("Default Text Codec", value.defaultTextCodec, defaultValue.defaultTextCodec);
settings->setValue( "Autoindent On Saving", value.autoindentOnSaving, defaultValue.autoindentOnSaving );
settings->setValue("Autoindent On Saving", value.autoindentOnSaving, defaultValue.autoindentOnSaving );
settings->setValue("Popup When File Modified", value.popupWhenFileModified, defaultValue.popupWhenFileModified);
settings->setValue("Create Backup File", value.createBackupFile, defaultValue.createBackupFile);
settings->setValue("Tabulation Size", value.tabulationSize, defaultValue.tabulationSize);
@ -248,7 +250,9 @@ void AppSettings::setSettingsEditor(AppSettingsSettings * settings, const QStrin
settings->setValue("Auto Highlight", value.autoHighlight, defaultValue.autoHighlight);
settings->setValue("Hide Close Tab", value.hideCloseTab, defaultValue.hideCloseTab);
settings->setValue("Close Button on each Tab", value.closeButtonOnEachTab, defaultValue.closeButtonOnEachTab);
settings->setValue ("Wrap Line", value.wrapLine, defaultValue.wrapLine);
settings->setValue("Automatic Model Refresh Timeout", value.automaticModelRefreshTimeout, defaultValue.automaticModelRefreshTimeout );
settings->setValue("Wrap Line", value.wrapLine, defaultValue.wrapLine);
settings->setValue("Close Error Dock Automatically", value.closeErrorDockAutomatically, defaultValue.closeErrorDockAutomatically );
settings->endGroup();
}

1
framework/core/appsettings.h

@ -67,6 +67,7 @@ public:
bool closeButtonOnEachTab;
int automaticModelRefreshTimeout;
bool wrapLine;
bool closeErrorDockAutomatically;
};
struct struct_rcs

1
framework/core/config.xml

@ -30,6 +30,7 @@
<value name="Close Button on each Tab" type="bool" default="false"/>
<value name="Automatic Model Refresh Timeout" type="int" default="1000"/>
<value name="Wrap Line" type="bool" default="false"/>
<value name="Close Error Dock Automatically" type="bool" default="true"/>
</type>
<type name="QFormat">
<value name="italic" type="bool" default="false"/>

6
xinx/customdialog/customeditorimpl.cpp

@ -95,6 +95,9 @@ bool CustomEditorImpl::loadSettingsDialog()
// Wrap Line
m_wrapLineChk->setChecked(XINXConfig::self()->config().editor.wrapLine);
// Autoclose error dock
m_autoCloseError->setChecked(XINXConfig::self()->config().editor.closeErrorDockAutomatically);
return true;
}
@ -146,6 +149,9 @@ bool CustomEditorImpl::saveSettingsDialog()
// Wrap Line
XINXConfig::self()->config().editor.wrapLine = m_wrapLineChk->isChecked();
// Autoclose error dock
XINXConfig::self()->config().editor.closeErrorDockAutomatically = m_autoCloseError->isChecked();
return true;
}

16
xinx/customdialog/ui/customeditor.ui

@ -211,6 +211,22 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Editin&amp;g options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="m_autoCloseError">
<property name="text">
<string>Automatically close error dock</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>

124
xinx/errordockimpl.cpp

@ -0,0 +1,124 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
// Xinx header
#include "errordockimpl.h"
#include <core/exceptions.h>
#include <plugins/xinxpluginsloader.h>
#include <core/xinxconfig.h>
// Qt header
#include <QFileInfo>
#include <QItemDelegate>
#include <QPainter>
/* ErrorDockWidgetImpl */
ErrorDockWidgetImpl::ErrorDockWidgetImpl(QWidget * parent) : QWidget(parent), m_dock(0)
{
setWindowTitle(tr("Warnings/Errors"));
setWindowIcon(QIcon(":/images/warning.png"));
_widget = new Ui::ErrorDockWidget();
_widget->setupUi(this);
connect(_widget->m_messagesWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClicked(QModelIndex)));
}
ErrorDockWidgetImpl::~ErrorDockWidgetImpl()
{
}
void ErrorDockWidgetImpl::updateErrors()
{
_widget->m_messagesWidget->clear();
QMap<QString, QList<ErrorManager::Error> > errors = ErrorManager::self()->errors();
foreach(QString context, errors.keys())
{
QTreeWidgetItem * fileItem = new QTreeWidgetItem(_widget->m_messagesWidget);
fileItem->setText(0, context);
QList<IFileTypePlugin *> fileTypes = XinxPluginsLoader::self()->matchedFileType(context);
if (fileTypes.size())
{
fileItem->setIcon(0, QIcon(fileTypes.at(0)->icon()));
}
foreach(ErrorManager::Error err, errors.value(context))
{
QString message = err.message;
foreach(QString arg, err.parameters)
{
message = message.arg(arg);
}
QTreeWidgetItem * msgItem = new QTreeWidgetItem(fileItem);
if (err.line > 0)
msgItem->setText(0, tr("%1: %2").arg(err.line, 4, 10, QChar('0')).arg(message));
else
msgItem->setText(0, tr("%1").arg(message));
msgItem->setData(0, Qt::UserRole, context);
msgItem->setData(0, Qt::UserRole + 1, err.line);
switch (err.type)
{
case ErrorManager::MessageError:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxCritical));
break;
case ErrorManager::MessageWarning:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxWarning));
break;
case ErrorManager::MessageInformation:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxInformation));
break;
}
}
_widget->m_messagesWidget->expandItem(fileItem);
}
if (m_dock)
{
if (_widget->m_messagesWidget->invisibleRootItem()->childCount())
{
m_dock->setVisible(true);
}
else
{
if (XINXConfig::self()->config().editor.closeErrorDockAutomatically)
m_dock->setVisible(false);
}
}
}
void ErrorDockWidgetImpl::doubleClicked(const QModelIndex & index)
{
QString filename = index.data(Qt::UserRole).toString();
int line = index.data(Qt::UserRole + 1).toInt();
if (!filename.isEmpty())
{
emit open(filename, line);
}
}
void ErrorDockWidgetImpl::setDock(QDockWidget * dock)
{
m_dock = dock;
}

53
xinx/errordockimpl.h

@ -0,0 +1,53 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
#ifndef ERRORDOCKWIDGETIMPL_H
#define ERRORDOCKWIDGETIMPL_H
#pragma once
// Xinx header
#include "ui_errordock.h"
// Qt header
#include <QDockWidget>
class ErrorDockWidgetImpl: public QWidget
{
Q_OBJECT
public:
ErrorDockWidgetImpl(QWidget * parent = 0);
virtual ~ErrorDockWidgetImpl();
void setDock(QDockWidget * dock);
public slots:
void updateErrors();
signals:
void open(const QString & filename, int line);
protected slots:
void doubleClicked(const QModelIndex & index);;
private:
Ui::ErrorDockWidget * _widget;
QDockWidget * m_dock;
};
#endif /* ERRORDOCKWIDGETIMPL_H */

226
xinx/logdialogimpl.cpp

@ -1,226 +0,0 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
// Xinx header
#include "logdialogimpl.h"
#include <core/exceptions.h>
#include <plugins/xinxpluginsloader.h>
// Qt header
#include <QFileInfo>
#include <QItemDelegate>
#include <QPainter>
/* SearchLogWidget */
class SearchLogWidget : public QTreeWidget
{
public:
friend class LogDockWidget;
};
/* SearchLogWidgetDelegate */
class SearchLogWidgetDelegate : public QItemDelegate
{
public:
SearchLogWidgetDelegate(QObject * parent = 0);
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
private:
};
SearchLogWidgetDelegate::SearchLogWidgetDelegate(QObject * parent) : QItemDelegate(parent)
{
}
void SearchLogWidgetDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QString text = index.data().toString();
QStyleOptionViewItem myOpt = option;
if (index.column() == 0) // Filename
{
drawBackground(painter, option, index);
QRectF boundingRect;
painter->setPen(Qt::magenta);
painter->drawText(myOpt.rect, Qt::AlignLeft, text.left(text.indexOf(':')), &boundingRect);
myOpt.rect.setLeft((int)(myOpt.rect.left() + boundingRect.width()));
painter->setPen(Qt::black);
painter->drawText(myOpt.rect, Qt::AlignLeft, ":", &boundingRect);
myOpt.rect.setLeft((int)(myOpt.rect.left() + boundingRect.width()));
painter->setPen(Qt::blue);
painter->drawText(myOpt.rect, Qt::AlignLeft, text.mid(text.indexOf(':') + 1), &boundingRect);
drawFocus(painter, option, option.rect);
return;
}
QItemDelegate::paint(painter, option, index);
}
/* LogDockWidget */
LogDockWidget::LogDockWidget(QWidget * parent) : QWidget(parent), m_dock(0)
{
setWindowTitle(tr("Logs"));
setWindowIcon(QIcon(":/images/ecmascript.png"));
m_logwidget = new Ui::LogWidget();
m_logwidget->setupUi(this);
connect(m_logwidget->m_searchTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClicked(QModelIndex)));
connect(m_logwidget->m_messagesWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClicked(QModelIndex)));
m_logwidget->m_searchTreeWidget->setItemDelegate(new SearchLogWidgetDelegate);
m_logwidget->m_progressBar->hide();
}
LogDockWidget::~LogDockWidget()
{
}
void LogDockWidget::init()
{
m_logwidget->m_rcsLogListWidget->clear();
m_logwidget->m_searchTreeWidget->clear();
m_logwidget->m_progressBar->show();
}
void LogDockWidget::end()
{
m_logwidget->m_progressBar->hide();
}
void LogDockWidget::log(RCS::rcsLog niveau, const QString & info)
{
QListWidgetItem * item = new QListWidgetItem(info, m_logwidget->m_rcsLogListWidget);
switch (niveau)
{
case RCS::LogError :
case RCS::LogConflict :
item->setForeground(Qt::red);
break;
case RCS::LogLocallyModified :
item->setForeground(Qt::darkYellow);
break;
case RCS::LogRemotlyModified :
item->setForeground(Qt::darkGreen);
break;
case RCS::LogApplication :
item->setForeground(Qt::lightGray);
break;
case RCS::LogNotManaged :
case RCS::LogNormal :
default:
;
}
m_logwidget->m_rcsLogListWidget->scrollToItem(item);
m_logwidget->m_tabWidget->setCurrentWidget(m_logwidget->m_rcsLogTab);
}
void LogDockWidget::find(const QString & filename, const QString & text, int line)
{
QString emplacement = QFileInfo(filename).fileName() + ":" + QString::number(line);
QTreeWidgetItem * item = new QTreeWidgetItem(QStringList() << emplacement << text);
item->setData(0, Qt::UserRole, filename);
item->setData(0, Qt::UserRole + 1, line);
item->setData(1, Qt::UserRole, filename);
item->setData(1, Qt::UserRole + 1, line);
m_logwidget->m_searchTreeWidget->addTopLevelItem(item);
m_logwidget->m_searchTreeWidget->scrollToItem(item);
m_logwidget->m_tabWidget->setCurrentWidget(m_logwidget->m_searchTab);
}
void LogDockWidget::updateErrors()
{
m_logwidget->m_messagesWidget->clear();
QMap<QString, QList<ErrorManager::Error> > errors = ErrorManager::self()->errors();
foreach(QString context, errors.keys())
{
QTreeWidgetItem * fileItem = new QTreeWidgetItem(m_logwidget->m_messagesWidget);
fileItem->setText(0, context);
QList<IFileTypePlugin *> fileTypes = XinxPluginsLoader::self()->matchedFileType(context);
if (fileTypes.size())
{
fileItem->setIcon(0, QIcon(fileTypes.at(0)->icon()));
}
foreach(ErrorManager::Error err, errors.value(context))
{
QString message = err.message;
foreach(QString arg, err.parameters)
{
message = message.arg(arg);
}
QTreeWidgetItem * msgItem = new QTreeWidgetItem(fileItem);
if (err.line > 0)
msgItem->setText(0, tr("%1: %2").arg(err.line, 4, 10, QChar('0')).arg(message));
else
msgItem->setText(0, tr("%1").arg(message));
msgItem->setData(0, Qt::UserRole, context);
msgItem->setData(0, Qt::UserRole + 1, err.line);
switch (err.type)
{
case ErrorManager::MessageError:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxCritical));
break;
case ErrorManager::MessageWarning:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxWarning));
break;
case ErrorManager::MessageInformation:
msgItem->setIcon(0, style()->standardIcon(QStyle::SP_MessageBoxInformation));
break;
}
}
m_logwidget->m_messagesWidget->expandItem(fileItem);
}
if (m_logwidget->m_messagesWidget->invisibleRootItem()->childCount())
{
m_logwidget->m_tabWidget->setCurrentWidget(m_logwidget->m_messageTab);
if (m_dock) m_dock->setVisible(true);
}
else
{
if (m_dock) m_dock->setVisible(false);
}
}
void LogDockWidget::doubleClicked(const QModelIndex & index)
{
QString filename = index.data(Qt::UserRole).toString();
int line = index.data(Qt::UserRole + 1).toInt();
if (!filename.isEmpty())
{
emit open(filename, line);
}
}
void LogDockWidget::setDock(QDockWidget * dock)
{
m_dock = dock;
}

47
xinx/mainformimpl.cpp

@ -22,7 +22,9 @@
#include "filecontentdockwidget.h"
#include "projectdirectorydockwidget.h"
#include "replacedialogimpl.h"
#include "logdialogimpl.h"
#include "errordockimpl.h"
#include "rcslogdockimpl.h"
#include "searchdockimpl.h"
#include "snipetdockwidget.h"
#include "aboutdialogimpl.h"
#include "customdialog/customdialogimpl.h"
@ -826,14 +828,29 @@ void MainformImpl::createDockWidget()
m_menus["windows"]->addAction(action);
m_logDock = new LogDockWidget(this);
connect(m_logDock, SIGNAL(open(QString,int)), this, SLOT(openFile(QString,int)));
connect(ErrorManager::self(), SIGNAL(changed()), m_logDock, SLOT(updateErrors()));
m_logDockView = addToolView(m_logDock, Qt::BottomDockWidgetArea);
m_logDockView->setObjectName(QString::fromUtf8("m_logDock"));
m_errorDock = new ErrorDockWidgetImpl(this);
connect(m_errorDock, SIGNAL(open(QString,int)), this, SLOT(openFile(QString,int)));
connect(ErrorManager::self(), SIGNAL(changed()), m_errorDock, SLOT(updateErrors()));
view = addToolView(m_errorDock, Qt::BottomDockWidgetArea);
view->setObjectName(QString::fromUtf8("m_errorDock"));
action = view->toggleViewAction();
m_menus["windows"]->addAction(action);
m_logDock->setDock(m_logDockView);
m_errorDock->setDock(view);
m_rcsLogDock = new RCSLogDockWidgetImpl(this);
m_logDockView = addToolView(m_rcsLogDock, Qt::BottomDockWidgetArea);
m_logDockView->setObjectName(QString::fromUtf8("m_rcsLogDock"));
action = m_logDockView->toggleViewAction();
m_menus["windows"]->addAction(action);
m_rcsLogDock->setDock(m_logDockView);
m_searchDock = new SearchDockWidgetImpl(this);
connect(m_searchDock, SIGNAL(open(QString,int)), this, SLOT(openFile(QString,int)));
view = addToolView(m_searchDock, Qt::BottomDockWidgetArea);
view->setObjectName(QString::fromUtf8("m_searchDock"));
action = view->toggleViewAction();
m_menus["windows"]->addAction(action);
m_searchDock->setDock(view);
// Load dock from plugins and assign automatic shortcut
int dockShortcut = 4;
@ -904,7 +921,7 @@ void MainformImpl::createRCS()
{
connect(RCSManager::self(), SIGNAL(operationStarted()), this, SLOT(logStart()));
connect(RCSManager::self(), SIGNAL(operationTerminated()), this, SLOT(rcsLogTerminated()));
connect(RCSManager::self(), SIGNAL(log(RCS::rcsLog,QString)), m_logDock, SLOT(log(RCS::rcsLog,QString)));
connect(RCSManager::self(), SIGNAL(log(RCS::rcsLog,QString)), m_rcsLogDock, SLOT(log(RCS::rcsLog,QString)));
}
void MainformImpl::callSnipetAction(int snipetId)
@ -1465,8 +1482,8 @@ void MainformImpl::printFile()
void MainformImpl::logStart()
{
m_logDock->init();
m_rcsVisible = m_logDock->isVisible();
m_rcsLogDock->init();
m_rcsVisible = m_rcsLogDock->isVisible();
m_logDockView->show();
}
@ -1478,7 +1495,7 @@ void MainformImpl::logTimeout()
void MainformImpl::rcsLogTerminated()
{
m_logDock->end();
m_rcsLogDock->end();
if ((!m_rcsVisible) && m_logDockView->isVisible() && XINXConfig::self()->config().project.closeVersionManagementLog)
m_timer->start(5000);
}
@ -1565,11 +1582,11 @@ void MainformImpl::findInFiles(const QString & directory, const QString & from,
m_searchNextAct->setEnabled(false);
m_searchPreviousAct->setEnabled(false);
m_replaceAct->setEnabled(false);
m_logDock->init();
m_logDockView->setVisible(true);
m_searchDock->init();
m_searchDock->dock()->setVisible(true);
SearchFileThread * threadSearch = new SearchFileThread();
connect(threadSearch, SIGNAL(find(QString,QString,int)), m_logDock, SLOT(find(QString,QString,int)), Qt::BlockingQueuedConnection);
connect(threadSearch, SIGNAL(find(QString,QString,int)), m_searchDock, SLOT(find(QString,QString,int)), Qt::BlockingQueuedConnection);
connect(threadSearch, SIGNAL(end()), this, SLOT(findEnd()));
threadSearch->setPath(directory);
@ -1584,7 +1601,7 @@ void MainformImpl::findEnd()
m_searchPreviousAct->setEnabled(true);
m_replaceAct->setEnabled(true);
m_logDock->end();
m_searchDock->end();
QMessageBox::information(this, tr("Search End"), tr("All string are finded"));
}

8
xinx/mainformimpl.h

@ -41,7 +41,9 @@
class FileContentDockWidget;
class ProjectDirectoryDockWidget;
class LogDockWidget;
class ErrorDockWidgetImpl;
class SearchDockWidgetImpl;
class RCSLogDockWidgetImpl;
class XmlPresentationDockWidget;
class SnipetDockWidget;
class ReplaceDialogImpl;
@ -118,7 +120,9 @@ private:
// Dock
FileContentDockWidget * m_contentDock;
ProjectDirectoryDockWidget * m_projectDock;
LogDockWidget * m_logDock;
ErrorDockWidgetImpl * m_errorDock;
RCSLogDockWidgetImpl * m_rcsLogDock;
SearchDockWidgetImpl * m_searchDock;
SnipetDockWidget * m_snipetsDock;
QDockWidget * m_logDockView;

87
xinx/rcslogdockimpl.cpp

@ -0,0 +1,87 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
// Xinx header
#include "rcslogdockimpl.h"
#include <core/exceptions.h>
#include <plugins/xinxpluginsloader.h>
// Qt header
#include <QFileInfo>
#include <QItemDelegate>
#include <QPainter>
/* RCSLogDockWidgetImpl */
RCSLogDockWidgetImpl::RCSLogDockWidgetImpl(QWidget * parent) : QWidget(parent), m_dock(0)
{
setWindowTitle(tr("Version Control Logs"));
setWindowIcon(QIcon(":/images/ecmascript.png"));
_widget = new Ui::RCSDockWidget();
_widget->setupUi(this);
_widget->m_progressBar->hide();
}
RCSLogDockWidgetImpl::~RCSLogDockWidgetImpl()
{
}
void RCSLogDockWidgetImpl::init()
{
_widget->m_rcsLogListWidget->clear();
_widget->m_progressBar->show();
}
void RCSLogDockWidgetImpl::end()
{
_widget->m_progressBar->hide();
}
void RCSLogDockWidgetImpl::log(RCS::rcsLog niveau, const QString & info)
{
QListWidgetItem * item = new QListWidgetItem(info, _widget->m_rcsLogListWidget);
switch (niveau)
{
case RCS::LogError :
case RCS::LogConflict :
item->setForeground(Qt::red);
break;
case RCS::LogLocallyModified :
item->setForeground(Qt::darkYellow);
break;
case RCS::LogRemotlyModified :
item->setForeground(Qt::darkGreen);
break;
case RCS::LogApplication :
item->setForeground(Qt::lightGray);
break;
case RCS::LogNotManaged :
case RCS::LogNormal :
default:
;
}
_widget->m_rcsLogListWidget->scrollToItem(item);
}
void RCSLogDockWidgetImpl::setDock(QDockWidget * dock)
{
m_dock = dock;
}

53
xinx/rcslogdockimpl.h

@ -0,0 +1,53 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
#ifndef RCSLOGDIALOGIMPL_H
#define RCSLOGDIALOGIMPL_H
#pragma once
// Xinx header
#include <rcs/rcs.h>
#include "ui_rcsdock.h"
// Qt header
#include <QDockWidget>
class RCSLogDockWidgetImpl : public QWidget
{
Q_OBJECT
public:
RCSLogDockWidgetImpl(QWidget * parent = 0);
virtual ~RCSLogDockWidgetImpl();
void init();
void end();
void setDock(QDockWidget * dock);
public slots:
void log(RCS::rcsLog niveau, const QString & info);
private:
Ui::RCSDockWidget * _widget;
QDockWidget * m_dock;
};
#endif

146
xinx/searchdockimpl.cpp

@ -0,0 +1,146 @@
/* *********************************************************************** *
* XINX *
* Copyright (C) 2009 by Ulrich Van Den Hekke *
* ulrich.vdh@shadoware.org *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
// Xinx header
#include "searchdockimpl.h"
#include <core/exceptions.h>
#include <plugins/xinxpluginsloader.h>
// Qt header
#include <QFileInfo>
#include <QItemDelegate>
#include <QPainter>
/* SearchLogWidget */
class SearchLogWidget : public QTreeWidget
{
public:
friend class SearchDockWidgetImpl;
};
/* SearchLogWidgetDelegate */
class SearchLogWidgetDelegate : public QItemDelegate
{
public:
SearchLogWidgetDelegate(QObject * parent = 0);
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
private:
};
SearchLogWidgetDelegate::SearchLogWidgetDelegate(QObject * parent) : QItemDelegate(parent)
{
}
void SearchLogWidgetDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QString text = index.data().toString();
QStyleOptionViewItem myOpt = option;
if (index.column() == 1) // Filename
{
drawBackground(painter, option, index);
QRectF boundingRect;
painter->setPen(Qt::magenta);
painter->drawText(myOpt.rect, Qt::AlignLeft, text.left(text.indexOf(':')), &boundingRect);
myOpt.rect.setLeft((int)(myOpt.rect.left() + boundingRect.width()));
painter->setPen(Qt::black);
painter->drawText(myOpt.rect, Qt::AlignLeft, ":", &boundingRect);
myOpt.rect.setLeft((int)(myOpt.rect.left() + boundingRect.width()));
painter->setPen(Qt::blue);
painter->drawText(myOpt.rect, Qt::AlignLeft, text.mid(text.indexOf(':') + 1), &boundingRect);
drawFocus(painter, option, option.rect);
return;
}
QItemDelegate::paint(painter, option, index);
}
/* SearchDockWidgetImpl */
SearchDockWidgetImpl::SearchDockWidgetImpl(QWidget * parent) : QWidget(parent), m_dock(0)
{
setWindowTitle(tr("Search Result"));
setWindowIcon(QIcon(":/images/find.png"));
_widget = new Ui::SearchDockWidget();
_widget->setupUi(this);
_widget->m_searchTreeWidget->setItemDelegate(new SearchLogWidgetDelegate);
connect(_widget->m_searchTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(doubleClicked(QModelIndex)));
_widget->m_progressBar->hide();
}
SearchDockWidgetImpl::~SearchDockWidgetImpl()
{
}
void SearchDockWidgetImpl::init()
{
_widget->m_searchTreeWidget->clear();
_widget->m_searchTreeWidget->setSortingEnabled(false);
_widget->m_progressBar->show();
}
void SearchDockWidgetImpl::end()
{
_widget->m_progressBar->hide();
_widget->m_searchTreeWidget->setSortingEnabled(true);
}
void SearchDockWidgetImpl::find(const QString & filename, const QString & text, int line)
{
QString path = QDir::toNativeSeparators(QFileInfo(filename).absolutePath());
QString emplacement = QFileInfo(filename).fileName() + ":" + QString::number(line);
QTreeWidgetItem * item = new QTreeWidgetItem(QStringList() << path << emplacement << text);
item->setData(0, Qt::UserRole, filename);
item->setData(0, Qt::UserRole + 1, line);
item->setData(1, Qt::UserRole, filename);
item->setData(1, Qt::UserRole + 1, line);
_widget->m_searchTreeWidget->addTopLevelItem(item);
_widget->m_searchTreeWidget->scrollToItem(item);
}
void SearchDockWidgetImpl::doubleClicked(const QModelIndex & index)
{
QString filename = index.data(Qt::UserRole).toString();
int line = index.data(Qt::UserRole + 1).toInt();
if (!filename.isEmpty())
{
emit open(filename, line);
}
}
void SearchDockWidgetImpl::setDock(QDockWidget * dock)
{
m_dock = dock;
}
QDockWidget * SearchDockWidgetImpl::dock() const
{
return m_dock;
}

24
xinx/logdialogimpl.h → xinx/searchdockimpl.h

@ -17,44 +17,40 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *********************************************************************** */
#ifndef RCSLOGDIALOGIMPL_H
#define RCSLOGDIALOGIMPL_H
#ifndef SEARCHDOCKIMPL_H
#define SEARCHDOCKIMPL_H
#pragma once
// Xinx header
#include <rcs/rcs.h>
#include <editors/abstracteditor.h>
#include "ui_logform.h"
#include "ui_searchdock.h"
// Qt header
#include <QDockWidget>
class PrivateLogDockWidget;
class LogDockWidget : public QWidget
class SearchDockWidgetImpl : public QWidget
{
Q_OBJECT
public:
LogDockWidget(QWidget * parent = 0);
virtual ~LogDockWidget();
SearchDockWidgetImpl(QWidget * parent = 0);
virtual ~SearchDockWidgetImpl();
void init();
void end();
void setDock(QDockWidget * dock);
QDockWidget * dock() const;
public slots:
void log(RCS::rcsLog niveau, const QString & info);
void find(const QString & filename, const QString & text, int line);
void updateErrors();
signals:
void open(const QString & filename, int line);
protected slots:
void doubleClicked(const QModelIndex & index);;
private:
Ui::LogWidget * m_logwidget;
Ui::SearchDockWidget * _widget;
QDockWidget * m_dock;
};
#endif
#endif /* SEARCHDOCKIMPL_H */

33
xinx/ui/errordock.ui

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ErrorDockWidget</class>
<widget class="QWidget" name="ErrorDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="m_messagesWidget">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

101
xinx/ui/logform.ui

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogWidget</class>
<widget class="QWidget" name="LogWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="m_progressBar">
<property name="maximum">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="m_tabWidget">
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_messageTab">
<attribute name="title">
<string>&amp;Message</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTreeWidget" name="m_messagesWidget">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_rcsLogTab">
<attribute name="title">
<string>RCS Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListWidget" name="m_rcsLogListWidget">
<property name="whatsThis">
<string>&lt;html&gt;This is where &lt;b&gt;XINX&lt;/b&gt; store it's message from &lt;i&gt;revision control system&lt;/i&gt; console.</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_searchTab">
<attribute name="title">
<string>Search Result</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeWidget" name="m_searchTreeWidget">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Line</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

35
xinx/ui/rcsdock.ui

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RCSDockWidget</class>
<widget class="QWidget" name="RCSDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="m_progressBar">
<property name="maximum">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="m_rcsLogListWidget">
<property name="whatsThis">
<string>&lt;html&gt;This is where &lt;b&gt;XINX&lt;/b&gt; store it's message from &lt;i&gt;revision control system&lt;/i&gt; console.</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

53
xinx/ui/searchdock.ui

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SearchDockWidget</class>
<widget class="QWidget" name="SearchDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>203</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QProgressBar" name="m_progressBar">
<property name="maximum">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="m_searchTreeWidget">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Directory</string>
</property>
</column>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Text</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

18
xinx/xinx.pro

@ -35,8 +35,10 @@ FORMS += ui/about.ui \
ui/projectproperty.ui \
ui/replace.ui \
ui/newprojectwizard_project.ui \
ui/logform.ui \
ui/snipetlistwidget.ui \
ui/errordock.ui \
ui/rcsdock.ui \
ui/searchdock.ui \
ui/snipetlistwidget.ui \
ui/welcomdlg.ui \
customdialog/ui/customdialog.ui \
customdialog/ui/customgeneral.ui \
@ -74,8 +76,10 @@ HEADERS += customdialog/customgeneralimpl.h \
tabeditor.h \
uniqueapplication.h \
searchfilethread.h \
logdialogimpl.h \
xinxprojectwizard/projectconverter.h \
errordockimpl.h \
rcslogdockimpl.h \
searchdockimpl.h \
xinxprojectwizard/projectconverter.h \
xinxprojectwizard/projectwizard.h \
welcomdlgimpl.h \
welcomdlgimpl_p.h \
@ -107,8 +111,10 @@ SOURCES += customdialog/customgeneralimpl.cpp \
uniqueapplication.cpp \
newprojectwizard.cpp \
searchfilethread.cpp \
logdialogimpl.cpp \
xinxprojectwizard/projectconverter.cpp \
errordockimpl.cpp \
rcslogdockimpl.cpp \
searchdockimpl.cpp \
xinxprojectwizard/projectconverter.cpp \
xinxprojectwizard/projectwizard.cpp \
welcomdlgimpl.cpp \
templatedialogimpl.cpp \

Loading…
Cancel
Save