Commit f61e8672 authored by hjk's avatar hjk

more cosmetic changes

parent 1472bdb0
...@@ -30,9 +30,6 @@ ...@@ -30,9 +30,6 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
/*
TRANSLATOR qdesigner_internal::ResourceModel
*/
#include "resourcefile_p.h" #include "resourcefile_p.h"
...@@ -50,6 +47,10 @@ TRANSLATOR qdesigner_internal::ResourceModel ...@@ -50,6 +47,10 @@ TRANSLATOR qdesigner_internal::ResourceModel
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/*
TRANSLATOR qdesigner_internal::ResourceModel
*/
namespace qdesigner_internal { namespace qdesigner_internal {
/****************************************************************************** /******************************************************************************
...@@ -956,7 +957,7 @@ QString ResourceModel::resourcePath(const QString &prefix, const QString &file) ...@@ -956,7 +957,7 @@ QString ResourceModel::resourcePath(const QString &prefix, const QString &file)
return QDir::cleanPath(rc); return QDir::cleanPath(rc);
} }
QMimeData *ResourceModel::mimeData(const QModelIndexList & indexes) const QMimeData *ResourceModel::mimeData(const QModelIndexList &indexes) const
{ {
if (indexes.size() != 1) if (indexes.size() != 1)
return 0; return 0;
...@@ -977,6 +978,7 @@ QMimeData *ResourceModel::mimeData(const QModelIndexList & indexes) const ...@@ -977,6 +978,7 @@ QMimeData *ResourceModel::mimeData(const QModelIndexList & indexes) const
rc->setText(doc.toString()); rc->setText(doc.toString());
return rc; return rc;
} }
} // namespace qdesigner_internal } // namespace qdesigner_internal
QT_END_NAMESPACE QT_END_NAMESPACE
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef RESOURCEFILE_H
#define RESOURCEFILE_H #ifndef RESOURCEFILE__P_H
#define RESOURCEFILE__P_H
#include "namespace_global.h" #include "namespace_global.h"
...@@ -62,8 +63,6 @@ struct Prefix; ...@@ -62,8 +63,6 @@ struct Prefix;
*/ */
class Node class Node
{ {
File *m_file;
Prefix *m_prefix;
protected: protected:
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix) Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
{ {
...@@ -72,6 +71,9 @@ protected: ...@@ -72,6 +71,9 @@ protected:
public: public:
File * file() { return m_file; } File * file() { return m_file; }
Prefix * prefix() { Q_ASSERT(m_prefix != NULL); return m_prefix; } Prefix * prefix() { Q_ASSERT(m_prefix != NULL); return m_prefix; }
private:
File *m_file;
Prefix *m_prefix;
}; };
/*! /*!
...@@ -95,7 +97,8 @@ typedef QList<File *> FileList; ...@@ -95,7 +97,8 @@ typedef QList<File *> FileList;
Represents a prefix node in a \l ResourceFile tree. Represents a prefix node in a \l ResourceFile tree.
*/ */
struct Prefix : public Node { struct Prefix : public Node
{
Prefix(const QString &_name = QString(), const QString &_lang = QString(), const FileList &_file_list = FileList()) Prefix(const QString &_name = QString(), const QString &_lang = QString(), const FileList &_file_list = FileList())
: Node(NULL, this), name(_name), lang(_lang), file_list(_file_list) {} : Node(NULL, this), name(_name), lang(_lang), file_list(_file_list) {}
~Prefix() ~Prefix()
...@@ -263,4 +266,4 @@ private: ...@@ -263,4 +266,4 @@ private:
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // RESOURCEFILE_H #endif // RESOURCEFILE_P_H
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "resourceview.h" #include "resourceview.h"
#include "undocommands_p.h" #include "undocommands_p.h"
...@@ -658,4 +659,4 @@ bool ResourceView::resourceDragEnabled() const ...@@ -658,4 +659,4 @@ bool ResourceView::resourceDragEnabled() const
return m_qrcModel->resourceDragEnabled(); return m_qrcModel->resourceDragEnabled();
} }
} } // namespace SharedTools
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef RESOURCEVIEW_H #ifndef RESOURCEVIEW_H
#define RESOURCEVIEW_H #define RESOURCEVIEW_H
...@@ -42,10 +43,12 @@ ...@@ -42,10 +43,12 @@
using namespace qdesigner_internal; using namespace qdesigner_internal;
QT_FORWARD_DECLARE_CLASS(QAction) QT_BEGIN_NAMESPACE
QT_FORWARD_DECLARE_CLASS(QMenu) class QAction;
QT_FORWARD_DECLARE_CLASS(QMouseEvent) class QMenu;
QT_FORWARD_DECLARE_CLASS(QUndoStack) class QMouseEvent;
class QUndoStack;
QT_END_NAMESPACE
namespace SharedTools { namespace SharedTools {
...@@ -178,6 +181,6 @@ private: ...@@ -178,6 +181,6 @@ private:
int m_mergeId; int m_mergeId;
}; };
} } // namespace SharedTools
#endif //RESOURCEVIEW_H #endif // RESOURCEVIEW_H
...@@ -30,12 +30,13 @@ ...@@ -30,12 +30,13 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "qrceditor.h" #include "qrceditor.h"
#include "mainwindow.h" #include "mainwindow.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc,argv); QApplication app(argc, argv);
MainWindow mw; MainWindow mw;
mw.show(); mw.show();
return app.exec(); return app.exec();
......
...@@ -30,16 +30,16 @@ ...@@ -30,16 +30,16 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "mainwindow.h" #include "mainwindow.h"
#include "qrceditor.h" #include "qrceditor.h"
#include <QMenuBar>
#include <QAction> #include <QAction>
#include <QVBoxLayout> #include <QDebug>
#include <QFileDialog> #include <QFileDialog>
#include <QMenuBar>
#include <QStatusBar> #include <QStatusBar>
#include <QVBoxLayout>
#include <qdebug.h>
MainWindow::MainWindow() : MainWindow::MainWindow() :
m_qrcEditor(new SharedTools::QrcEditor()) m_qrcEditor(new SharedTools::QrcEditor())
...@@ -67,9 +67,9 @@ MainWindow::MainWindow() : ...@@ -67,9 +67,9 @@ MainWindow::MainWindow() :
void MainWindow::slotOpen() void MainWindow::slotOpen()
{ {
const QString fileName = QFileDialog::getOpenFileName (this, tr("Choose resource file"), const QString fileName = QFileDialog::getOpenFileName(this, tr("Choose resource file"),
QString(), QString(),
tr("Resource files (*.qrc)")); tr("Resource files (*.qrc)"));
if (fileName.isEmpty()) if (fileName.isEmpty())
return; return;
...@@ -81,13 +81,13 @@ void MainWindow::slotOpen() ...@@ -81,13 +81,13 @@ void MainWindow::slotOpen()
void MainWindow::slotSave() void MainWindow::slotSave()
{ {
const QString oldFileName = m_qrcEditor->fileName(); const QString oldFileName = m_qrcEditor->fileName();
QString fileName = oldFileName; QString fileName = oldFileName;
if (fileName.isEmpty()) { if (fileName.isEmpty()) {
fileName = QFileDialog::getSaveFileName (this, tr("Save resource file"), fileName = QFileDialog::getSaveFileName(this, tr("Save resource file"),
QString(), QString(),
tr("Resource files (*.qrc)")); tr("Resource files (*.qrc)"));
if (fileName.isEmpty()) if (fileName.isEmpty())
return; return;
} }
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef _MAINWINDOW_
#define _MAINWINDOW_ #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
...@@ -39,7 +40,8 @@ namespace SharedTools { ...@@ -39,7 +40,8 @@ namespace SharedTools {
class QrcEditor; class QrcEditor;
} }
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow
{
Q_OBJECT Q_OBJECT
public: public:
...@@ -51,6 +53,6 @@ private slots: ...@@ -51,6 +53,6 @@ private slots:
private: private:
SharedTools::QrcEditor *m_qrcEditor; SharedTools::QrcEditor *m_qrcEditor;
}; // MainWindow };
#endif #endif // MAINWINDOW_H
...@@ -30,18 +30,6 @@ ...@@ -30,18 +30,6 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
/****************************************************************************
**
** Copyright (C) 2008-$THISYEAR$ $TROLLTECH$. All rights reserved.
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
** $TROLLTECH_DUAL_LICENSE$
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "undocommands_p.h" #include "undocommands_p.h"
...@@ -104,7 +92,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command) ...@@ -104,7 +92,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
{ {
const ModifyPropertyCommand * const brother const ModifyPropertyCommand * const brother
= dynamic_cast<const ModifyPropertyCommand *>(command); = dynamic_cast<const ModifyPropertyCommand *>(command);
if ((command == NULL) || (m_property != brother->m_property)) if (command == NULL || m_property != brother->m_property)
return false; return false;
// Choose older command (this) and forgot the other // Choose older command (this) and forgot the other
...@@ -125,9 +113,8 @@ void ModifyPropertyCommand::undo() ...@@ -125,9 +113,8 @@ void ModifyPropertyCommand::undo()
void ModifyPropertyCommand::redo() void ModifyPropertyCommand::redo()
{ {
// Prevent execution from within QUndoStack::push // Prevent execution from within QUndoStack::push
if (m_after.isNull()) { if (m_after.isNull())
return; return;
}
// Bring back text before undo // Bring back text before undo
Q_ASSERT(m_view != NULL); Q_ASSERT(m_view != NULL);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef UNDO_COMMANDS_H #ifndef UNDO_COMMANDS_H
#define UNDO_COMMANDS_H #define UNDO_COMMANDS_H
...@@ -38,7 +39,9 @@ ...@@ -38,7 +39,9 @@
#include <QtCore/QString> #include <QtCore/QString>
#include <QtGui/QUndoCommand> #include <QtGui/QUndoCommand>
QT_FORWARD_DECLARE_CLASS(QModelIndex); QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
namespace SharedTools { namespace SharedTools {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "qscripthighlighter.h" #include "qscripthighlighter.h"
#include <QtCore/QSet> #include <QtCore/QSet>
...@@ -105,7 +106,7 @@ static const QSet<QString> &qscriptKeywords() { ...@@ -105,7 +106,7 @@ static const QSet<QString> &qscriptKeywords() {
} }
namespace SharedTools { namespace SharedTools {
QScriptHighlighter::QScriptHighlighter(QTextDocument *parent) QScriptHighlighter::QScriptHighlighter(QTextDocument *parent)
: QSyntaxHighlighter(parent) : QSyntaxHighlighter(parent)
...@@ -438,9 +439,8 @@ void QScriptHighlighter::highlightKeyword(int currentPos, const QString &buffer) ...@@ -438,9 +439,8 @@ void QScriptHighlighter::highlightKeyword(int currentPos, const QString &buffer)
if (buffer.at(0) == QLatin1Char('Q')) { if (buffer.at(0) == QLatin1Char('Q')) {
setFormat(currentPos - buffer.length(), buffer.length(), m_formats[TypeFormat]); setFormat(currentPos - buffer.length(), buffer.length(), m_formats[TypeFormat]);
} else { } else {
if (qscriptKeywords().contains(buffer)) { if (qscriptKeywords().contains(buffer))
setFormat(currentPos - buffer.length(), buffer.length(), m_formats[KeywordFormat]); setFormat(currentPos - buffer.length(), buffer.length(), m_formats[KeywordFormat]);
}
} }
} }
...@@ -466,7 +466,8 @@ void QScriptHighlighter::setFormats(const QVector<QTextCharFormat> &s) ...@@ -466,7 +466,8 @@ void QScriptHighlighter::setFormats(const QVector<QTextCharFormat> &s)
qCopy(s.constBegin(), s.constEnd(), m_formats); qCopy(s.constBegin(), s.constEnd(), m_formats);
} }
int QScriptHighlighter::onBlockStart() { int QScriptHighlighter::onBlockStart()
{
int state = 0; int state = 0;
int previousState = previousBlockState(); int previousState = previousBlockState();
if (previousState != -1) if (previousState != -1)
...@@ -476,5 +477,6 @@ int QScriptHighlighter::onBlockStart() { ...@@ -476,5 +477,6 @@ int QScriptHighlighter::onBlockStart() {
void QScriptHighlighter::onOpeningParenthesis(QChar, int) {} void QScriptHighlighter::onOpeningParenthesis(QChar, int) {}
void QScriptHighlighter::onClosingParenthesis(QChar, int) {} void QScriptHighlighter::onClosingParenthesis(QChar, int) {}
void QScriptHighlighter::onBlockEnd(int state, int) { return setCurrentBlockState(state); } void QScriptHighlighter::onBlockEnd(int state, int) { return setCurrentBlockState(state); }
}
} // namespace SharedTools
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef QSCRIPTSYNTAXHIGHLIGHTER_H #ifndef QSCRIPTSYNTAXHIGHLIGHTER_H
#define QSCRIPTSYNTAXHIGHLIGHTER_H #define QSCRIPTSYNTAXHIGHLIGHTER_H
...@@ -59,7 +60,8 @@ private: ...@@ -59,7 +60,8 @@ private:
virtual int onBlockStart(); // returns the blocks initial state virtual int onBlockStart(); // returns the blocks initial state
virtual void onOpeningParenthesis(QChar parenthesis, int pos); virtual void onOpeningParenthesis(QChar parenthesis, int pos);
virtual void onClosingParenthesis(QChar parenthesis, int pos); virtual void onClosingParenthesis(QChar parenthesis, int pos);
virtual void onBlockEnd(int state, int firstNonSpace); // sets the enriched user state, or simply calls setCurrentBlockState(state); // sets the enriched user state, or simply calls setCurrentBlockState(state);
virtual void onBlockEnd(int state, int firstNonSpace);
void highlightKeyword(int currentPos, const QString &buffer); void highlightKeyword(int currentPos, const QString &buffer);
......
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "qscripthighlighter.h" #include "qscripthighlighter.h"
#include <QTextEdit> #include <QTextEdit>
#include <QMainWindow> #include <QMainWindow>
#include <QApplication> #include <QApplication>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef QTEXTENDED_INTEGRATION #ifndef QTEXTENDED_INTEGRATION
#define QTEXTENDED_INTEGRATION #define QTEXTENDED_INTEGRATION
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#include "qtlockedfile.h" #include "qtlockedfile.h"
namespace SharedTools { namespace SharedTools {
...@@ -158,4 +159,4 @@ QtLockedFile::LockMode QtLockedFile::lockMode() const ...@@ -158,4 +159,4 @@ QtLockedFile::LockMode QtLockedFile::lockMode() const
Destroys the \e QtLockedFile object. If any locks were held, they are released. Destroys the \e QtLockedFile object. If any locks were held, they are released.
*/ */
} } // namespace SharedTools
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
** 1.2, included in the file GPL_EXCEPTION.txt in this package. ** 1.2, included in the file GPL_EXCEPTION.txt in this package.
** **
***************************************************************************/ ***************************************************************************/
#ifndef QTLOCKEDFILE_H #ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H #define QTLOCKEDFILE_H
...@@ -75,6 +76,6 @@ private: ...@@ -75,6 +76,6 @@ private:
LockMode m_lock_mode; LockMode m_lock_mode;
}; };
} } // namespace SharedTools
#endif #endif // QTLOCKEDFILE_H
...@@ -30,13 +30,14 @@ ...@@ -30,13 +30,14 @@