Commit 6e5f4d1f authored by Gavin Bises's avatar Gavin Bises
Browse files

Merge remote-tracking branch 'origin/master' into jo-remove-name-filters-from-settings

parents 763d8a79 78aa2917
......@@ -16,7 +16,7 @@ InstallDir "$PROGRAMFILES\Cockatrice"
!define MUI_HEADERIMAGE_UNBITMAP "${NSIS_SOURCE_PATH}\cmake\headerimage.bmp"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of Cockatrice.$\r$\n$\r$\nClick Next to continue."
!define MUI_FINISHPAGE_RUN "$INSTDIR/oracle.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run card database downloader now"
!define MUI_FINISHPAGE_RUN_TEXT "Run 'Oracle' now to update your card database"
!define MUI_FINISHPAGE_RUN_PARAMETERS "-dlsets"
!insertmacro MUI_PAGE_WELCOME
......
......@@ -31,12 +31,14 @@
<file>resources/icon_view.svg</file>
<file>resources/hr.jpg</file>
<file alias="resources/appicon.svg">resources/cockatrice.svg</file>
<file>resources/add_to_sideboard.svg</file>
<file>resources/decrement.svg</file>
<file>resources/increment.svg</file>
<file>resources/remove_row.svg</file>
<file>resources/arrow_left_green.svg</file>
<file>resources/arrow_right_green.svg</file>
<file>resources/icon_ready_start.svg</file>
<file>resources/icon_not_ready_start.svg</file>
<file>resources/icon_conceded.svg</file>
......@@ -320,8 +322,11 @@
<file>resources/userlevels/normal.svg</file>
<file>resources/userlevels/registered.svg</file>
<file>resources/userlevels/registered_buddy.svg</file>
<file>resources/userlevels/moderator.svg</file>
<file>resources/userlevels/moderator_buddy.svg</file>
<file>resources/userlevels/admin.svg</file>
<file>resources/userlevels/admin_buddy.svg</file>
<file>resources/news/exclamation_mark.svg</file>
<file>resources/news/question_mark.svg</file>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
......@@ -13,9 +14,9 @@
height="64"
id="svg2646"
sodipodi:version="0.32"
inkscape:version="0.46"
inkscape:version="0.48.5 r10040"
version="1.0"
sodipodi:docname="decrement.svg"
sodipodi:docname="deck_editor_decrement.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs2648">
......@@ -161,15 +162,16 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.625"
inkscape:cx="-58.636066"
inkscape:cy="34.091284"
inkscape:cx="26.34754"
inkscape:cy="29.107677"
inkscape:document-units="px"
inkscape:current-layer="layer2"
showgrid="false"
inkscape:window-width="1272"
inkscape:window-height="723"
inkscape:window-width="1445"
inkscape:window-height="893"
inkscape:window-x="0"
inkscape:window-y="25" />
inkscape:window-y="25"
inkscape:window-maximized="0" />
<metadata
id="metadata2651">
<rdf:RDF>
......@@ -192,7 +194,7 @@
inkscape:label="Pfeil"
style="display:inline">
<rect
style="fill:#96ff96;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
style="fill:#ff7672;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
id="rect3548"
width="14.386732"
height="59.259636"
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
......@@ -13,9 +14,9 @@
height="64"
id="svg2646"
sodipodi:version="0.32"
inkscape:version="0.46"
inkscape:version="0.48.5 r10040"
version="1.0"
sodipodi:docname="remove_row.svg"
sodipodi:docname="deck_editor_remove_row.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs2648">
......@@ -316,15 +317,16 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.625"
inkscape:cx="-50.74814"
inkscape:cy="31.784541"
inkscape:cx="-27.27273"
inkscape:cy="30.210771"
inkscape:document-units="px"
inkscape:current-layer="layer2"
showgrid="false"
inkscape:window-width="1272"
inkscape:window-height="723"
inkscape:window-x="0"
inkscape:window-y="25" />
inkscape:window-y="25"
inkscape:window-maximized="0" />
<metadata
id="metadata2651">
<rdf:RDF>
......@@ -347,7 +349,7 @@
inkscape:label="Pfeil"
style="display:inline">
<path
style="fill:#96ff96;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
style="fill:#ff7672;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline"
d="M 6.433227,14.50946 L 23.923767,32 L 6.433227,49.490541 L 14.50946,57.566773 L 32,40.076233 L 49.490541,57.566773 L 57.566773,49.490541 L 40.076233,32 L 57.566773,14.50946 L 49.490541,6.433227 L 32,23.923767 L 14.50946,6.433227 L 6.433227,14.50946 z"
id="rect3548" />
</g>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 64 64"
enable-background="new 0 0 64 64"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
width="100%"
height="100%"
sodipodi:docname="admin_buddy.svg">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10">
<linearGradient
id="linearGradient5225">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5227" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop5229" />
</linearGradient>
<linearGradient
id="linearGradient5219"
osb:paint="solid">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5221" />
</linearGradient>
<linearGradient
id="linearGradient3758">
<stop
id="stop3760"
offset="0"
style="stop-color:#0fbb00;stop-opacity:1;" />
<stop
id="stop3762"
offset="1"
style="stop-color:#064400;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3750">
<stop
style="stop-color:#ece400;stop-opacity:1;"
offset="0"
id="stop3752" />
<stop
style="stop-color:#ece400;stop-opacity:0;"
offset="1"
id="stop3754" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3758-7"
id="linearGradient3756-1"
x1="1.960216"
y1="31.261461"
x2="60.456024"
y2="31.261461"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3758-7">
<stop
id="stop3760-4"
offset="0"
style="stop-color:#ece400;stop-opacity:1;" />
<stop
id="stop3762-0"
offset="1"
style="stop-color:#ec8b00;stop-opacity:1;" />
</linearGradient>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1028"
id="namedview8"
showgrid="false"
inkscape:zoom="5.2149125"
inkscape:cx="21.988178"
inkscape:cy="51.245759"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<path
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
id="path4-9"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
id="path4"
style="fill:#ff0000;fill-opacity:1;fill-rule:nonzero"
inkscape:connector-curvature="0" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 64 64"
enable-background="new 0 0 64 64"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
width="100%"
height="100%"
sodipodi:docname="registered_buddy - Copy.svg">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10">
<pattern
inkscape:stockid="Stripes 1:1 white"
id="Strips1_1white"
patternTransform="translate(0,0) scale(10,10)"
height="1"
width="2"
patternUnits="userSpaceOnUse"
inkscape:collect="always">
<rect
id="rect4484"
height="2"
width="1"
y="-0.5"
x="0"
style="fill:white;stroke:none" />
</pattern>
<linearGradient
id="linearGradient5225">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5227" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop5229" />
</linearGradient>
<linearGradient
id="linearGradient5219"
osb:paint="solid">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5221" />
</linearGradient>
<linearGradient
id="linearGradient3758">
<stop
id="stop3760"
offset="0"
style="stop-color:#0fbb00;stop-opacity:1;" />
<stop
id="stop3762"
offset="1"
style="stop-color:#064400;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3750">
<stop
style="stop-color:#ece400;stop-opacity:1;"
offset="0"
id="stop3752" />
<stop
style="stop-color:#ece400;stop-opacity:0;"
offset="1"
id="stop3754" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3758-7"
id="linearGradient3756-1"
x1="1.960216"
y1="31.261461"
x2="60.456024"
y2="31.261461"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3758-7">
<stop
id="stop3760-4"
offset="0"
style="stop-color:#ece400;stop-opacity:1;" />
<stop
id="stop3762-0"
offset="1"
style="stop-color:#ec8b00;stop-opacity:1;" />
</linearGradient>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1028"
id="namedview8"
showgrid="false"
inkscape:zoom="5.2149125"
inkscape:cx="51.90239"
inkscape:cy="51.245759"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<path
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
id="path4-9"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
id="path4"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero"
inkscape:connector-curvature="0" />
<path
d="M 57.165891,25.072777 37.520125,24.981707 31.537924,5.1008868 c 0.05101,40.5880862 0.05344,-0.1118618 0,40.5561512 L 49.290236,59.413412 41.216824,37.764038 z"
id="path4-1"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 64 64"
enable-background="new 0 0 64 64"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
width="100%"
height="100%"
sodipodi:docname="buddy_icon.svg">
<metadata
id="metadata12">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs10">
<linearGradient
id="linearGradient3758">
<stop
id="stop3760"
offset="0"
style="stop-color:#0fbb00;stop-opacity:1;" />
<stop
id="stop3762"
offset="1"
style="stop-color:#064400;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient3750">
<stop
style="stop-color:#ece400;stop-opacity:1;"
offset="0"
id="stop3752" />
<stop
style="stop-color:#ece400;stop-opacity:0;"
offset="1"
id="stop3754" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3758"
id="linearGradient3756"
x1="1.960216"
y1="31.261461"
x2="60.456024"
y2="31.261461"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.87626222,0,0,0.87626222,4.174756,4.8555263)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3758-7"
id="linearGradient3756-1"
x1="1.960216"
y1="31.261461"
x2="60.456024"
y2="31.261461"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient3758-7">
<stop
id="stop3760-4"
offset="0"
style="stop-color:#ece400;stop-opacity:1;" />
<stop
id="stop3762-0"
offset="1"
style="stop-color:#ec8b00;stop-opacity:1;" />
</linearGradient>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="1178"
id="namedview8"
showgrid="false"
inkscape:zoom="7.375"
inkscape:cx="-14.986549"
inkscape:cy="23.31428"
inkscape:window-x="1912"
inkscape:window-y="227"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<path
d="M 61.442826,23.621762 38.532402,23.515555 31.556101,0.331013 24.578789,23.515555 1.6673502,23.621765 20.267785,38.422001 10.863888,63.668987 31.556101,47.626631 52.258426,63.668987 42.843404,38.422001 z"
id="path4-9"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
d="M 57.150089,25.064396 37.504323,24.973324 31.522122,5.092503 25.539054,24.973324 5.8924192,25.064399 21.842354,37.75565 13.778482,59.405024 31.522122,45.64865 49.274434,59.405024 41.201022,37.75565 z"
id="path4"
style="fill:url(#linearGradient3756);fill-opacity:1"
inkscape:connector-curvature="0" />
</svg>
......@@ -365,6 +365,7 @@ CardInfo::CardInfo(CardDatabase *_db,
const QString &_name,
bool _isToken,
const QString &_manacost,
const QString &_cmc,
const QString &_cardtype,
const QString &_powtough,
const QString &_text,
......@@ -381,6 +382,7 @@ CardInfo::CardInfo(CardDatabase *_db,
isToken(_isToken),
sets(_sets),
manacost(_manacost),
cmc(_cmc),
cardtype(_cardtype),
powtough(_powtough),
text(_text),
......@@ -571,6 +573,7 @@ static QXmlStreamWriter &operator<<(QXmlStreamWriter &xml, const CardInfo *info)
xml.writeTextElement("color", colors[i]);
xml.writeTextElement("manacost", info->getManaCost());
xml.writeTextElement("cmc", info->getCmc());
xml.writeTextElement("type", info->getCardType());
if (!info->getPowTough().isEmpty())
xml.writeTextElement("pt", info->getPowTough());
......@@ -731,7 +734,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
if (xml.readNext() == QXmlStreamReader::EndElement)
break;
if (xml.name() == "card") {
QString name, manacost, type, pt, text;
QString name, manacost, cmc, type, pt, text;
QStringList colors;
QStringMap customPicURLs, customPicURLsHq;
MuidMap muids;
......@@ -747,6 +750,8 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
name = xml.readElementText();
else if (xml.name() == "manacost")
manacost = xml.readElementText();
else if (xml.name() == "cmc")
cmc = xml.readElementText();
else if (xml.name() == "type")
type = xml.readElementText();
else if (xml.name() == "pt")
......@@ -779,7 +784,7 @@ void CardDatabase::loadCardsFromXml(QXmlStreamReader &xml, bool tokens)
}
if (isToken == tokens) {
addCard(new CardInfo(this, name, isToken, manacost, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
addCard(new CardInfo(this, name, isToken, manacost, cmc, type, pt, text, colors, loyalty, cipt, tableRow, sets, customPicURLs, customPicURLsHq, muids));
}
}
}
......
......@@ -111,6 +111,7 @@ private:
bool isToken;
SetList sets;
QString manacost;
QString cmc;
QString cardtype;
QString powtough;
QString text;
......@@ -126,6 +127,7 @@ public:
const QString &_name = QString(),
bool _isToken = false,
const QString &_manacost = QString(),
const QString &_cmc = QString(),
const QString &_cardtype = QString(),
const QString &_powtough = QString(),
const QString &_text = QString(),
......@@ -142,12 +144,14 @@ public:
bool getIsToken() const { return isToken; }
const SetList &getSets() const { return sets; }
const QString &getManaCost() const { return manacost; }
const QString &getCmc() const { return cmc; }
const QString &getCardType() const { return cardtype; }
const QString &getPowTough() const { return powtough; }
const QString &getText() const { return text; }
const int &getLoyalty() const { return loyalty; }
bool getCipt() const { return cipt; }
void setManaCost(const QString &_manaCost) { manacost = _manaCost; emit cardInfoChanged(this); }
void setCmc(const QString &_cmc) { cmc = _cmc; emit cardInfoChanged(this); }
void setCardType(const QString &_cardType) { cardtype = _cardType; emit cardInfoChanged(this); }
void setPowTough(const QString &_powTough) { powtough = _powTough; emit cardInfoChanged(this); }
void setText(const QString &_text) { text = _text; emit cardInfoChanged(this); }
......
......@@ -31,6 +31,8 @@ const char *CardFilter::attrName(Attr a)
return "set";
case AttrManaCost:
return "mana cost";
case AttrCmc:
return "cmc";
default:
return "";
}
......
......@@ -22,6 +22,7 @@ public:
AttrText,
AttrSet,
AttrManaCost,
AttrCmc,
AttrEnd
};
......
......@@ -3,6 +3,8 @@
#include <QScrollBar>
#include <QMouseEvent>
#include <QDesktopServices>
#include <QApplication>
#include <QDebug>
#include "chatview.h"
#include "user_level.h"
#include "user_context_menu.h"
......@@ -11,7 +13,7 @@
#include "main.h"
#include "tab_userlists.h"
const QColor MENTION_COLOR = QColor(190, 25, 85); // maroon
const QColor DEFAULT_MENTION_COLOR = QColor(194, 31, 47);
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
......@@ -25,8 +27,6 @@ ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _sh
mention = "@" + userName.toLower();
mentionFormat.setFontWeight(QFont::Bold);
mentionFormat.setForeground(QBrush(Qt::white));
mentionFormat.setBackground(QBrush(MENTION_COLOR));
mentionFormatOtherUser.setFontWeight(QFont::Bold);
mentionFormatOtherUser.setForeground(Qt::blue);
......@@ -117,8 +117,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
QTextCharFormat senderFormat;
if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) {
senderFormat.setForeground(QBrush(getCustomMentionColor()));
senderFormat.setFontWeight(QFont::Bold);
senderFormat.setForeground(QBrush(MENTION_COLOR));
} else {
senderFormat.setForeground(QBrush(OTHER_USER_COLOR));
if (playerBold)
......@@ -129,7 +129,8 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
if (!sameSender) {
if (!sender.isEmpty()) {
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel).toImage(), QString::number(pixelSize) + "_" + QString::number((int) userLevel));
QMap<QString, UserListTWI *> buddyList = tabSupervisor->getUserListsTab()->getBuddyList()->getUsers();
cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, buddyList.contains(sender)).toImage());
cursor.insertText(" ");
}
cursor.setCharFormat(senderFormat);
......@@ -194,12 +195,15 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
break;
// you have been mentioned
if (message.toLower().startsWith(mention)) {
mentionFormat.setBackground(QBrush(getCustomMentionColor()));
mentionFormat.setForeground(settingsCache->getChatMentionForeground() ? QBrush(Qt::white):QBrush(Qt::black));
cursor.insertText("@" + userName, mentionFormat);
message = message.mid(mention.size());
QApplication::alert(this);
}
// another user has been mentioned
else {
int mentionEndIndex = message.indexOf(" ");
int mentionEndIndex = message.indexOf(QRegExp("\\W"), 1);// from 1 as @ is non-char
if (mentionEndIndex == -1)
mentionEndIndex = message.size(); // there is no text after the mention
QString userMention = message.left(mentionEndIndex);
......@@ -225,6 +229,12 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
}
QColor ChatView::getCustomMentionColor() {
QColor customColor;
customColor.setNamedColor("#" + settingsCache->getChatMentionColor());
return customColor.isValid() ? customColor : DEFAULT_MENTION_COLOR;
}
/**
Returns the correct case version of the provided username, if no correct casing version
was found then the provided name is not available and will return an empty QString.
......
......@@ -37,6 +37,7 @@ private:
void appendCardTag(QTextCursor &cursor, const QString &cardName);
void appendUrlTag(QTextCursor &cursor, QString url);
QString getNameFromUserList(QMap<QString, UserListTWI *> &userList, QString &userName);
QColor getCustomMentionColor();
private slots:
void openLink(const QUrl &link);
public:
......
......@@ -32,7 +32,7 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
QString data(reply->readAll());
reply->deleteLater();
QRegExp rx("id=\"deckstats_deck_url\" value=\"([^\"]+)\"");
QRegExp rx("<meta property=\"og:url\" content=\"([^\"]+)\"/>");
if (!rx.indexIn(data)) {
QMessageBox::critical(0, tr("Error"), tr("The reply from the server could not be parsed."));
deleteLater();
......@@ -53,11 +53,13 @@ void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
#if QT_VERSION < 0x050000
QUrl params;
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
params.addQueryItem("decktitle", deck->getName());
data->append(params.encodedQuery());
#else
QUrl params;
QUrlQuery urlQuery;
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
urlQuery.addQueryItem("decktitle", deck->getName());
params.setQuery(urlQuery);
data->append(params.query(QUrl::EncodeReserved));
#endif
......
......@@ -31,13 +31,13 @@ void DlgCreateGame::sharedCtor()
maxPlayersEdit->setMaximum(100);
maxPlayersEdit->setValue(2);
maxPlayersLabel->setBuddy(maxPlayersEdit);
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(descriptionLabel, 0, 0);
generalGrid->addWidget(descriptionEdit, 0, 1);
generalGrid->addWidget(maxPlayersLabel, 1, 0);
generalGrid->addWidget(maxPlayersEdit, 1, 1);
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
QMapIterator<int, QString> gameTypeIterator(gameTypes);
while (gameTypeIterator.hasNext()) {
......@@ -48,7 +48,7 @@ void DlgCreateGame::sharedCtor()
}
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
gameTypeGroupBox->setLayout(gameTypeLayout);
passwordLabel = new QLabel(tr("&Password:"));
passwordEdit = new QLineEdit;
passwordLabel->setBuddy(passwordEdit);
......@@ -60,18 +60,18 @@ void DlgCreateGame::sharedCtor()
onlyRegisteredCheckBox->setChecked(true);
} else {
onlyBuddiesCheckBox->setEnabled(false);
onlyRegisteredCheckBox->setEnabled(false);
onlyRegisteredCheckBox->setEnabled(false);
}
QGridLayout *joinRestrictionsLayout = new QGridLayout;
joinRestrictionsLayout->addWidget(passwordLabel, 0, 0);
joinRestrictionsLayout->addWidget(passwordEdit, 0, 1);
joinRestrictionsLayout->addWidget(onlyBuddiesCheckBox, 1, 0, 1, 2);
joinRestrictionsLayout->addWidget(onlyRegisteredCheckBox, 2, 0, 1, 2);
QGroupBox *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions"));
joinRestrictionsGroupBox->setLayout(joinRestrictionsLayout);
spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators allowed"));
spectatorsAllowedCheckBox->setChecked(true);
connect(spectatorsAllowedCheckBox, SIGNAL(stateChanged(int)), this, SLOT(spectatorsAllowedChanged(int)));
......@@ -94,7 +94,7 @@ void DlgCreateGame::sharedCtor()
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(grid);
mainLayout->addWidget(buttonBox);
......@@ -108,10 +108,10 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
: QDialog(parent), room(_room), gameTypes(_gameTypes)
{
sharedCtor();
buttonBox->addButton(QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOK()));
setWindowTitle(tr("Create game"));
}
......@@ -119,7 +119,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
: QDialog(parent), room(0), gameTypes(_gameTypes)
{
sharedCtor();
descriptionEdit->setEnabled(false);
maxPlayersEdit->setEnabled(false);
passwordEdit->setEnabled(false);
......@@ -129,7 +129,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
spectatorsNeedPasswordCheckBox->setEnabled(false);
spectatorsCanTalkCheckBox->setEnabled(false);
spectatorsSeeEverythingCheckBox->setEnabled(false);
descriptionEdit->setText(QString::fromStdString(gameInfo.description()));
maxPlayersEdit->setValue(gameInfo.max_players());
onlyBuddiesCheckBox->setChecked(gameInfo.only_buddies());
......@@ -138,29 +138,29 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
spectatorsNeedPasswordCheckBox->setChecked(gameInfo.spectators_need_password());
spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat());
spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient());
QSet<int> types;
for (int i = 0; i < gameInfo.game_types_size(); ++i)
types.insert(gameInfo.game_types(i));
QMapIterator<int, QString> gameTypeIterator(gameTypes);
while (gameTypeIterator.hasNext()) {
gameTypeIterator.next();
QCheckBox *gameTypeCheckBox = gameTypeCheckBoxes.value(gameTypeIterator.key());
gameTypeCheckBox->setEnabled(false);
gameTypeCheckBox->setChecked(types.contains(gameTypeIterator.key()));
}
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
setWindowTitle(tr("Game information"));
}
void DlgCreateGame::actOK()
{
Command_CreateGame cmd;
cmd.set_description(descriptionEdit->text().toStdString());
cmd.set_description(descriptionEdit->text().simplified().toStdString());
cmd.set_password(passwordEdit->text().toStdString());
cmd.set_max_players(maxPlayersEdit->value());
cmd.set_only_buddies(onlyBuddiesCheckBox->isChecked());
......@@ -169,18 +169,18 @@ void DlgCreateGame::actOK()
cmd.set_spectators_need_password(spectatorsNeedPasswordCheckBox->isChecked());
cmd.set_spectators_can_talk(spectatorsCanTalkCheckBox->isChecked());
cmd.set_spectators_see_everything(spectatorsSeeEverythingCheckBox->isChecked());
QMapIterator<int, QCheckBox *> gameTypeCheckBoxIterator(gameTypeCheckBoxes);
while (gameTypeCheckBoxIterator.hasNext()) {
gameTypeCheckBoxIterator.next();
if (gameTypeCheckBoxIterator.value()->isChecked())
cmd.add_game_type_ids(gameTypeCheckBoxIterator.key());
}
PendingCommand *pend = room->prepareRoomCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
room->sendRoomCommand(pend);
buttonBox->setEnabled(false);
}
......
......@@ -50,11 +50,6 @@ GeneralSettingsPage::GeneralSettingsPage()
pixmapCacheEdit.setSingleStep(64);
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
pixmapCacheEdit.setSuffix(" MB");
pixmapCacheEdit.setMinimum(64);
pixmapCacheEdit.setMaximum(8192);
pixmapCacheEdit.setSingleStep(64);
pixmapCacheEdit.setValue(settingsCache->getPixmapCacheSize());
pixmapCacheEdit.setSuffix(" MB");
picDownloadHqCheckBox.setChecked(settingsCache->getPicDownloadHq());
picDownloadCheckBox.setChecked(settingsCache->getPicDownload());
......@@ -571,16 +566,29 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked)
MessagesSettingsPage::MessagesSettingsPage()
{
chatMentionCheckBox.setChecked(settingsCache->getChatMention());
connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));
ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
ignoreUnregUserMessages.setChecked(settingsCache->getIgnoreUnregisteredUserMessages());
connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUserMessages(int)));
invertMentionForeground.setChecked(settingsCache->getChatMentionForeground());
connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));
mentionColor = new QLineEdit();
mentionColor->setText(settingsCache->getChatMentionColor());
updateMentionPreview();
connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString)));
QGridLayout *chatGrid = new QGridLayout;
chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
chatGrid->addWidget(&invertMentionForeground, 0, 1);
chatGrid->addWidget(mentionColor, 0, 2);
chatGrid->addWidget(&ignoreUnregUsersMainChat, 1, 0);
chatGrid->addWidget(&hexLabel, 1, 2);
chatGrid->addWidget(&ignoreUnregUserMessages, 2, 0);
chatGroupBox = new QGroupBox;
chatGroupBox->setLayout(chatGrid);
......@@ -618,6 +626,25 @@ MessagesSettingsPage::MessagesSettingsPage()
retranslateUi();
}
void MessagesSettingsPage::updateColor(const QString &value) {
QColor colorToSet;
colorToSet.setNamedColor("#" + value);
if (colorToSet.isValid()) {
settingsCache->setChatMentionColor(value);
updateMentionPreview();
}
}
void MessagesSettingsPage::updateTextColor(int value) {
settingsCache->setChatMentionForeground(value);
updateMentionPreview();
}
void MessagesSettingsPage::updateMentionPreview() {
mentionColor->setStyleSheet("QLineEdit{background:#" + settingsCache->getChatMentionColor() +
";color: " + (settingsCache->getChatMentionForeground() ? "white" : "black") + ";}");
}
void MessagesSettingsPage::storeSettings()
{
QSettings settings;
......@@ -650,9 +677,13 @@ void MessagesSettingsPage::retranslateUi()
aAdd->setText(tr("&Add"));
aRemove->setText(tr("&Remove"));
chatGroupBox->setTitle(tr("Chat settings"));
chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)"));
chatMentionCheckBox.setText(tr("Enable chat mentions"));
messageShortcuts->setTitle(tr("In-game message macros"));
ignoreUnregUsersMainChat.setText(tr("Ignore unregistered users in main chat"));
ignoreUnregUsersMainChat.setText(tr("Ignore chat room messages sent by unregistered users."));
ignoreUnregUserMessages.setText(tr("Ignore private messages sent by unregistered users."));
invertMentionForeground.setText(tr("Invert text color"));
hexLabel.setText(tr("(Color is hexadecimal)"));
}
DlgSettings::DlgSettings(QWidget *parent)
......
......@@ -156,16 +156,23 @@ public:
private slots:
void actAdd();
void actRemove();
void updateColor(const QString &value);
void updateTextColor(int value);
private:
QListWidget *messageList;
QAction *aAdd;
QAction *aRemove;
QCheckBox chatMentionCheckBox;
QCheckBox invertMentionForeground;
QCheckBox ignoreUnregUsersMainChat;
QCheckBox ignoreUnregUserMessages;
QGroupBox *chatGroupBox;
QGroupBox *messageShortcuts;
QLineEdit *mentionColor;
QLabel hexLabel;
void storeSettings();
void updateMentionPreview();
};
class DlgSettings : public QDialog {
......
......@@ -199,34 +199,31 @@ bool FilterItem::acceptManaCost(const CardInfo *info) const
return (info->getManaCost() == term);
}
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
bool FilterItem::acceptCmc(const CardInfo *info) const
{
bool status;
return (info->getCmc() == term);
}
bool FilterItem::acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const
{
switch (attr) {
case CardFilter::AttrName:
status = acceptName(info);
break;
return acceptName(info);
case CardFilter::AttrType:
status = acceptType(info);
break;
return acceptType(info);
case CardFilter::AttrColor:
status = acceptColor(info);
break;
return acceptColor(info);
case CardFilter::AttrText:
status = acceptText(info);
break;
return acceptText(info);
case CardFilter::AttrSet:
status = acceptSet(info);
break;
return acceptSet(info);
case CardFilter::AttrManaCost:
status = acceptManaCost(info);
break;
return acceptManaCost(info);
case CardFilter::AttrCmc:
return acceptCmc(info);
default:
status = true; /* ignore this attribute */
return true; /* ignore this attribute */
}
return status;
}
/* need to define these here to make QT happy, otherwise
......
......@@ -117,6 +117,7 @@ public:
bool acceptText(const CardInfo *info) const;
bool acceptSet(const CardInfo *info) const;
bool acceptManaCost(const CardInfo *info) const;
bool acceptCmc(const CardInfo *info) const;
bool acceptCardAttr(const CardInfo *info, CardFilter::Attr attr) const;
};
......
......@@ -115,7 +115,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return QString::fromStdString(g.creator_info().name());
case Qt::DecorationRole: {
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level());
QPixmap avatarPixmap = UserLevelPixmapGenerator::generatePixmap(13, (UserLevelFlags)g.creator_info().user_level(), false);
return QIcon(avatarPixmap);
}
default:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment