Skip to content

Commit 8e0f9db

Browse files
author
unknown
committed
m
1 parent 93c5698 commit 8e0f9db

16 files changed

Lines changed: 453 additions & 137 deletions

src/Host.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,24 @@ Host::Host( int port, QString hostname, QString login, QString pass, int id )
116116
, mBgColor ( QColor( 0, 0, 0) )
117117
, mCommandBgColor ( QColor( 0, 0, 0) )
118118
, mCommandFgColor ( QColor(113,113, 0) )
119-
, mBlack_2 ( QColor( 0, 0, 0) )
120-
, mLightBlack_2 ( QColor(128,128,128) )
121-
, mRed_2 ( QColor(128, 0, 0) )
122-
, mLightRed_2 ( QColor(255, 0, 0) )
123-
, mLightGreen_2 ( QColor( 0,255, 0) )
124-
, mGreen_2 ( QColor( 0,179, 0) )
125-
, mLightBlue_2 ( QColor( 0, 0,255) )
126-
, mBlue_2 ( QColor( 0, 0,128) )
127-
, mLightYellow_2 ( QColor(255,255, 0) )
128-
, mYellow_2 ( QColor(128,128, 0) )
129-
, mLightCyan_2 ( QColor( 0,255,255) )
130-
, mCyan_2 ( QColor( 0,128,128) )
131-
, mLightMagenta_2 ( QColor(255, 0,255) )
132-
, mMagenta_2 ( QColor(128, 0,128) )
133-
, mLightWhite_2 ( QColor(255,255,255) )
134-
, mWhite_2 ( QColor(192,192,192) )
135-
, mFgColor_2 ( QColor(192,192,192) )
136-
, mBgColor_2 ( QColor( 0, 0, 0) )
119+
, mBlack_2 ( QColor( 0, 0, 0, 255) )
120+
, mLightBlack_2 ( QColor(128,128,128, 255) )
121+
, mRed_2 ( QColor(128, 0, 0, 255) )
122+
, mLightRed_2 ( QColor(255, 0, 0, 255) )
123+
, mLightGreen_2 ( QColor( 0,255, 0, 255) )
124+
, mGreen_2 ( QColor( 0,179, 0, 255) )
125+
, mLightBlue_2 ( QColor( 0, 0, 255, 255) )
126+
, mBlue_2 ( QColor( 0, 0, 128, 255) )
127+
, mLightYellow_2 ( QColor(255,255, 0, 255) )
128+
, mYellow_2 ( QColor(128,128, 0, 255) )
129+
, mLightCyan_2 ( QColor( 0,255,255, 255) )
130+
, mCyan_2 ( QColor( 0,128,128, 255) )
131+
, mLightMagenta_2 ( QColor(255, 0,255, 255) )
132+
, mMagenta_2 ( QColor(128, 0,128, 255) )
133+
, mLightWhite_2 ( QColor(255,255,255, 255) )
134+
, mWhite_2 ( QColor(192,192,192, 255) )
135+
, mFgColor_2 ( QColor(192,192,192, 255) )
136+
, mBgColor_2 ( QColor( 0, 0, 0, 255) )
137137
{
138138
QString directoryLogFile = QDir::homePath()+"/.config/mudlet/profiles/";
139139
directoryLogFile.append(mHostName);
@@ -228,24 +228,24 @@ Host::Host()
228228
, mBgColor ( QColor( 0, 0, 0) )
229229
, mCommandBgColor ( QColor( 0, 0, 0) )
230230
, mCommandFgColor ( QColor(113,113, 0) )
231-
, mBlack_2 ( QColor( 0, 0, 0) )
232-
, mLightBlack_2 ( QColor(128,128,128) )
233-
, mRed_2 ( QColor(128, 0, 0) )
234-
, mLightRed_2 ( QColor(255, 0, 0) )
235-
, mLightGreen_2 ( QColor( 0,255, 0) )
236-
, mGreen_2 ( QColor( 0,179, 0) )
237-
, mLightBlue_2 ( QColor( 0, 0,255) )
238-
, mBlue_2 ( QColor( 0, 0,128) )
239-
, mLightYellow_2 ( QColor(255,255, 0) )
240-
, mYellow_2 ( QColor(128,128, 0) )
241-
, mLightCyan_2 ( QColor( 0,255,255) )
242-
, mCyan_2 ( QColor( 0,128,128) )
243-
, mLightMagenta_2 ( QColor(255, 0,255) )
244-
, mMagenta_2 ( QColor(128, 0,128) )
245-
, mLightWhite_2 ( QColor(255,255,255) )
246-
, mWhite_2 ( QColor(192,192,192) )
247-
, mFgColor_2 ( QColor(192,192,192) )
248-
, mBgColor_2 ( QColor( 0, 0, 0) )
231+
, mBlack_2 ( QColor( 0, 0, 0, 255) )
232+
, mLightBlack_2 ( QColor(128,128,128, 255) )
233+
, mRed_2 ( QColor(128, 0, 0, 255) )
234+
, mLightRed_2 ( QColor(255, 0, 0, 255) )
235+
, mLightGreen_2 ( QColor( 0,255, 0, 255) )
236+
, mGreen_2 ( QColor( 0,179, 0, 255) )
237+
, mLightBlue_2 ( QColor( 0, 0, 255, 255) )
238+
, mBlue_2 ( QColor( 0, 0, 128, 255) )
239+
, mLightYellow_2 ( QColor(255,255, 0, 255) )
240+
, mYellow_2 ( QColor(128,128, 0, 255) )
241+
, mLightCyan_2 ( QColor( 0,255,255, 255) )
242+
, mCyan_2 ( QColor( 0,128,128, 255) )
243+
, mLightMagenta_2 ( QColor(255, 0,255, 255) )
244+
, mMagenta_2 ( QColor(128, 0,128, 255) )
245+
, mLightWhite_2 ( QColor(255,255,255, 255) )
246+
, mWhite_2 ( QColor(192,192,192, 255) )
247+
, mFgColor_2 ( QColor(192,192,192, 255) )
248+
, mBgColor_2 ( QColor( 0, 0, 0, 255) )
249249
{
250250
QString directoryLogFile = QDir::homePath()+"/.config/mudlet/profiles/";
251251
directoryLogFile.append(mHostName);

src/T2DMap.cpp

Lines changed: 101 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "TRoom.h"
2727
#include "Host.h"
2828
#include "TConsole.h"
29+
#include <QPixmap>
2930

3031
T2DMap::T2DMap()
3132
{
@@ -54,10 +55,26 @@ T2DMap::T2DMap(QWidget * parent)
5455
mPHighlightMove = QPoint(width()/2, height()/2);
5556
mNewMoveAction = false;
5657
mFontHeight = 20;
58+
mShowRoomID = false;
59+
QFont f =QFont( QFont("Bitstream Vera Sans Mono", 20, QFont::Courier ) );//( QFont("Monospace", 10, QFont::Courier) );
60+
f.setPointSize(25);
61+
f.setBold(true);
62+
for( int i=33;i<255;i++ )
63+
{
64+
QPixmap b(26,26);
65+
b.fill(QColor(0,0,0,0));
66+
QPainter p(&b);
67+
p.setPen(QColor(0,0,0,255));
68+
p.setFont(f);
69+
QRect r(0,0,26,26);
70+
p.drawText(r, Qt::AlignHCenter|Qt::AlignVCenter, QChar(i) );
71+
mPixMap[i]=b;
72+
}
73+
5774

5875
}
5976

60-
QColor & T2DMap::getColor( int id )
77+
QColor T2DMap::getColor( int id )
6178
{
6279
QColor c;
6380

@@ -171,7 +188,7 @@ void T2DMap::paintEvent( QPaintEvent * e )
171188
mTY = ty;
172189

173190

174-
p.setRenderHint(QPainter::NonCosmeticDefaultPen);
191+
// p.setRenderHint(QPainter::NonCosmeticDefaultPen);
175192

176193
int px,py,pz;
177194
if( ! mpMap->rooms.contains( mpMap->mRoomId ) )
@@ -439,14 +456,31 @@ void T2DMap::paintEvent( QPaintEvent * e )
439456
}
440457
else
441458
{
442-
443459
mRoomSelection = pArea->rooms[i];
444-
qDebug()<<"SECTION:"<<mRoomSelection;
445-
446460
}
447461
}
448462
else
463+
{
449464
p.fillRect(dr,c);
465+
if( mShowRoomID )
466+
{
467+
QPen __pen = p.pen();
468+
QColor lc;
469+
if( c.red()+c.green()+c.blue() > 200 )
470+
lc=QColor(0,0,0);
471+
else
472+
lc=QColor(255,255,255);
473+
p.setPen(QPen(lc));
474+
p.drawText(dr, Qt::AlignHCenter|Qt::AlignVCenter,QString::number(pArea->rooms[i]));
475+
p.setPen(__pen);
476+
}
477+
char _ch = mpMap->rooms[pArea->rooms[i]]->c;
478+
if( _ch >= 33 && _ch < 255 )
479+
{
480+
QPixmap pix = mPixMap[_ch].scaled(dr.width(), dr.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
481+
p.drawPixmap(dr.topLeft(), pix);
482+
}
483+
}
450484

451485
QColor lc;
452486
if( c.red()+c.green()+c.blue() > 200 )
@@ -683,8 +717,22 @@ void T2DMap::slot_moveRoom()
683717

684718
void T2DMap::slot_deleteRoom()
685719
{
686-
if( mpHost->mpMap->rooms.contains(mRoomSelection) )
720+
if( mMultiSelection )
721+
{
722+
mMultiRect = QRect(0,0,0,0);
723+
for( int j=0; j<mMultiSelectionList.size(); j++ )
724+
{
725+
if( mpMap->rooms.contains( mMultiSelectionList[j] ) )
726+
{
727+
mpHost->mpMap->deleteRoom( mMultiSelectionList[j] );
728+
}
729+
}
730+
}
731+
else if( mpHost->mpMap->rooms.contains( mRoomSelection ) )
732+
{
687733
mpHost->mpMap->deleteRoom( mRoomSelection );
734+
}
735+
repaint();
688736
}
689737

690738
void T2DMap::slot_selectRoomColor(QListWidgetItem * pI )
@@ -700,6 +748,7 @@ void T2DMap::slot_defineNewColor()
700748
mpMap->customEnvColors[mpMap->customEnvColors.size()+257+16] = color;
701749
slot_changeColor();
702750
}
751+
repaint();
703752
}
704753

705754
void T2DMap::slot_changeColor()
@@ -774,9 +823,18 @@ void T2DMap::slot_addSpecialExit()
774823

775824
}
776825

826+
#include "dlgRoomExits.h"
777827
void T2DMap::slot_setExits()
778828
{
829+
// if( mMultiSelection ) return;
779830

831+
if( mpHost->mpMap->rooms.contains( mRoomSelection ) )
832+
{
833+
dlgRoomExits * pD = new dlgRoomExits( mpHost, this );
834+
pD->init( mRoomSelection );
835+
pD->show();
836+
pD->raise();
837+
}
780838
}
781839

782840

@@ -787,15 +845,49 @@ void T2DMap::slot_setUserData()
787845

788846
void T2DMap::slot_lockRoom()
789847
{
790-
if( mpHost->mpMap->rooms.contains( mRoomSelection ) )
848+
if( mMultiSelection )
849+
{
850+
mMultiRect = QRect(0,0,0,0);
851+
for( int j=0; j<mMultiSelectionList.size(); j++ )
852+
{
853+
if( mpMap->rooms.contains( mMultiSelectionList[j] ) )
854+
{
855+
mpMap->rooms[mMultiSelectionList[j]]->isLocked = true;
856+
}
857+
}
858+
}
859+
else if( mpHost->mpMap->rooms.contains( mRoomSelection ) )
860+
{
791861
mpHost->mpMap->rooms[mRoomSelection]->isLocked = true;
862+
}
792863
}
793864

865+
#include <QInputDialog>
794866
void T2DMap::slot_setRoomWeight()
795867
{
796-
if( mpHost->mpMap->rooms.contains(mRoomSelection) )
868+
869+
870+
if( mMultiSelection )
871+
{
872+
int w = QInputDialog::getInt(this,"Enter a room weight (= travel time)","room weight:", 1);
873+
mMultiRect = QRect(0,0,0,0);
874+
for( int j=0; j<mMultiSelectionList.size(); j++ )
875+
{
876+
if( mpMap->rooms.contains( mMultiSelectionList[j] ) )
877+
{
878+
mpMap->rooms[mMultiSelectionList[j]]->weight = w;
879+
}
880+
}
881+
repaint();
882+
}
883+
else
797884
{
798-
//mpHost->mpMap->rooms[mRoomSelection]->weight = w;
885+
if( mpHost->mpMap->rooms.contains(mRoomSelection) )
886+
{
887+
int _w = mpHost->mpMap->rooms[mRoomSelection]->weight;
888+
int w = QInputDialog::getInt(this, "Enter a room weight (= travel time)","room weight:",_w);
889+
mpHost->mpMap->rooms[mRoomSelection]->weight = w;
890+
}
799891
}
800892
}
801893

src/T2DMap.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <QWidget>
2525
#include <TMap.h>
26+
#include <QPixmap>
2627

2728
class T2DMap : public QWidget
2829
{
@@ -32,7 +33,7 @@ class T2DMap : public QWidget
3233

3334
T2DMap();
3435
explicit T2DMap( QWidget *parent = 0);
35-
QColor & getColor( int id );
36+
QColor getColor( int id );
3637
void paintEvent( QPaintEvent * );
3738
void mousePressEvent(QMouseEvent * );
3839
void mouseDoubleClickEvent ( QMouseEvent * event );
@@ -67,6 +68,8 @@ class T2DMap : public QWidget
6768
bool mNewMoveAction;
6869
QRectF mMapInfoRect;
6970
int mFontHeight;
71+
bool mShowRoomID;
72+
QMap<int,QPixmap> mPixMap;
7073

7174
signals:
7275

src/TCommandLine.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
#include "TTextEdit.h"
2424
#include <QPlainTextEdit>
2525
#include "TSplitter.h"
26-
#include "hunspell/hunspell.hxx"
26+
//#include "hunspell/hunspell.hxx"
2727

2828
TCommandLine::TCommandLine( Host * pHost, TConsole * pConsole, QWidget * parent )
2929
: QPlainTextEdit( parent )
3030
, mpHost( pHost )
3131
, mpConsole( pConsole )
3232
, mSelectedText( "" )
3333
, mSelectionStart( 0 )
34-
, mpHunspell( new Hunspell("en_US.aff", "en_US.dic") )
34+
//, mpHunspell( new Hunspell("en_US.aff", "en_US.dic") )
3535
{
3636
mpKeyUnit = mpHost->getKeyUnit();
3737
setAutoFillBackground(true);
@@ -390,34 +390,34 @@ void TCommandLine::adjustHeight()
390390

391391
void TCommandLine::spellCheck()
392392
{
393-
QTextCursor oldCursor = textCursor();
394-
QTextCharFormat f;
395-
QColor cred = QColor(255,0,0);
396-
f.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
397-
f.setUnderlineColor(cred);
398-
QTextCursor c = textCursor();
399-
c.movePosition(QTextCursor::Start);
400-
c.movePosition(QTextCursor::NextWord);
401-
//dont spell check first word as it's always an alias or mud command
402-
while( c.movePosition(QTextCursor::NextWord) )
403-
{
404-
c.select(QTextCursor::WordUnderCursor);
405-
if( ! mpHunspell->spell( c.selectedText().toLatin1().data()) )
406-
{
407-
f.setFontUnderline(true);
408-
c.setCharFormat(f);
409-
}
410-
else
411-
{
412-
f.setFontUnderline(false);
413-
c.setCharFormat(f);
414-
}
415-
}
416-
417-
f.setFontUnderline(false);
418-
c.setCharFormat(f);
419-
setTextCursor(c);
420-
setTextCursor(oldCursor);
393+
// QTextCursor oldCursor = textCursor();
394+
// QTextCharFormat f;
395+
// QColor cred = QColor(255,0,0);
396+
// f.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
397+
// f.setUnderlineColor(cred);
398+
// QTextCursor c = textCursor();
399+
// c.movePosition(QTextCursor::Start);
400+
// c.movePosition(QTextCursor::NextWord);
401+
// //dont spell check first word as it's always an alias or mud command
402+
// while( c.movePosition(QTextCursor::NextWord) )
403+
// {
404+
// c.select(QTextCursor::WordUnderCursor);
405+
// if( ! mpHunspell->spell( c.selectedText().toLatin1().data()) )
406+
// {
407+
// f.setFontUnderline(true);
408+
// c.setCharFormat(f);
409+
// }
410+
// else
411+
// {
412+
// f.setFontUnderline(false);
413+
// c.setCharFormat(f);
414+
// }
415+
// }
416+
417+
// f.setFontUnderline(false);
418+
// c.setCharFormat(f);
419+
// setTextCursor(c);
420+
// setTextCursor(oldCursor);
421421
}
422422

423423
void TCommandLine::enterCommand( QKeyEvent * event )

src/TCommandLine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "TCommandLine.h"
3232
#include "Host.h"
3333
#include <QPlainTextEdit>
34-
#include "hunspell/hunspell.hxx"
34+
//#include "hunspell/hunspell.hxx"
3535

3636
class TConsole;
3737
class KeyUnit;
@@ -79,7 +79,7 @@ class TCommandLine : public QPlainTextEdit//QLineEdit
7979
QString mSelectedText;
8080
int mSelectionStart;
8181
QString mTabCompletionOld;
82-
Hunspell * mpHunspell;
82+
// Hunspell * mpHunspell;
8383

8484
signals:
8585
void textChanged ( const QString & );

0 commit comments

Comments
 (0)