Skip to content

Commit

Permalink
add switches for autoready and message routing
Browse files Browse the repository at this point in the history
git-svn-id: http://qtlobby.googlecode.com/svn/trunk@588 5a83989a-60d1-11de-a6a3-193033c112f2
  • Loading branch information
[email protected] authored and [email protected] committed Sep 29, 2009
1 parent 68b095a commit a2328e6
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/BattleChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void BattleChannel::receiveCommand( Command command ) {
insertLine( flag( userName ) + line
.arg( "<span style=\"color:magenta;\">* %1 %2</span>" )
.arg( userName )
.arg( processInput(command.attributes.join( " " ), false)), true );
.arg( processInput(command.attributes.join( " " ), false)), Settings::Instance()->value("Chat/splitActionB").toBool() ? true : false );
} else if ( command.name == "FORCEQUITBATTLE" ) {
QMessageBox::critical(NULL, tr("Kicked from battle"), tr("You have been kicked from the battle!"));
battleWindowForm_ui->setEnabled(false);
Expand All @@ -266,21 +266,21 @@ void BattleChannel::receiveCommand( Command command ) {
insertLine( flag( userName ) + line
.arg( "<span style=\"color:darkgreen;\">** %1</span>" )
.arg( tr( "%2 joined the battle." ) )
.arg( userName ), true );
.arg( userName ), Settings::Instance()->value("Chat/splitJLB").toBool() ? true : false );
}
} else if ( command.name == "LEFTBATTLE" ) {
if ( command.attributes.takeFirst() == objectName() ) {
QString userName = command.attributes.takeFirst();
insertLine( flag( userName ) + line
.arg( "<span style=\"color:darkkhaki;\">** %1</span>" )
.arg( tr( "%1 left the battle." ) )
.arg( userName ), true );
.arg( userName ), Settings::Instance()->value("Chat/splitJLB").toBool() ? true : false );
}
} else if ( command.name == "JOINBATTLE" ) {} else if ( command.name == "CLIENTMSG" ) {
if ( command.attributes.takeFirst() == objectName() ) {
insertLine( line
.arg( "<span style=\"color:blue;\">** CLIENTMSG ** %1</span>" )
.arg( command.attributes.join( " " ) ), true );
.arg( command.attributes.join( " " ) ), Settings::Instance()->value("Chat/splitJLB").toBool() ? true : false );
}
} else if ( command.name == "BATTLECLOSED" ) {
if ( command.attributes.takeFirst() == objectName() ) {
Expand All @@ -295,7 +295,7 @@ void BattleChannel::receiveCommand( Command command ) {
if ( this->locked != locked ) {
insertLine( line
.arg( "<span style=\"color:blue;\">** %1</span>" )
.arg( locked ? tr( "Battle locked." ) : tr( "Battle unlocked." ) ), true );
.arg( locked ? tr( "Battle locked." ) : tr( "Battle unlocked." ) ), Settings::Instance()->value("Chat/splitChanB").toBool() ? true : false );
this->locked = locked;
QString table="<table><tr><td><img src=\"%1\"</td><td>%2</td></tr></table>";
if(locked)
Expand Down
9 changes: 6 additions & 3 deletions src/Battles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,12 @@ void Battles::startGame( Battle b, bool host ) {
scriptFile.close();
qDebug() << QString("Script file %1 written.").arg(springDir + "/script_qtlobby.txt");
User me = users->getUser(ServerProfilesModel::getInstance()->getActiveProfile().userName());
me.battleState.setReady(false);
users->modUserInAllManagers(me);
users->onMyBattleStateChanged( me );
if( Settings::Instance()->value("Battle/autoReady").toBool() == false )
{
me.battleState.setReady(false);
users->modUserInAllManagers(me);
users->onMyBattleStateChanged(me);
}
emit start();
}

Expand Down
14 changes: 7 additions & 7 deletions src/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Channel::receiveCommand( Command command ) {
insertLine( flag( userName ) + line
.arg( "<span style=\"color:magenta;\">* %1 %2</span>" )
.arg( userNameLink( userName ) )
.arg( processInput(command.attributes.join( " " ), false)));
.arg( processInput(command.attributes.join( " " ), false)), Settings::Instance()->value("Chat/splitAction").toBool() ? true : false);
}
}
} else if ( command.name == "JOINED" && (historyMode || showJoinLeave) ) {
Expand All @@ -56,28 +56,28 @@ void Channel::receiveCommand( Command command ) {
insertLine( flag( userName ) + line
.arg( "<span style=\"color:darkgreen;\">%1</span>" )
.arg( tr( "** %1 joined the channel." ) )
.arg( userNameLink( userName ) ), true );
.arg( userNameLink( userName ) ), Settings::Instance()->value("Chat/splitJL").toBool() ? true : false );
}
} else if ( command.name == "LEFT" && (historyMode || showJoinLeave)) {
if ( command.attributes.takeFirst() == objectName()) {
QString userName = command.attributes.takeFirst();
insertLine( flag( userName ) + line
.arg( "<span style=\"color:darkkhaki;\">** %1</span>" )
.arg( tr( "%1 left the channel." ) )
.arg( userNameLink( userName ) ), true );
.arg( userNameLink( userName ) ), Settings::Instance()->value("Chat/splitJL").toBool() ? true : false );
}
} else if ( command.name == "JOIN" ) {
if ( command.attributes.takeFirst() == objectName() ) {
insertLine( line
.arg( "<span style=\"color:darkgreen;\">** %1</span>" )
.arg( tr( "%1 joined the channel." ) )
.arg( myUserName ), true );
.arg( myUserName ), Settings::Instance()->value("Chat/splitJL").toBool() ? true : false );
}
} else if ( command.name == "CLIENTMSG" ) {
if ( command.attributes.takeFirst() == objectName() ) {
insertLine( line
.arg( "<span style=\"color:blue;\">** CLIENTMSG ** %1</span>" )
.arg( command.attributes.join( " " ) ), true );
.arg( command.attributes.join( " " ) ), Settings::Instance()->value("Chat/splitChan").toBool() ? true : false );
}
} else if ( command.name == "CHANNELTOPIC" ) {
if (command.attributes.takeFirst() == objectName()) {
Expand All @@ -94,7 +94,7 @@ void Channel::receiveCommand( Command command ) {
.arg(tr("Topic is ' %1 ' set by %2 %3"))
.arg( urlify(msg) )
.arg( name )
.arg( date.toString(tr("dd.MM.yyyy hh:mm")) ), true );
.arg( date.toString(tr("dd.MM.yyyy hh:mm")) ), Settings::Instance()->value("Chat/splitTopic").toBool() ? true : false );
}
} else if ( command.name == "CHANNELMESSAGE" ) {
if (command.attributes.takeFirst() == objectName()) {
Expand All @@ -103,7 +103,7 @@ void Channel::receiveCommand( Command command ) {

insertLine(line
.arg("<span style=\"color: #5673a4;\">** %1</span>")
.arg( processInput(msg) ), true );
.arg( processInput(msg) ), Settings::Instance()->value("Chat/splitChan").toBool() ? true : false );
}
} else if ( command.name == "MUTELISTBEGIN" ) {
if (command.attributes.takeFirst() == objectName()) {
Expand Down
28 changes: 26 additions & 2 deletions src/Preference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ void Preference::loadPreferences() {
joinQtlobbyCheckBox->setChecked(settings->value("Chat/joinQtlobby").toBool());
INIT_PREF("Chat/showFlags", true);
chatShowFlagsCheckBox->setChecked(settings->value("Chat/showFlags").toBool());
INIT_PREF("Chat/splitJL", true);
chatSplitJLCheckBox->setChecked(settings->value("Chat/splitJL").toBool());
INIT_PREF("Chat/splitTopic", true);
chatSplitTopicCheckBox->setChecked(settings->value("Chat/splitTopic").toBool());
INIT_PREF("Chat/splitAction", true);
chatSplitActionCheckBox->setChecked(settings->value("Chat/splitAction").toBool());
INIT_PREF("Chat/splitChan", true);
chatSplitChanCheckBox->setChecked(settings->value("Chat/splitChan").toBool());
INIT_PREF("Chat/splitJLB", false);
chatSplitJLBCheckBox->setChecked(settings->value("Chat/splitJLB").toBool());
INIT_PREF("Chat/splitActionB", false);
chatSplitActionBCheckBox->setChecked(settings->value("Chat/splitActionB").toBool());
INIT_PREF("Chat/splitChanB", false);
chatSplitChanBCheckBox->setChecked(settings->value("Chat/splitChanB").toBool());
INIT_PREF("Chat/highlightUserName", true);
chatHighlightUserNameCheckBox->setChecked(settings->value("Chat/highlightUserName").toBool());
INIT_PREF("Chat/popupNewPrivateChannel", false);
Expand Down Expand Up @@ -70,8 +84,10 @@ void Preference::loadPreferences() {
startRectAlphaSpinBox->setValue(settings->value("MapViewing/startPos/startRect/alpha").toInt());

/*General*/
INIT_PREF("Battle/autoCloseFirst", false);
battleAutoCloseFirstCheckBox->setChecked( settings->value("Battle/autoCloseFirst").toBool() );
INIT_PREF("Battle/autoReady", false);
battleReadyCheckBox->setChecked( settings->value("Battle/autoReady").toBool() );
INIT_PREF("Battle/autoReady", false);
battleReadyCheckBox->setChecked( settings->value("Battle/autoReady").toBool() );

/*Language*/
QString fullLocale = QLocale::system().name();
Expand Down Expand Up @@ -114,6 +130,13 @@ void Preference::onApply() {
settings->setValue("Chat/joinMain", joinMainCheckBox->isChecked());
settings->setValue("Chat/joinQtlobby", joinQtlobbyCheckBox->isChecked());
settings->setValue("Chat/showFlags", chatShowFlagsCheckBox->isChecked());
settings->setValue("Chat/splitJL", chatSplitJLCheckBox->isChecked());
settings->setValue("Chat/splitTopic", chatSplitTopicCheckBox->isChecked());
settings->setValue("Chat/splitAction", chatSplitActionCheckBox->isChecked());
settings->setValue("Chat/splitChan", chatSplitChanCheckBox->isChecked());
settings->setValue("Chat/splitJLB", chatSplitJLBCheckBox->isChecked());
settings->setValue("Chat/splitActionB", chatSplitActionBCheckBox->isChecked());
settings->setValue("Chat/splitChanB", chatSplitChanBCheckBox->isChecked());
settings->setValue("Chat/highlightUserName", chatHighlightUserNameCheckBox->isChecked());
settings->setValue("Chat/popupNewPrivateChannel", popupNewPrivateChannelCheckBox->isChecked());
settings->setValue("Chat/notifyNewPrivateMessages", notifyNewPrivateMessagesCheckBox->isChecked());
Expand All @@ -136,6 +159,7 @@ void Preference::onApply() {

/*General*/
settings->setValue( "Battle/autoCloseFirst", battleAutoCloseFirstCheckBox->isChecked() );
settings->setValue( "Battle/autoReady", battleReadyCheckBox->isChecked() );

/*Language*/
settings->setValue( "locale", languageComboBox->itemData( languageComboBox->currentIndex(), Qt::UserRole ).toString() );
Expand Down
93 changes: 85 additions & 8 deletions ui/PreferenceWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>609</width>
<height>440</height>
<height>526</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -67,7 +67,7 @@
</item>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer>
Expand Down Expand Up @@ -120,7 +120,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>7</number>
<number>5</number>
</property>
<widget class="QWidget" name="pathWidget"/>
<widget class="QWidget" name="chatWidget">
Expand Down Expand Up @@ -160,6 +160,16 @@
<string>Chat widget</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="chatHighlightUserNameCheckBox">
<property name="text">
<string>Highlight my username in Chat messages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatShowFlagsCheckBox">
<property name="text">
Expand All @@ -171,9 +181,69 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatHighlightUserNameCheckBox">
<widget class="QCheckBox" name="chatSplitTopicCheckBox">
<property name="text">
<string>Highlight my username in Chat messages</string>
<string>Split Topic from Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitChanCheckBox">
<property name="text">
<string>Split Channel-Messages from Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitJLCheckBox">
<property name="text">
<string>Split Join/Leave-Messages from Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitActionCheckBox">
<property name="text">
<string>Split &quot;/me&quot;-Actions from Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitChanBCheckBox">
<property name="text">
<string>Split Channel-Messages from Battle-Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitJLBCheckBox">
<property name="text">
<string>Split Join/Leave-Messages from Battle-Chat</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatSplitActionBCheckBox">
<property name="text">
<string>Split &quot;/me&quot;-Actions from Battle-Chat</string>
</property>
<property name="checked">
<bool>true</bool>
Expand Down Expand Up @@ -496,15 +566,22 @@ Large maps like Dworld or Nation can occupy up to 400 Mb of video card memory(if
<property name="title">
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QCheckBox" name="battleAutoCloseFirstCheckBox">
<property name="text">
<string>Always close the battle before opening new</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QCheckBox" name="battleReadyCheckBox">
<property name="text">
<string>Stay ready after a Game is played</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down

0 comments on commit a2328e6

Please sign in to comment.