Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoKoehn committed Jun 12, 2011
1 parent 7d78ea2 commit 3a029fb
Show file tree
Hide file tree
Showing 19 changed files with 413 additions and 323 deletions.
11 changes: 10 additions & 1 deletion src/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ Host::Host( int port, QString hostname, QString login, QString pass, int id )
, mUSE_UNIX_EOL( false )
, mWrapAt( 100 )
, mWrapIndentCount( 0 )

, mCommandLineBgColor( QColor( 0, 0, 0) )
, mCommandLineFgColor( QColor(128,128,128) )
, mBlack ( QColor( 0, 0, 0) )
, mLightBlack ( QColor(128,128,128) )
, mRed ( QColor(128, 0, 0) )
Expand Down Expand Up @@ -140,6 +141,9 @@ Host::Host( int port, QString hostname, QString login, QString pass, int id )
, mpUnzipDialog ( 0 )
, mRoomSize ( 0.5 )
, mLineSize ( 1.0 )
, mServerGUI_Package_version( -1 )
, mServerGUI_Package_name( "nothing" )
, mAcceptServerGUI ( true )
{
// mLogStatus = mudlet::self()->mAutolog;
QString directoryLogFile = QDir::homePath()+"/.config/mudlet/profiles/";
Expand Down Expand Up @@ -216,6 +220,8 @@ Host::Host()
, mUSE_UNIX_EOL( false )
, mWrapAt( 100 )
, mWrapIndentCount( 0 )
, mCommandLineBgColor( QColor( 0, 0, 0) )
, mCommandLineFgColor( QColor(128,128,128) )
, mBlack ( QColor( 0, 0, 0) )
, mLightBlack ( QColor(128,128,128) )
, mRed ( QColor(128, 0, 0) )
Expand Down Expand Up @@ -261,6 +267,9 @@ Host::Host()
, mRoomSize ( 0.5 )
, mLineSize ( 1.0 )
, mShowInfo ( true )
, mServerGUI_Package_version( -1 )
, mServerGUI_Package_name( "nothing" )
, mAcceptServerGUI ( true )
{

QString directoryLogFile = QDir::homePath()+"/.config/mudlet/profiles/";
Expand Down
3 changes: 3 additions & 0 deletions src/Host.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ class Host : public QObject
bool mShowInfo;
int mServerGUI_Package_version;
QString mServerGUI_Package_name;
bool mAcceptServerGUI;
QColor mCommandLineFgColor;
QColor mCommandLineBgColor;

private:
Host();
Expand Down
4 changes: 2 additions & 2 deletions src/TCommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ TCommandLine::TCommandLine( Host * pHost, TConsole * pConsole, QWidget * parent
QFont font = mpHost->mDisplayFont;
setFont(font);

mRegularPalette.setColor(QPalette::Text,QColor(0,0,192));
mRegularPalette.setColor(QPalette::Text, mpHost->mCommandLineFgColor );//QColor(0,0,192));
mRegularPalette.setColor(QPalette::Highlight,QColor(0,0,192));
mRegularPalette.setColor(QPalette::HighlightedText, QColor(255,255,255));
mRegularPalette.setColor(QPalette::Base,QColor(255,255,225));
mRegularPalette.setColor(QPalette::Base,mpHost->mCommandLineBgColor);//QColor(255,255,225));

setPalette( mRegularPalette );

Expand Down
3 changes: 2 additions & 1 deletion src/TCommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class TCommandLine : public QPlainTextEdit//QLineEdit
// void keyPressEvent(QKeyEvent *event);
void focusInEvent ( QFocusEvent * );
void focusOutEvent ( QFocusEvent * );
QPalette mRegularPalette;

private:
QString mLastCompletion;
Expand All @@ -72,7 +73,7 @@ class TCommandLine : public QPlainTextEdit//QLineEdit
QString mTabCompletionTyped;
QString mAutoCompletionTyped;
bool mUserKeptOnTyping;
QPalette mRegularPalette;

QPalette mTabCompletionPalette;
QPalette mAutoCompletionPalette;
KeyUnit * mpKeyUnit;
Expand Down
30 changes: 24 additions & 6 deletions src/TConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,16 @@ TConsole::TConsole( Host * pH, bool isDebugConsole, QWidget * parent )
mpBufferSearchBox->setMaximumSize(QSize(150,30));
mpBufferSearchBox->setSizePolicy( sizePolicy5 );
mpBufferSearchBox->setFont(mpHost->mCommandLineFont);
mpBufferSearchBox->setFocusPolicy( Qt::ClickFocus );
#if QT_VERSION >= 0x040700
mpBufferSearchBox->setPlaceholderText("search");
mpBufferSearchBox->setPlaceholderText("Search ...");
#endif
QPalette __pal;
__pal.setColor(QPalette::Text, mpHost->mCommandLineFgColor );//QColor(0,0,192));
__pal.setColor(QPalette::Highlight,QColor(0,0,192));
__pal.setColor(QPalette::HighlightedText, QColor(255,255,255));
__pal.setColor(QPalette::Base,mpHost->mCommandLineBgColor);//QColor(255,255,225));
mpBufferSearchBox->setPalette( __pal );
mpBufferSearchBox->setToolTip("Search buffer");
connect( mpBufferSearchBox, SIGNAL(returnPressed()), this, SLOT(slot_searchBufferUp()));

Expand All @@ -470,6 +477,7 @@ TConsole::TConsole( Host * pH, bool isDebugConsole, QWidget * parent )
mpBufferSearchUp->setSizePolicy( sizePolicy5 );
mpBufferSearchUp->setFocusPolicy( Qt::NoFocus );
mpBufferSearchUp->setToolTip("next result");
mpBufferSearchUp->setFocusPolicy( Qt::NoFocus );
QIcon icon34(":/icons/export.png");
mpBufferSearchUp->setIcon( icon34 );
connect( mpBufferSearchUp, SIGNAL(clicked()), this, SLOT(slot_searchBufferUp()));
Expand All @@ -480,6 +488,7 @@ TConsole::TConsole( Host * pH, bool isDebugConsole, QWidget * parent )
mpBufferSearchDown->setSizePolicy( sizePolicy5 );
mpBufferSearchDown->setFocusPolicy( Qt::NoFocus );
mpBufferSearchDown->setToolTip("next result");
mpBufferSearchDown->setFocusPolicy( Qt::NoFocus );
QIcon icon35(":/icons/import.png");
mpBufferSearchDown->setIcon( icon35 );
connect( mpBufferSearchDown, SIGNAL(clicked()), this, SLOT(slot_searchBufferDown()));
Expand Down Expand Up @@ -550,6 +559,13 @@ TConsole::TConsole( Host * pH, bool isDebugConsole, QWidget * parent )
buttonLayer->setMaximumWidth(400);
buttonMainLayer->setMinimumWidth(400);
buttonMainLayer->setMaximumWidth(400);
setFocusPolicy(Qt::ClickFocus);
setFocusProxy(mpCommandLine);
console->setFocusPolicy(Qt::ClickFocus);
console->setFocusProxy(mpCommandLine);
console2->setFocusPolicy(Qt::ClickFocus);
console2->setFocusProxy(mpCommandLine);

}

void TConsole::setLabelStyleSheet( std::string & buf, std::string & sh )
Expand Down Expand Up @@ -875,15 +891,10 @@ void TConsole::slot_toggleReplayRecording()

void TConsole::changeColors()
{
qDebug()<<"TConsole::changeColors()";
mDisplayFont.setFixedPitch(true);
//mDisplayFont.setWordSpacing( 0 );
// mDisplayFont.setLetterSpacing( QFont::AbsoluteSpacing, 0 );
if( mIsDebugConsole )
{
mDisplayFont.setStyleStrategy( (QFont::StyleStrategy)(QFont::NoAntialias | QFont::PreferQuality) );
//mDisplayFont.setWordSpacing( 0 );

mDisplayFont.setFixedPitch(true);
console->setFont( mDisplayFont );
console2->setFont( mDisplayFont );
Expand Down Expand Up @@ -928,6 +939,13 @@ void TConsole::changeColors()
}
else
{
QPalette pal;
pal.setColor(QPalette::Text, mpHost->mCommandLineFgColor );//QColor(0,0,192));
pal.setColor(QPalette::Highlight,QColor(0,0,192));
pal.setColor(QPalette::HighlightedText, QColor(255,255,255));
pal.setColor(QPalette::Base,mpHost->mCommandLineBgColor);//QColor(255,255,225));
mpCommandLine->setPalette( pal );
mpCommandLine->mRegularPalette = pal;
if( mpHost->mNoAntiAlias )
mpHost->mDisplayFont.setStyleStrategy( QFont::NoAntialias );
else
Expand Down
10 changes: 6 additions & 4 deletions src/TLuaInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3255,7 +3255,7 @@ int TLuaInterpreter::showUnzipProgress( lua_State * L )
return 0;
}

#ifdef QT_OS_LINUX
#ifdef Q_OS_LINUX
#include <phonon>
#else
#include <Phonon>
Expand Down Expand Up @@ -7582,8 +7582,9 @@ void TLuaInterpreter::startLuaSessionInterpreter()
mpLuaSessionThread->start(); //calls initLuaGlobals() to initialize the interpreter for this session
}


#include "luazip.c"
#ifdef QT_OS_MAC
#include "luazip.c"
#endif

// this function initializes the Lua Session interpreter.
// on initialization of a new session *or* in case of an interpreter reset by the user.
Expand Down Expand Up @@ -7803,9 +7804,10 @@ void TLuaInterpreter::initLuaGlobals()
luaopen_yajl(pGlobalLua);
lua_setglobal( pGlobalLua, "yajl" );

#ifdef QT_OS_MAC
luaopen_zip( pGlobalLua );
lua_setglobal( pGlobalLua, "zip" );

#endif
QString n;
int error;

Expand Down
4 changes: 3 additions & 1 deletion src/XMLexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool XMLexport::writeHost( Host * pT )
writeAttribute( "mLogStatus", pT->mLogStatus ? "yes" : "no" );
writeAttribute( "mEnableSpellCheck", pT->mEnableSpellCheck ? "yes" : "no" );
writeAttribute( "mShowInfo", pT->mShowInfo ? "yes" : "no" );

writeAttribute( "mAcceptServerGUI", pT->mAcceptServerGUI ? "yes" : "no" );

writeTextElement( "name", pT->mHostName );
//writeTextElement( "login", pT->mLogin );
Expand All @@ -145,6 +145,8 @@ bool XMLexport::writeHost( Host * pT )
writeTextElement( "mBgColor", pT->mBgColor.name() );
writeTextElement( "mCommandFgColor", pT->mCommandFgColor.name() );
writeTextElement( "mCommandBgColor", pT->mCommandBgColor.name() );
writeTextElement( "mCommandLineFgColor", pT->mCommandLineFgColor.name() );
writeTextElement( "mCommandLineBgColor", pT->mCommandLineBgColor.name() );
writeTextElement( "mBlack", pT->mBlack.name() );
writeTextElement( "mLightBlack", pT->mLightBlack.name() );
writeTextElement( "mRed", pT->mRed.name() );
Expand Down
12 changes: 11 additions & 1 deletion src/XMLimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void XMLimport::readHostPackage( Host * pT )
pT->mLogStatus = ( attributes().value("mLogStatus") == "yes" );
pT->mEnableSpellCheck = ( attributes().value("mEnableSpellCheck") == "yes" );
pT->mShowInfo = ( attributes().value("mShowInfo") == "yes" );

pT->mAcceptServerGUI = ( attributes().value("mAcceptServerGUI") == "yes" );
while( ! atEnd() )
{
readNext();
Expand Down Expand Up @@ -738,6 +738,16 @@ void XMLimport::readHostPackage( Host * pT )
pT->mCommandSeparator = readElementText();
continue;
}
else if( name() == "mCommandLineFgColor")
{
pT->mCommandLineFgColor.setNamedColor( readElementText() );
continue;
}
else if( name() == "mCommandLineBgColor")
{
pT->mCommandLineBgColor.setNamedColor( readElementText() );
continue;
}
else if( name() == "mFgColor")
{
pT->mFgColor.setNamedColor( readElementText() );
Expand Down
6 changes: 6 additions & 0 deletions src/ctelnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,10 +736,16 @@ void cTelnet::processTelnetCommand( const string & command )

if( _m.startsWith( "Client.GUI" ) )
{
if( ! mpHost->mAcceptServerGUI ) return;

QString version = _m.section( '\n', 0 );
version.replace("Client.GUI ", "");
version.replace('\n', " ");
version = version.section(' ', 0, 0);

int newVersion = version.toInt();
//QString __mkp = QString("<old version:'%1' new version:'%2' name:'%3' msg:'%4'>\n").arg(mpHost->mServerGUI_Package_version).arg(newVersion).arg(mpHost->mServerGUI_Package_name).arg(version);
//mpHost->mpConsole->print(__mkp);
if( mpHost->mServerGUI_Package_version != newVersion )
{
QString _smsg = QString("<The server wants to upgrade the GUI to new version '%1'. Uninstalling old version '%2'>").arg(mpHost->mServerGUI_Package_version).arg(newVersion);
Expand Down
54 changes: 54 additions & 0 deletions src/dlgProfilePreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dlgProfilePreferences::dlgProfilePreferences( QWidget * pF, Host * pH )
// init generated dialog
setupUi(this);

acceptServerGUI->setChecked(mpHost->mAcceptServerGUI);
QString nick = tr("Mudlet%1").arg(QString::number(rand()%10000));
QFile file( QDir::homePath()+"/.config/mudlet/irc_nick" );
file.open( QIODevice::ReadOnly );
Expand Down Expand Up @@ -77,6 +78,19 @@ dlgProfilePreferences::dlgProfilePreferences( QWidget * pF, Host * pH )
QPalette palette;
QString styleSheet;
QColor color;

color = mpHost->mCommandLineFgColor;
palette.setColor( QPalette::Button, color );
styleSheet = QString("QPushButton{background-color:")+color.name()+QString(";}");
pushButton_command_line_foreground_color->setStyleSheet( styleSheet );
connect(pushButton_command_line_foreground_color, SIGNAL(clicked()), this, SLOT(setCommandLineFgColor()));

color = mpHost->mCommandLineBgColor;
palette.setColor( QPalette::Button, color );
styleSheet = QString("QPushButton{background-color:")+color.name()+QString(";}");
pushButton_command_line_background_color->setStyleSheet( styleSheet );
connect(pushButton_command_line_background_color, SIGNAL(clicked()), this, SLOT(setCommandLineBgColor()));

color = mpHost->mBlack;
palette.setColor( QPalette::Button, color );
styleSheet = QString("QPushButton{background-color:")+color.name()+QString(";}");
Expand Down Expand Up @@ -611,6 +625,45 @@ void dlgProfilePreferences::setCommandFgColor()
pushButton_command_foreground_color->setStyleSheet( styleSheet );
}
}

void dlgProfilePreferences::setCommandLineFgColor()
{
Host * pHost = mpHost;
if( ! pHost ) return;
QColor color = QColorDialog::getColor( pHost->mCommandLineFgColor, this );
if ( color.isValid() )
{
QPalette palette;
palette.setColor( QPalette::Button, color );
pushButton_command_line_foreground_color->setPalette( palette );
pHost->mCommandLineFgColor = color;
if( mudlet::self()->mConsoleMap.contains( pHost ) ) mudlet::self()->mConsoleMap[pHost]->changeColors();
color = mpHost->mCommandLineFgColor;
palette.setColor( QPalette::Button, color );
QString styleSheet = QString("QPushButton{background-color:")+color.name()+QString(";}");
pushButton_command_line_foreground_color->setStyleSheet( styleSheet );
}
}

void dlgProfilePreferences::setCommandLineBgColor()
{
Host * pHost = mpHost;
if( ! pHost ) return;
QColor color = QColorDialog::getColor( pHost->mCommandLineBgColor, this );
if ( color.isValid() )
{
QPalette palette;
palette.setColor( QPalette::Button, color );
pushButton_command_line_background_color->setPalette( palette );
pHost->mCommandLineBgColor = color;
if( mudlet::self()->mConsoleMap.contains( pHost ) ) mudlet::self()->mConsoleMap[pHost]->changeColors();
color = mpHost->mCommandLineBgColor;
palette.setColor( QPalette::Button, color );
QString styleSheet = QString("QPushButton{background-color:")+color.name()+QString(";}");
pushButton_command_line_background_color->setStyleSheet( styleSheet );
}
}

void dlgProfilePreferences::setCommandBgColor()
{
Host * pHost = mpHost;
Expand Down Expand Up @@ -1246,6 +1299,7 @@ void dlgProfilePreferences::slot_save_and_exit()
pHost->mPrintCommand = show_sent_text_checkbox->isChecked();
pHost->mAutoClearCommandLineAfterSend = auto_clear_input_line_checkbox->isChecked();
pHost->mCommandSeparator = command_separator_lineedit->text();
pHost->mAcceptServerGUI = acceptServerGUI->isChecked();
//pHost->mDisableAutoCompletion = disable_auto_completion_checkbox->isChecked();
pHost->mUSE_IRE_DRIVER_BUGFIX = checkBox_USE_IRE_DRIVER_BUGFIX->isChecked();
pHost->set_USE_IRE_DRIVER_BUGFIX( checkBox_USE_IRE_DRIVER_BUGFIX->isChecked() );
Expand Down
2 changes: 2 additions & 0 deletions src/dlgProfilePreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public slots:
void setCommandLineFont();
void setFgColor();
void setBgColor();
void setCommandLineBgColor();
void setCommandLineFgColor();

void setCommandFgColor();
void setCommandBgColor();
Expand Down
2 changes: 1 addition & 1 deletion src/mudlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <QMdiArea>
#include "TConsole.h"
#include "ui_main_window.h"
#ifdef QT_OS_LINUX
#ifdef Q_OS_LINUX
#include <phonon>
#else
#include <Phonon>
Expand Down
10 changes: 4 additions & 6 deletions src/ui/about_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../mudlet_alpha.qrc">:/Mudlet_splashscreen_main</pixmap>
<pixmap>:/Mudlet_splashscreen_main</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
Expand Down Expand Up @@ -542,7 +542,7 @@
</palette>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
Expand Down Expand Up @@ -641,7 +641,7 @@ p, li { white-space: pre-wrap; }
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:600; text-decoration: underline; color:#005500;&quot;&gt;Mudlet 2.0-dev built: January 19, 2011&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:600; text-decoration: underline; color:#005500;&quot;&gt;Mudlet 2.0 June 12, 2011&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans'; font-size:10pt; font-weight:600; text-decoration: underline; color:#005500;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:600; color:#000000;&quot;&gt;homepage and forum at: &lt;/span&gt;&lt;a href=&quot;http://mudlet.sourceforge.net&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;mudlet.sourceforge.net&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:600; color:#000000;&quot;&gt;latest version can be found at:&lt;/span&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:600; color:#00007f;&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://mudlet.sourceforge.net&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt; text-decoration: underline; color:#0000ff;&quot;&gt;mudlet.sourceforge.net&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:600; color:#00007f;&quot;&gt;/&lt;/span&gt;&lt;/p&gt;
Expand Down Expand Up @@ -739,8 +739,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<resources>
<include location="../mudlet_alpha.qrc"/>
</resources>
<resources/>
<connections/>
</ui>
5 changes: 0 additions & 5 deletions src/ui/actions_main_area.ui
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string>Command on Button Up:</string>
</property>
Expand Down
Loading

0 comments on commit 3a029fb

Please sign in to comment.