master
Ulrich Van Den Hekke 2011-03-13 17:46:30 +00:00
parent 7720444e2a
commit 58e232c176
11 changed files with 282 additions and 155 deletions

View File

@ -1,6 +1,31 @@
xinx (0.9.1.0) unstable; urgency=low
xinx (0.10.0.0) unstable; urgency=low
[ Ulrich Van Den Hekke ]
* 410 : Crash lors création du projet
* 358 : Répercuté modification sur matchedFileType qui peux retourner plusieurs lignes
* 399 : Dock de log et d'erreur
* 095 : Affichage des erreurs dans la feuilles XSL
* 183 : Plugins SubVersion - Perf
* 238 : Utiliser la librairie SVN au lieu de faire un WRAPPER
* 315 : Ecran de recherche
* 323 : Recherche
* 329 : Pb avec enregistrer tout
* 357 : "Bouton ""Arrêter"" dans la recherche par fichiers projet"
* 377 : Création de ticket à partir de XINX
* 379 : Accès aux Javascripts inclus
* 397 : Nettoyage en cas de plantage
* 406 : "Impossible de valider l'écran ""Personnaliser"""
* 407 : FATAL ASSERT when closing a tab
* 082 : Valider le fichier XML
* 330 : Définir ce qui appartient au projet
* 343 : Pouvoir réordonner l'ordre des fichiers ouverts par glisser/déposer
* 385 : Ajouter la complétion sur les ALIAS et les noms de fichiers
* 387 : Remplacer tous les Singleton par un XinxSingleton<>
* 388 : Ajouter Fermer Tout en popup sur les onglets
* 389 : Ajouter la GPL lors de l'assistant nouvelle version
* Rewriting ContentView framework
* Rewriting CodeCompletion framework
* Rewriting Project and Session framework
* Add the possibility to wrap line
* 363 : Lenteur lors du déplacement danx XINX
* 356 : Bug dans le rafraichissement des snipets
@ -17,7 +42,7 @@ xinx (0.9.1.0) unstable; urgency=low
* Some bug fix on the project property page and on the wizard
* Some buf fix on the new version wizard
-- Ulrich VANDENHEKKE <phoenix@server.eden.lan> Fri, 01 Oct 2010 14:10:13 +0200
-- Ulrich Van Den Hekke <xinx@shadoware.org> Sat, 12 Mar 2011 17:01:37 +0100
xinx (0.9.0.0) unstable; urgency=low

View File

@ -50,7 +50,7 @@
#include <jobs/xinxjobprogressbar.h>
#include <session/sessionmanager.h>
#include <jobs/xinxjobprogressdock.h>
#include <application/versionlabel.h>
#include <application/versionavailabledialog.h>
// Qt header
#include <QObject>
@ -101,6 +101,9 @@ MainformImpl::MainformImpl(QWidget * parent) : DMainWindow(parent)
// Restore windows property
readWindowSettings();
// Create the object that test if a version exists
new VersionAvailableDialog(this);
}
MainformImpl::~MainformImpl()
@ -129,7 +132,7 @@ void MainformImpl::createMainForm()
void MainformImpl::createMenus()
{
QMenu * sessionMenu, *projectMenu, * fileMenu, * editMenu, *searchMenu, *bookmarkMenu, *windowsMenu, *toolsMenu, *helpMenu;
QToolBar * fileToolBar, * editToolBar, * searchToolBar, * versionToolBar;
QToolBar * fileToolBar, * editToolBar, * searchToolBar;
m_menuBar = new QMenuBar(this);
setMenuBar(m_menuBar);
m_menus.insert("session", sessionMenu = new QMenu(tr("Sess&ion"), m_menuBar));
@ -148,12 +151,10 @@ void MainformImpl::createMenus()
m_toolBars.insert("file", fileToolBar = new QToolBar(this));
m_toolBars.insert("edit", editToolBar = new QToolBar(this));
m_toolBars.insert("search", searchToolBar = new QToolBar(this));
m_toolBars.insert("version", versionToolBar = new QToolBar(this));
fileToolBar->setWindowTitle(tr("&File"));
editToolBar->setWindowTitle(tr("&Edit"));
searchToolBar->setWindowTitle(tr("&Search"));
versionToolBar->setWindowTitle(tr("&Version"));
createActions();
@ -246,12 +247,6 @@ void MainformImpl::createMenus()
searchToolBar->setObjectName("searchToolBar");
addToolBar(Qt::TopToolBarArea, searchToolBar);
versionToolBar->addWidget(new VersionLabel(this));
versionToolBar->setOrientation(Qt::Horizontal);
versionToolBar->setObjectName("versionToolBar");
addToolBar(Qt::TopToolBarArea, versionToolBar);
connect(XinxAction::ActionManager::self(), SIGNAL(changed()), this, SLOT(createPluginsActions()));
XinxAction::ActionManager::self()->generateMenu();
}

View File

@ -25,10 +25,12 @@
void VersionData::updateFromString(const QString & version, const QLatin1Char & separator)
{
int indice = 1;
bool ok;
QStringList versionNumberStr = version.split(separator);
foreach(const QString & numberStr, versionNumberStr)
{
int number = numberStr.toInt();
int number = numberStr.toInt(&ok);
if (!ok) return;
switch(indice)
{
case 1:
@ -108,7 +110,7 @@ QString Version::toString(const Version::VersionNumberFlags& flags, const QLatin
{
versionStr << QString::number(d->_build);
}
return versionStr.join(QString(separator));
}
@ -118,9 +120,15 @@ Version& Version::operator=(const QString& version)
return *this;
}
Version & Version::operator=(const Version & version)
{
d = version.d;
return *this;
}
bool Version::operator!=(const Version& version) const
{
return (d->_major != version.d->_major) && (d->_minor != version.d->_minor) && (d->_micro != version.d->_micro) && (d->_build != version.d->_build);
return (d->_major != version.d->_major) || (d->_minor != version.d->_minor) || (d->_micro != version.d->_micro) || (d->_build != version.d->_build);
}
bool Version::operator==(const Version& version) const

View File

@ -37,7 +37,7 @@ public:
ALL_NUMBER = 0xF
};
Q_DECLARE_FLAGS(VersionNumberFlags, VersionNumber)
Version();
Version(int major, int minor, int micro, int build);
Version(const Version & version);
@ -50,10 +50,11 @@ public:
QString toString(const VersionNumberFlags & flags = Version::ALL_NUMBER, const QLatin1Char & separator = QLatin1Char('.'));
Version & operator=(const QString & version);
Version & operator=(const Version & version);
bool operator==(const Version & version) const;
bool operator!=(const Version & version) const;
bool operator<(const Version & version) const;
bool operator<=(const Version & version) const;
bool operator>(const Version & version) const;

View File

@ -0,0 +1,207 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@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/>.
*/
#include "versionavailabledialog_p.h"
#include <QDomDocument>
#include <QTextStream>
#include <core/version.h>
/* VersionAvailableDialogPrivate */
#include <core/xinxconfig.h>
void VersionAvailableDialogPrivate::releaseFinished()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QDomDocument document;
document.setContent(reply);
QDomNodeList homepageList = document.elementsByTagName("homepage");
QDomNodeList stableList = document.elementsByTagName("stable_version");
QDomNodeList stableChangeLogList = document.elementsByTagName("stable_changelog");
QDomNodeList unstableList = document.elementsByTagName("unstable_version");
QDomNodeList unstableChangeLogList = document.elementsByTagName("unstable_changelog");
QString stable, unstable;
if (stableList.length())
{
stable = stableList.at(0).toElement().text();
}
if (unstableList.length())
{
unstable = unstableList.at(0).toElement().text();
}
if (homepageList.length())
{
_homepage = homepageList.at(0).toElement().text();
}
if (stableChangeLogList.length())
{
_stable_changelog = stableChangeLogList.at(0).toElement().text();
}
if (unstableChangeLogList.length())
{
_unstable_changelog = unstableChangeLogList.at(0).toElement().text();
}
_stable = stable;
_unstable = unstable;
updateText();
}
void VersionAvailableDialogPrivate::changelogFinished()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QTextStream stream(reply);
QRegExp regexp("xinx \\((.*)\\) .*\\; urgency=.*");
Version changeLogVersion;
while (!stream.atEnd())
{
QString line = stream.readLine();
if (regexp.exactMatch(line))
{
changeLogVersion = regexp.cap(1);
if (changeLogVersion > _current)
{
_changelog.append(tr("For version %1 :").arg(changeLogVersion.toString()));
}
}
else if (changeLogVersion > _current)
{
if (line.startsWith(" *"))
{
_changelog.append(line);
}
}
}
_dialog->setDetailedText(_changelog.join("\n"));
if ((_current < _stable) || (_current < _unstable))
{
_dialog->exec();
}
_dialog->deleteLater();
}
void VersionAvailableDialogPrivate::updateText()
{
_update_version = XINXConfig::self()->config().lastUpdate;
QString message = tr("The current version is %1.\n\nThe version %2 is available on %3.");
if ((_current < _stable) && (_stable != _update_version))
{
_dialog->setText(tr("<span style=\"font-weight: bold\">A new version of XINX is available !</span>"));
_update_version = _stable;
QNetworkRequest request(QUrl(QString("http://xinx.shadoware.org/files/" + _stable_changelog)));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
QNetworkReply* reply = _manager->get(request);
connect(reply, SIGNAL(finished()), this, SLOT(changelogFinished()));
}
else if ((_current < _unstable) && (_unstable != _update_version))
{
_dialog->setText(tr("<span style=\"font-weight: bold\">A new snapshot version of XINX is available !</span>"));
_update_version = _unstable;
QNetworkRequest request(QUrl(QString("http://xinx.shadoware.org/files/" + _unstable_changelog)));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
QNetworkReply* reply = _manager->get(request);
connect(reply, SIGNAL(finished()), this, SLOT(changelogFinished()));
}
else
{
_dialog->setText(tr("<span style=\"font-weight: bold\">There is no new version of XINX.</span>"));
_dialog->deleteLater();
}
if (_update_version.isValid())
{
_dialog->setInformativeText(message.arg(_current.toString()).arg(_update_version.toString()).arg(_homepage));
QFontMetrics metrics(_dialog->font());
_width = metrics.width(_dialog->informativeText()) /*+ _dialog->iconPixmap().size().width() */;
}
}
/* VersionAvailableDialog */
VersionAvailableDialog::VersionAvailableDialog(QWidget* parent): QMessageBox(QMessageBox::Information, tr("New release of XINX available"), QString(), QMessageBox::Ok | QMessageBox::Ignore, parent), d(new VersionAvailableDialogPrivate)
{
setTextFormat(Qt::RichText);
d->_width = 0;
d->_dialog = this;
d->_current = VERSION;
d->_manager = new QNetworkAccessManager(d.data());
connect(this, SIGNAL(finished(int)), this, SLOT(deleteLater()));
QNetworkRequest request(QUrl("http://xinx.shadoware.org/files/release.xml"));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
QNetworkReply * reply = d->_manager->get(request);
connect(reply, SIGNAL(finished()), d.data(), SLOT(releaseFinished()));
}
VersionAvailableDialog::~VersionAvailableDialog()
{
}
const Version& VersionAvailableDialog::currentVersion() const
{
return d->_current;
}
const Version& VersionAvailableDialog::stableVersion() const
{
return d->_stable;
}
const Version& VersionAvailableDialog::unstableVersion() const
{
return d->_unstable;
}
void VersionAvailableDialog::done(int code)
{
if (clickedButton() == button(QMessageBox::Ignore))
{
XINXConfig::self()->config().lastUpdate = d->_update_version.toString();
}
QDialog::done(code);
}
void VersionAvailableDialog::showEvent(QShowEvent* event)
{
QMessageBox::showEvent(event);
/*
QWidget *textField = findChild<QWidget *>("qt_msgbox_label");
textField->setMinimumWidth(d->_width);
textField->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
if (parentWidget())
{
QRect parentRect = parentWidget()->geometry();
QRect dialogRect = rect();
move(parentRect.center() - dialogRect.center());
}
*/
}

View File

@ -17,27 +17,31 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VERSIONLABEL_H
#define VERSIONLABEL_H
#ifndef VERSIONAVAILABLEDIALOG_H
#define VERSIONAVAILABLEDIALOG_H
#include <QLabel>
#include <QMessageBox>
#include <core/lib-config.h>
#include <application/version.h>
class VersionLabelPrivate;
class VersionAvailableDialogPrivate;
class VersionLabel : public QLabel
class VersionAvailableDialog : public QMessageBox
{
Q_OBJECT
public:
VersionLabel(QWidget* parent = 0, Qt::WindowFlags f = 0);
virtual ~VersionLabel();
VersionAvailableDialog(QWidget* parent = 0);
virtual ~VersionAvailableDialog();
const Version & currentVersion() const;
const Version & stableVersion() const;
const Version & unstableVersion() const;
protected:
virtual void showEvent(QShowEvent *event);
virtual void done(int r);
private:
QScopedPointer<VersionLabelPrivate> d;
QScopedPointer<VersionAvailableDialogPrivate> d;
};
#endif // VERSIONLABEL_H
#endif // VERSIONAVAILABLEDIALOG_H

View File

@ -20,21 +20,25 @@
#ifndef VERSIONLABEL_P_H
#define VERSIONLABEL_P_H
#include "versionlabel.h"
#include "versionavailabledialog.h"
#include <QNetworkReply>
class VersionLabelPrivate : public QObject
class VersionAvailableDialogPrivate : public QObject
{
Q_OBJECT
public:
VersionLabel * _label;
QString _homepage;
Version _current, _stable, _unstable;
VersionAvailableDialog * _dialog;
QString _homepage, _stable_changelog, _unstable_changelog;
Version _current, _stable, _unstable, _update_version;
QStringList _changelog;
QNetworkAccessManager * _manager;
int _width;
void updateText();
public slots:
void finished(QNetworkReply * reply);
void releaseFinished();
void changelogFinished();
};
#endif // VERSIONLABEL_P_H

View File

@ -1,121 +0,0 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@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/>.
*/
#include "versionlabel_p.h"
#include <QDomDocument>
#include <core/version.h>
/* VersionLabelPrivate */
void VersionLabelPrivate::finished(QNetworkReply * reply)
{
QDomDocument document;
document.setContent(reply);
QDomNodeList homepageList = document.elementsByTagName("homepage");
QDomNodeList stableList = document.elementsByTagName("stable_version");
QDomNodeList unstableList = document.elementsByTagName("unstable_version");
QString stable, unstable;
if (stableList.length())
{
stable = stableList.at(0).toElement().text();
}
if (unstableList.length())
{
unstable = unstableList.at(0).toElement().text();
}
if (homepageList.length())
{
_homepage = homepageList.at(0).toElement().text();
}
_stable = stable;
_unstable = unstable;
updateText();
}
void VersionLabelPrivate::updateText()
{
QStringList versionInfo;
if (_current.isValid())
{
versionInfo << tr("Current Version : %1").arg(_current.toString());
}
if (_stable.isValid())
{
QString stableText = tr("Stable Version : %1").arg(_stable.toString());
versionInfo << stableText;
if (_current < _stable)
{
stableText = tr("!!! New version released !!!") + "\n<br/>" + stableText;
} else if (_current < _unstable)
{
stableText = tr("!!! New snapshot released !!!") + "\n<br/>" + stableText;
}
_label->setText(QString("<a href=\"%1\">%2</a>").arg(_homepage).arg(stableText));
}
if (_unstable.isValid())
{
versionInfo << tr("Unstable Version : %1").arg(_unstable.toString());
}
_label->setToolTip(versionInfo.join("\n"));
}
/* VersionLabel */
VersionLabel::VersionLabel(QWidget* parent, Qt::WindowFlags f): QLabel(parent, f), d(new VersionLabelPrivate)
{
setOpenExternalLinks(true);
d->_label = this;
d->_current = VERSION;
d->_manager = new QNetworkAccessManager(d.data());
connect(d->_manager, SIGNAL(finished(QNetworkReply*)), d.data(), SLOT(finished(QNetworkReply*)));
QNetworkRequest request(QUrl("http://xinx.shadoware.org/files/release.xml"));
d->_manager->get(request);
d->updateText();
}
VersionLabel::~VersionLabel()
{
}
const Version& VersionLabel::currentVersion() const
{
return d->_current;
}
const Version& VersionLabel::stableVersion() const
{
return d->_stable;
}
const Version& VersionLabel::unstableVersion() const
{
return d->_unstable;
}

View File

@ -373,6 +373,7 @@ AppSettings::struct_globals AppSettings::getSettingsGlobals(AppSettingsSettings
value.tools = getSettingsHash_QString(settings, "Tools", defaultValue.tools);
value.formats = getSettingsHash_struct_qformat(settings, "Formats", defaultValue.formats);
value.version = settings->value("Version", defaultValue.version).toString();
value.lastUpdate = settings->value("LastUpdate", defaultValue.lastUpdate).toString();
settings->endGroup();
return value;
@ -398,6 +399,7 @@ void AppSettings::setSettingsGlobals(AppSettingsSettings * settings, const QStri
setSettingsHash_QString(settings, "Tools", value.tools);
setSettingsHash_struct_qformat(settings, "Formats", value.formats);
settings->setValue("Version", value.version, defaultValue.version);
settings->setValue("LastUpdate", value.lastUpdate, defaultValue.lastUpdate);
settings->endGroup();
}

View File

@ -104,6 +104,7 @@ public:
QHash<QString,QString> tools;
QHash<QString,struct_qformat> formats;
QString version;
QString lastUpdate;
};

View File

@ -65,4 +65,5 @@
<value name="Formats" type="hash:QFormat"/>
<value name="Version" type="string"/>
<value name="LastUpdate" type="string"/>
</config>