Offset editor skeleton app (just dead UI, no data yet)

develop
Petr Mrázek 2010-08-11 06:41:39 +02:00
parent dac7e45a44
commit 1dc4aea04f
13 changed files with 2040 additions and 3 deletions

@ -1,9 +1,8 @@
INCLUDE(CPack)
# main project file. use it from a build sub-folder, see COMPILE for details
PROJECT (dfhack)
cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
SET ( DFHACK_VERSION "0.4.0.3-dev" )
SET ( DFHACK_VERSION "0.4.1.0-dev" )
# disable warning, autosearch
if(COMMAND cmake_policy)
@ -32,8 +31,8 @@ include_directories (${CMAKE_SOURCE_DIR}/library/depends/tinyxml/)
include_directories (${CMAKE_SOURCE_DIR}/library/depends/argstream/)
add_subdirectory (library)
add_subdirectory (offsetedit)
add_subdirectory (library/shm)
#add_subdirectory (dfhack/python)
add_subdirectory (tools/examples)
add_subdirectory (tools/playground)
add_subdirectory (tools/supported)

@ -0,0 +1,73 @@
/*******************************************************************************
www.sourceforge.net/projects/dfhack
Copyright (c) 2009 Petr Mrázek (peterix)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
/*! \page index
<center>
\htmlonly
<h1>DFHack</h1>
<!--<img src="logo.png" alt="DFHack"/><br/>-->
\endhtmlonly
</center>
<h2>Introduction</h2>
DFHack is a Dwarf Fortress memory access library and a set of basic tools using
this library. The library is a work in progress, so things might change as more
tools are written for it.
It is an attempt to unite the various ways tools access DF memory and allow for
easier development of new tools. In general, you can use it to move memory
objects in and out of Dwarf Fortress really fast, regardless of DF version or OS.
First part of the manual deals with the basic of using DFHack as a library:
<ul>
PLACEHOLDER TERRITORY!
<li>Section \ref blah discusses some weird stuff
<a href="target">this is a link</a>
<li>Section \ref starting tells you how to cromulate at a distance!
</ul>
Second part has some details on DFHack development:
<ul>
<li>Section \ref starting tells you how to cromulate at a distance!
</ul>
The third part describes how to use the supported DFHack utilities
<ul>
<li>Section \ref dfattachtest shows how to use the \c dfattachtest program
<li>Section \ref dfcleanmap shows how to use the \c dfcleanmap program
<li>Section \ref dfexpbench shows how to use the \c dfexpbench program
<li>Section \ref dfflows shows how to use the \c dfflows program
<li>Section \ref dfliquids shows how to use the \c dfliquids program
<li>Section \ref dfprobe shows how to use the \c dfprobe program
<li>Section \ref dfprospector shows how to use the \c dfprospector program
<li>Section \ref dfreveal shows how to use the \c dfreveal program
<li>Section \ref dfsuspend shows how to use the \c dfsuspend program
<li>Section \ref dfunstuck shows how to use the \c dfunstuck program
<li>Section \ref dfvdig shows how to use the \c dfvdig program
</ul>
*/

@ -0,0 +1,5 @@
project(dfoffsetedit)
cmake_minimum_required(VERSION 2.6)
find_package(Qt4 REQUIRED)
add_subdirectory (src)

@ -0,0 +1,26 @@
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
set ( dfoffsetedit_SRCS
dfedit.cpp
main.cpp
)
SET ( dfoffsetedit_UI
gui/main.ui
)
SET( dfoffsetedit_RCS
gui/resources.qrc
)
# this command will generate rules that will run rcc on all files from dfoffsetedit_RCS
# in result dfoffsetedit_RC_SRCS variable will contain paths to files produced by rcc
QT4_ADD_RESOURCES( dfoffsetedit_RC_SRCS ${dfoffsetedit_RCS} )
QT4_WRAP_UI(dfoffsetedit_SRCS ${dfedit_UI})
qt4_automoc(${dfoffsetedit_SRCS})
#ADD_EXECUTABLE( sample ${SAMPLE_SRCS} ${SAMPLE_MOC_SRCS} ${SAMPLE_RC_SRCS} ${SAMPLE_UI_HDRS})
add_executable(dfoffsetedit ${dfoffsetedit_SRCS} ${dfoffsetedit_RC_SRCS})
target_link_libraries(dfoffsetedit ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})

@ -0,0 +1,81 @@
#include "dfedit.h"
#include <QFileDialog>
#include <QDebug>
dfedit::dfedit(QWidget *parent): QMainWindow(parent)
{
ui.setupUi(this);
connect(ui.actionOpen,SIGNAL(triggered(bool)),this,SLOT(slotOpen(bool)));
connect(ui.actionQuit,SIGNAL(triggered(bool)),this,SLOT(slotQuit(bool)));
connect(ui.actionRun_DF,SIGNAL(triggered(bool)),this,SLOT(slotRunDF(bool)));
connect(ui.actionSave,SIGNAL(triggered(bool)),this,SLOT(slotSave(bool)));
connect(ui.actionSave_As,SIGNAL(triggered(bool)),this,SLOT(slotSaveAs(bool)));
connect(ui.actionSetup_DF_executables,SIGNAL(triggered(bool)),this,SLOT(slotSetupDFs(bool)));
ui.actionOpen->setIcon(QIcon::fromTheme("document-open"));
ui.actionOpen->setIconText("Open");
ui.actionSave->setIcon(QIcon::fromTheme("document-save"));
ui.actionSave->setIconText("Save");
ui.actionSave_As->setIcon(QIcon::fromTheme("document-save-as"));
ui.actionSave_As->setIconText("Save As");
ui.actionRun_DF->setIcon(QIcon::fromTheme("system-run"));
ui.actionRun_DF->setIconText("Run DF");
ui.actionQuit->setIcon(QIcon::fromTheme("application-exit"));
ui.actionQuit->setIconText("Run DF");
}
dfedit::~dfedit()
{}
void dfedit::slotOpen(bool )
{
QFileDialog fd(this,"Locate the Memoxy.xml file");
fd.setNameFilter("Memory definition (Memory.xml)");
fd.setFileMode(QFileDialog::ExistingFile);
fd.setAcceptMode(QFileDialog::AcceptOpen);
int result = fd.exec();
if(result == QDialog::Accepted)
{
QStringList files = fd.selectedFiles();
QString file = files[0];
qDebug() << "File:" << file;
}
}
void dfedit::slotQuit(bool )
{
close();
}
void dfedit::slotSave(bool )
{
// blah
}
void dfedit::slotRunDF(bool )
{
// blah
}
void dfedit::slotSaveAs(bool )
{
QFileDialog fd(this,"Choose file to save as...");
fd.setNameFilter("Memory definition (*.xml)");
fd.setFileMode(QFileDialog::AnyFile);
fd.selectFile("Memory.xml");
fd.setAcceptMode(QFileDialog::AcceptSave);
int result = fd.exec();
if(result == QDialog::Accepted)
{
QStringList files = fd.selectedFiles();
QString file = files[0];
qDebug() << "File:" << file;
}
}
void dfedit::slotSetupDFs(bool )
{
// dialog showing all the versions in Memory.xml that lets the user set up ways to run those versions...
// currently unimplemented
}
#include "dfedit.moc"

@ -0,0 +1,24 @@
#ifndef dfedit_H
#define dfedit_H
#include <QtGui/QMainWindow>
#include "ui_main.h"
class dfedit : public QMainWindow
{
Q_OBJECT
public:
dfedit(QWidget *parent = 0);
virtual ~dfedit();
private:
Ui::MainWindow ui;
public slots:
void slotOpen(bool);
void slotQuit(bool);
void slotSave(bool);
void slotSaveAs(bool);
void slotRunDF(bool);
void slotSetupDFs(bool);
};
#endif // dfedit_H

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 114 KiB

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>622</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/main_icon/main_64.png</normaloff>:/main_icon/main_64.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeView" name="entryView"/>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSave_As"/>
<addaction name="actionRun_DF"/>
</widget>
<widget class="QDockWidget" name="descriptioDock">
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Description</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="DescriptionPanel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="text">
<string>&lt;h1&gt;Title text&lt;/h1&gt;&lt;p&gt;Some other text. It seriously rocks.&lt;/p&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget">
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<property name="windowTitle">
<string>Entries</string>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTreeView" name="structureView"/>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSave_As"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuSettings">
<property name="title">
<string>Settings</string>
</property>
<addaction name="actionSetup_DF_executables"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuSettings"/>
</widget>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="actionSave">
<property name="text">
<string>Save</string>
</property>
</action>
<action name="actionSave_As">
<property name="text">
<string>Save As</string>
</property>
</action>
<action name="actionQuit">
<property name="text">
<string>Quit</string>
</property>
</action>
<action name="actionRun_DF">
<property name="text">
<string>Run DF</string>
</property>
</action>
<action name="actionSetup_DF_executables">
<property name="text">
<string>Setup DF executables</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="main_icon">
<file>main_64.png</file>
<file>main_16.png</file>
<file>main_32.png</file>
</qresource>
</RCC>

@ -0,0 +1,11 @@
#include <QtGui/QApplication>
#include "dfedit.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
dfedit appGui;
appGui.show();
return app.exec();
}