Changed: #1302 Added status bar and inactive world editor settings page.

--HG--
branch : gsoc2011-worldeditorqt
This commit is contained in:
dnk-88 2011-08-10 14:59:23 +03:00
parent 3a96a8f8e3
commit c4c7fe06c0
10 changed files with 348 additions and 7 deletions

View file

@ -283,7 +283,7 @@ QString LandscapeSceneBase::zoneNameFromMousePos() const
(m_posX < 0) || (m_posX > MAX_SCENE_WIDTH))
return "NOT A VALID ZONE";
return QString("%1_%2%3 %4 %5 ").arg(-m_posY).arg(QChar('A' + (m_posX/26))).
return QString("%1_%2%3 %4 %5 ").arg(-m_posY+1).arg(QChar('A' + (m_posX/26))).
arg(QChar('A' + (m_posX%26))).arg(m_mouseX, 0,'f',2).arg(-m_mouseY, 0,'f',2);
}

View file

@ -16,10 +16,12 @@ SET(OVQT_PLUGIN_WORLD_EDITOR_HDR world_editor_plugin.h
primitives_model.h
primitives_view.h
project_settings_dialog.h
world_editor_settings_page.h
)
SET(OVQT_PLUGIN_WORLD_EDITOR_UIS world_editor_window.ui
project_settings_dialog.ui
world_editor_settings_page.ui
)
SET(OVQT_PLUGIN_WORLD_EDITOR_RCS world_editor.qrc)

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WorldEditorSettingsPage</class>
<widget class="QWidget" name="WorldEditorSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Colors</string>
</property>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="world_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -18,6 +18,7 @@
// Project includes
#include "world_editor_plugin.h"
#include "world_editor_window.h"
#include "world_editor_settings_page.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
@ -47,6 +48,10 @@ WorldEditorPlugin::~WorldEditorPlugin()
bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
m_plugMan = pluginManager;
WorldEditorSettingsPage *weSettings = new WorldEditorSettingsPage(this);
addAutoReleasedObject(weSettings);
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::WORLD_EDITOR_SECTION);
m_ligoConfig.CellSize = settings->value(Constants::WORLD_EDITOR_CELL_SIZE, "160").toFloat();

View file

@ -0,0 +1,71 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Project includes
#include "world_editor_settings_page.h"
#include "world_editor_constants.h"
// Qt includes
#include <QtGui/QWidget>
// NeL includes
namespace WorldEditor
{
WorldEditorSettingsPage::WorldEditorSettingsPage(QObject *parent)
: IOptionsPage(parent),
m_currentPage(NULL)
{
}
QString WorldEditorSettingsPage::id() const
{
return QLatin1String(Constants::WORLD_EDITOR_PLUGIN);
}
QString WorldEditorSettingsPage::trName() const
{
return tr("General");
}
QString WorldEditorSettingsPage::category() const
{
return QLatin1String(Constants::WORLD_EDITOR_PLUGIN);
}
QString WorldEditorSettingsPage::trCategory() const
{
return tr("World Editor");
}
QIcon WorldEditorSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *WorldEditorSettingsPage::createPage(QWidget *parent)
{
m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage);
return m_currentPage;
}
void WorldEditorSettingsPage::apply()
{
}
} /* namespace WorldEditor */

View file

@ -0,0 +1,59 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WORLD_EDITOR_SETTINGS_PAGE_H
#define WORLD_EDITOR_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include "../core/ioptions_page.h"
#include "ui_world_editor_settings_page.h"
class QWidget;
namespace WorldEditor
{
/**
@class WorldEditorSettingsPage
*/
class WorldEditorSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
WorldEditorSettingsPage(QObject *parent = 0);
virtual ~WorldEditorSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish() {}
private:
QWidget *m_currentPage;
Ui::WorldEditorSettingsPage m_ui;
};
} // namespace WorldEditor
#endif // WORLD_EDITOR_SETTINGS_PAGE_H

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WorldEditorSettingsPage</class>
<widget class="QWidget" name="WorldEditorSettingsPage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>239</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Workspace</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Top Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_3"/>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="spinBox_4"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bottom Right</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_5"/>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="spinBox_6"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Use OpenGL</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Ligoscape</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Cell size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Snap</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox_2"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Ligo class</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="world_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -37,6 +37,7 @@
// Qt includes
#include <QtCore/QSettings>
#include <QtGui/QFileDialog>
#include <QtGui/QStatusBar>
namespace WorldEditor
{
@ -54,7 +55,7 @@ WorldEditorWindow::WorldEditorWindow(QWidget *parent)
m_worldEditorScene->setZoneBuilder(m_zoneBuilderBase);
m_ui.graphicsView->setScene(m_worldEditorScene);
m_ui.graphicsView->setVisibleText(false);
//m_ui.graphicsView->setVisibleText(false);
QActionGroup *sceneModeGroup = new QActionGroup(this);
sceneModeGroup->addAction(m_ui.selectAction);
@ -100,6 +101,14 @@ WorldEditorWindow::WorldEditorWindow(QWidget *parent)
connect(m_ui.settingsAction, SIGNAL(triggered()), this, SLOT(openProjectSettings()));
connect(m_ui.newWorldEditAction, SIGNAL(triggered()), this, SLOT(newWorldEditFile()));
connect(m_ui.saveWorldEditAction, SIGNAL(triggered()), this, SLOT(saveWorldEditFile()));
connect(m_ui.visibleGridAction, SIGNAL(toggled(bool)), m_ui.graphicsView, SLOT(setVisibleGrid(bool)));
m_statusBarTimer = new QTimer(this);
connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
m_statusInfo = new QLabel(this);
m_statusInfo->hide();
Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo);
}
WorldEditorWindow::~WorldEditorWindow()
@ -215,20 +224,25 @@ void WorldEditorWindow::setMode(int value)
}
}
void WorldEditorWindow::updateStatusBar()
{
m_statusInfo->setText(m_worldEditorScene->zoneNameFromMousePos());
}
void WorldEditorWindow::showEvent(QShowEvent *showEvent)
{
QMainWindow::showEvent(showEvent);
if (m_oglWidget != 0)
m_oglWidget->makeCurrent();
//m_statusInfo->show();
//m_statusBarTimer->start(100);
m_statusInfo->show();
m_statusBarTimer->start(100);
}
void WorldEditorWindow::hideEvent(QHideEvent *hideEvent)
{
QMainWindow::hideEvent(hideEvent);
//m_statusInfo->hide();
//m_statusBarTimer->stop();
m_statusInfo->hide();
m_statusBarTimer->stop();
}
void WorldEditorWindow::createMenus()

View file

@ -22,6 +22,8 @@
// Qt includes
#include <QtGui/QUndoStack>
#include <QtGui/QLabel>
#include <QtCore/QTimer>
#include <QtCore/QSignalMapper>
#include <QtOpenGL/QGLWidget>
@ -55,6 +57,7 @@ private Q_SLOTS:
void openProjectSettings();
void setMode(int value);
void updateStatusBar();
protected:
virtual void showEvent(QShowEvent *showEvent);
@ -71,6 +74,9 @@ private:
QString m_lastDir;
QLabel *m_statusInfo;
QTimer *m_statusBarTimer;
PrimitivesTreeModel *m_primitivesModel;
QUndoStack *m_undoStack;
WorldEditorScene *m_worldEditorScene;

View file

@ -205,8 +205,11 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../landscape_editor/landscape_editor.qrc">