Skip to content

Commit

Permalink
git update to Mudlet-1.2.0-pre4
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoKoehn committed Aug 24, 2010
1 parent eeeeb60 commit 41e0cbb
Show file tree
Hide file tree
Showing 276 changed files with 36,194 additions and 1,123 deletions.
Empty file modified src/.folder-violet.png.autosave.kra
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions src/ActionUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@

using namespace std;

void ActionUnit::compileAll()
{
typedef list<TAction *>::const_iterator I;
for( I it = mActionRootNodeList.begin(); it != mActionRootNodeList.end(); it++)
{
TAction * pChild = *it;
if( pChild->isActive() )
{
pChild->compileAll();
}
}
}

void ActionUnit::addActionRootNode( TAction * pT, int parentPosition, int childPosition )
{
Expand Down
9 changes: 5 additions & 4 deletions src/ActionUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ class ActionUnit
{
friend class XMLexport;
friend class XMLimport;

public:
ActionUnit( Host * pHost ) : mpHost(pHost), mMaxID(0) {;}
std::list<TAction *> getActionRootNodeList() { QMutexLocker locker(& mActionUnitLock); return mActionRootNodeList; }
TAction * getAction( int id );
void compileAll();
bool registerAction( TAction * pT );
void unregisterAction( TAction * pT );
bool serialize( QDataStream & );
Expand All @@ -62,8 +63,8 @@ class ActionUnit
void hideToolBar( QString & );

QMutex mActionUnitLock;
private:

private:
ActionUnit(){;}
TAction * getActionPrivate( int id );
void addActionRootNode( TAction * pT, int parentPosition = -1, int childPosition = -1 );
Expand All @@ -78,7 +79,7 @@ class ActionUnit
TEasyButtonBar * mpEasyButtonBar;
std::list<TToolBar *> mToolBarList;
std::list<TEasyButtonBar *> mEasyButtonBarList;

};


Expand Down
33 changes: 23 additions & 10 deletions src/AliasUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@

using namespace std;

void AliasUnit::compileAll()
{
typedef list<TAlias *>::const_iterator I;
for( I it = mAliasRootNodeList.begin(); it != mAliasRootNodeList.end(); it++)
{
TAlias * pChild = *it;
if( pChild->isActive() )
{
pChild->compileAll();
}
}
}

void AliasUnit::initStats()
{
statsAliasTotal = 0;
Expand All @@ -57,7 +70,7 @@ void AliasUnit::addAliasRootNode( TAlias * pT, int parentPosition, int childPosi
if( ! pT ) return;
if( ! pT->getID() )
{
pT->setID( getNewID() );
pT->setID( getNewID() );
}
if( ( parentPosition == -1 ) || ( childPosition >= mAliasRootNodeList.size() ) )
{
Expand Down Expand Up @@ -102,7 +115,7 @@ void AliasUnit::reParentAlias( int childID, int oldParentID, int newParentID, in
{
mAliasRootNodeList.remove( pChild );
}
if( pNewParent )
if( pNewParent )
{
pNewParent->addChild( pChild, parentPosition, childPosition );
if( pChild ) pChild->setParent( pNewParent );
Expand Down Expand Up @@ -132,7 +145,7 @@ void AliasUnit::removeAliasRootNode( TAlias * pT )
}

TAlias * AliasUnit::getAlias( int id )
{
{
QMutexLocker locker(& mAliasUnitLock);
if( mAliasMap.find( id ) != mAliasMap.end() )
{
Expand All @@ -145,7 +158,7 @@ TAlias * AliasUnit::getAlias( int id )
}

TAlias * AliasUnit::getAliasPrivate( int id )
{
{
if( mAliasMap.find( id ) != mAliasMap.end() )
{
return mAliasMap.value( id );
Expand All @@ -159,7 +172,7 @@ TAlias * AliasUnit::getAliasPrivate( int id )
bool AliasUnit::registerAlias( TAlias * pT )
{
if( ! pT ) return false;

if( pT->getParent() )
{
addAlias( pT );
Expand Down Expand Up @@ -191,12 +204,12 @@ void AliasUnit::unregisterAlias( TAlias * pT )
void AliasUnit::addAlias( TAlias * pT )
{
if( ! pT ) return;

if( ! pT->getID() )
{
pT->setID( getNewID() );
}

mAliasMap.insert( pT->getID(), pT );
}

Expand Down Expand Up @@ -246,7 +259,7 @@ bool AliasUnit::processDataStream( QString & data )


void AliasUnit::stopAllTriggers()
{
{
typedef list<TAlias *>::const_iterator I;
for( I it = mAliasRootNodeList.begin(); it != mAliasRootNodeList.end(); it++)
{
Expand Down Expand Up @@ -346,10 +359,10 @@ bool AliasUnit::killAlias( QString & name )
void AliasUnit::dump()
{
bool ret = true;

typedef list<TAlias *>::const_iterator I;
cout << "AliasUnit::dump() entries="<<mAliasRootNodeList.size()<<endl;

for( I it = mAliasRootNodeList.begin(); it != mAliasRootNodeList.end(); it++)
{
TAlias * pChild = *it;
Expand Down
9 changes: 5 additions & 4 deletions src/AliasUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ class AliasUnit
{
friend class XMLexport;
friend class XMLimport;

public:
AliasUnit( Host * pHost ) : mpHost(pHost), mMaxID(0) { initStats();}
std::list<TAlias *> getAliasRootNodeList() { return mAliasRootNodeList; }
TAlias * getAlias( int id );
void compileAll();
TAlias * findAlias( QString & name );
bool enableAlias( QString & );
bool disableAlias( QString & );
Expand Down Expand Up @@ -75,8 +76,8 @@ class AliasUnit
int statsMinLineProcessingTime;
int statsRegexAliass;

private:

private:
AliasUnit(){;}
void initStats();
void _assembleReport( TAlias * );
Expand All @@ -85,7 +86,7 @@ class AliasUnit
void addAlias( TAlias * pT );
void removeAliasRootNode( TAlias * pT );
void removeAlias( TAlias *);

Host * mpHost;
QMap<int, TAlias *> mAliasMap;
std::list<TAlias *> mAliasRootNodeList;
Expand Down
Empty file modified src/CMakeLists.txt
100644 → 100755
Empty file.
Empty file modified src/Doxyfile
100644 → 100755
Empty file.
Empty file modified src/FindPCRE.cmake
100644 → 100755
Empty file.
90 changes: 88 additions & 2 deletions src/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ Host::Host( int port, QString hostname, QString login, QString pass, int id )
, mInsertedMissingLF( false )
, mLF_ON_GA( true )
, mAlertOnNewData( true )
//, mpMap( new TMap )
, mpMap( new TMap( this ) )
, mFORCE_NO_COMPRESSION( false )
, mFORCE_GA_OFF( false )
, mFORCE_SAVE_ON_EXIT( false )
, commandLineMinimumHeight( 30 )
, mResetProfile( false )
{
QString directoryLogFile = QDir::homePath()+"/.config/mudlet/profiles/";
directoryLogFile.append(mHostName);
Expand Down Expand Up @@ -196,7 +197,8 @@ Host::Host()
, mInsertedMissingLF( false )

, mAlertOnNewData( true )
//, mpMap( new TMap )
, mpMap( new TMap(this) )
, mResetProfile( false )

{
qDebug()<<"######################################################################################";
Expand All @@ -210,6 +212,68 @@ Host::~Host()
mErrorLogFile.close();
}

void Host::resetProfile()
{
getTriggerUnit()->removeAllTempTriggers();
getTimerUnit()->removeAllTempTimers();
mTimerUnit.doCleanup();
mTriggerUnit.doCleanup();
mpConsole->resetMainConsole();
mLuaInterpreter.initLuaGlobals();
mLuaInterpreter.loadGlobal();
mBlockScriptCompile = false;
getScriptUnit()->compileAll();
getTimerUnit()->compileAll();
getTriggerUnit()->compileAll();
getAliasUnit()->compileAll();
getActionUnit()->compileAll();
getKeyUnit()->compileAll();
mResetProfile = false;
}

void Host::assemblePath()
{
QStringList list;
for( int i=0; i<mpMap->mPathList.size(); i++ )
{
QString n = QString::number( mpMap->mPathList[i]);
list.append( n );
}
QStringList list2;
for( int i=0; i<mpMap->mDirList.size(); i++ )
{
QString n = mpMap->mDirList[i];
list2.append( n );
}
QString t1 = "speedWalkPath";
mLuaInterpreter.set_lua_table( t1, list );
QString t2 = "speedWalkDir";
mLuaInterpreter.set_lua_table( t2, list2 );
}

void Host::startSpeedWalk()
{
QStringList list;
for( int i=0; i<mpMap->mPathList.size(); i++ )
{
QString n = QString::number( mpMap->mPathList[i]);
list.append( n );
}
QStringList list2;
for( int i=0; i<mpMap->mDirList.size(); i++ )
{
QString n = mpMap->mDirList[i];
list2.append( n );
}
QString t1 = "speedWalkPath";
mLuaInterpreter.set_lua_table( t1, list );
QString t2 = "speedWalkDir";
mLuaInterpreter.set_lua_table( t2, list2 );
QString f = "doSpeedWalk";
QString n = "";
mLuaInterpreter.call( f, n );
}

void Host::adjustNAWS()
{
mTelnet.setDisplayDimensions();
Expand Down Expand Up @@ -506,6 +570,14 @@ bool Host::serialize()
{
dir_xml.mkpath( directory_xml );
}
QDir dir_map;
QString directory_map = QDir::homePath()+"/.config/mudlet/profiles/"+mHostName+"/map";
QString filename_map = directory_map + "/"+QDateTime::currentDateTime().toString("dd-MM-yyyy#hh-mm-ss")+"map.dat";
if( ! dir_map.exists( directory_map ) )
{
dir_map.mkpath( directory_map );
}

QFile file_xml( filename_xml );
if ( file_xml.open( QIODevice::WriteOnly ) )
{
Expand All @@ -518,6 +590,20 @@ bool Host::serialize()
QMessageBox::critical( 0, "Profile Save Failed", "Failed to save "+mHostName+" to location "+filename_xml+" because of the following error: "+file_xml.errorString() );
}

if( mpMap->rooms.size() > 10 )
{
QFile file_map( filename_map );
if ( file_map.open( QIODevice::WriteOnly ) )
{
QDataStream out( & file_map );
mpMap->serialize( out );
file_map.close();
}
else
{
QMessageBox::critical( 0, "Profile Save Failed", "Failed to save "+mHostName+" to location "+filename_xml+" because of the following error: "+file_xml.errorString() );
}
}
return true;
}

Expand Down
15 changes: 9 additions & 6 deletions src/Host.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class TLuaInterpreter;
#include "TEvent.h"
#include "TKey.h"
#include "KeyUnit.h"
//#include <QVector3D>
//#include "TArea.h"
//#include "TRoom.h"
//#include "TMap.h"
#include <QVector3D>
#include "TArea.h"
#include "TRoom.h"
#include "TMap.h"


class dlgTriggerEditor;
Expand Down Expand Up @@ -88,6 +88,7 @@ class Host : public QObject
int getTimeout() { QMutexLocker locker(& mLock); return mTimeout; }
void setTimeout( int seconds ) { QMutexLocker locker(& mLock); mTimeout=seconds; }
bool closingDown();
void assemblePath();
void orderShutDown();
TriggerUnit * getTriggerUnit() { return & mTriggerUnit; }
TimerUnit * getTimerUnit() { return & mTimerUnit; }
Expand Down Expand Up @@ -118,7 +119,7 @@ class Host : public QObject
bool startStopWatch( int );
double getStopWatchTime( int );
int createStopWatch();

void startSpeedWalk();
//QStringList getBufferTable( int, int );
//QString getBufferLine( int );
bool serialize();
Expand All @@ -130,6 +131,7 @@ class Host : public QObject
void registerEventHandler( QString, TScript * );
void unregisterEventHandler( QString, TScript * );
void raiseEvent( TEvent * event );
void resetProfile();
void callEventHandlers();
void stopAllTriggers();
void reenableAllTriggers();
Expand All @@ -140,6 +142,7 @@ class Host : public QObject
class Exception_NoConnectionAvailable{};
TConsole * mpConsole;
dlgTriggerEditor * mpEditorDialog;
bool mResetProfile;
bool mInsertedMissingLF;
QColor mBlack;
QColor mLightBlack;
Expand Down Expand Up @@ -233,7 +236,7 @@ class Host : public QObject
bool mIsGoingDown;
bool mLF_ON_GA;
bool mAlertOnNewData;
//Map * mpMap;
TMap * mpMap;
bool mFORCE_NO_COMPRESSION;
bool mFORCE_GA_OFF;
bool mFORCE_SAVE_ON_EXIT;
Expand Down
13 changes: 13 additions & 0 deletions src/KeyUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ bool KeyUnit::processDataStream( int key, int modifier )
return false;
}

void KeyUnit::compileAll()
{
typedef list<TKey *>::const_iterator I;
for( I it = mKeyRootNodeList.begin(); it != mKeyRootNodeList.end(); it++)
{
TKey * pChild = *it;
if( pChild->isActive() )
{
pChild->compileAll();
}
}
}

bool KeyUnit::enableKey( QString & name )
{
bool found = false;
Expand Down
Loading

0 comments on commit 41e0cbb

Please sign in to comment.