+////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////
+About::About(QWidget * pParent)
+ :QDialog(pParent)
+{
+ this->setWindowTitle(tr("About QSoloCards").trimmed());
+
+ // Layout the dialog a Vbox that will be the top level. And contain the HBox that has the icon and text
+ // and then the dialogButtonBox for the close button.
+ QVBoxLayout * pLayout=new QVBoxLayout;
+
+ QHBoxLayout * pMainLayout=new QHBoxLayout;
+
+ QLabel * pIconLabel=new QLabel(this);
+
+ pIconLabel->setPixmap(QPixmap(":/images/sol128x128.png"));
+
+ pMainLayout->addWidget(pIconLabel,0,Qt::AlignTop|Qt::AlignLeft);
+
+ QLabel * pWordsLabel=new QLabel(this);
+
+ pWordsLabel->setWordWrap(true);
+
+ // set the text for the about box. The .pro file is setup to pass
+ // VER_MAJ, VER_MIN, VER_PAT as a param when the file is compiled
+ // So, version info is contained only in the .pro file and can be
+ // easily changed in one place.
+ pWordsLabel->setText(tr("QSoloCards %1.%2.%3
"
+ "A collection of Solitaire Games written in Qt.
"
+ ""
+ ""
+ "Copyright 2009 Steve Moore
"
+ ""
+ " License: GPLv3
"
+ ""
+ ""
+ "Graphics: Playing cards are a modified version of the anglo_bitmap cards from Gnome-Games' AisleRiot.
"
+ ).arg(QString::number(VER_MAJ)).arg(QString::number(VER_MIN)).arg(QString::number(VER_PAT)));
+
+ connect(pWordsLabel,SIGNAL(linkActivated(QString)),
+ this,SLOT(slotLinkActivated(QString)));
+
+ pMainLayout->addWidget(pWordsLabel,0,Qt::AlignTop|Qt::AlignHCenter);
+
+
+ pLayout->addLayout(pMainLayout,20);
+
+ QDialogButtonBox * pButtonBox=new QDialogButtonBox(this);
+
+ pButtonBox->addButton(QDialogButtonBox::Close);
+
+ pLayout->addWidget(pButtonBox,1);
+
+ connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ // don't allow resizing the window.
+ pLayout->setSizeConstraint(QLayout::SetFixedSize);
+
+ this->setLayout(pLayout);
+}
+////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////
+About::~About()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////
+void About::slotLinkActivated(const QString & link)
+{
+ emit showLink(link);
+}
diff --git a/plugins/qsolocards_plugin/About.h b/plugins/qsolocards_plugin/About.h
new file mode 100644
index 000000000..39fce3eb1
--- /dev/null
+++ b/plugins/qsolocards_plugin/About.h
@@ -0,0 +1,34 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef ABOUT_H
+#define ABOUT_H
+#include
+
+class About: public QDialog
+{
+ Q_OBJECT
+public:
+ About(QWidget * pParent);
+ ~About();
+public slots:
+ void slotLinkActivated(const QString & link);
+signals:
+ void showLink(const QString & link);
+};
+#endif // ABOUT_H
diff --git a/plugins/qsolocards_plugin/CardAnimationLock.cpp b/plugins/qsolocards_plugin/CardAnimationLock.cpp
new file mode 100644
index 000000000..80ecd7949
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardAnimationLock.cpp
@@ -0,0 +1,66 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "CardAnimationLock.h"
+#include "CardStack.h"
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+CardAnimationLock::~CardAnimationLock()
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+CardAnimationLock & CardAnimationLock::getInst()
+{
+ static CardAnimationLock aniLock;
+
+ return aniLock;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+void CardAnimationLock::lock()
+{
+ if (m_aniEnabled && !m_demoStarted)
+ {
+ CardStack::lockUserInteration();
+ emit animationStarted();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+void CardAnimationLock::unlock()
+{
+ if (m_aniEnabled && !m_demoStarted)
+ {
+ CardStack::lockUserInteration(false);
+ emit animationComplete();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+CardAnimationLock::CardAnimationLock()
+ :m_aniEnabled(true),
+ m_demoStarted(false)
+{
+}
+
diff --git a/plugins/qsolocards_plugin/CardAnimationLock.h b/plugins/qsolocards_plugin/CardAnimationLock.h
new file mode 100644
index 000000000..30ef47338
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardAnimationLock.h
@@ -0,0 +1,57 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef CARDANIMATIONLOCK_H
+#define CARDANIMATIONLOCK_H
+
+#include
+
+class CardAnimationLock:public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~CardAnimationLock();
+
+ static CardAnimationLock & getInst();
+
+ inline void setDemoMode(bool isDemo){m_demoStarted=isDemo;}
+ inline bool isDemoRunning()const{return m_demoStarted;}
+
+ inline bool animationsEnabled()const{return m_aniEnabled;}
+ inline void enableAnimations(bool enabled){m_aniEnabled=enabled;}
+
+ // The lock just sends a single not to allow user interaction,
+ // and calls the static lockUserInteraction function of CardStack.
+ // The signal is used by mainwindow to know when not to allow menu
+ // items to be clicked.
+ void lock();
+ void unlock();
+
+signals:
+ void animationStarted();
+ void animationComplete();
+
+protected:
+ CardAnimationLock();
+
+private:
+ bool m_aniEnabled;
+ bool m_demoStarted;
+};
+
+#endif
diff --git a/plugins/qsolocards_plugin/CardDeck.cpp b/plugins/qsolocards_plugin/CardDeck.cpp
new file mode 100644
index 000000000..7281de1cf
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardDeck.cpp
@@ -0,0 +1,123 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "CardDeck.h"
+
+#include
+
+
+///////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////
+CardDeck::CardDeck(unsigned short numDecks)
+ :m_deckOfCards(),
+ m_shuffledCardVector(),
+ m_numDecks(numDecks)
+{
+ // This creates the default deck of cards that will be used
+ for (unsigned short i=0;ishuffle();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+CardDeck::CardDeck(const PlayingCardVector & cardsForDeck, unsigned short numDecks)
+ :m_deckOfCards(),
+ m_shuffledCardVector(),
+ m_numDecks(numDecks)
+{
+ for (unsigned short i=0;im_deckOfCards.push_back(cardsForDeck[j]);
+ }
+ }
+
+ this->shuffle();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+CardDeck::~CardDeck()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Create a shuffled deck by generating a vector of playing cards. And then randomly generating an index
+// into that vector. And then pull the card out of that vector and adding it to the end of another vector.
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+void CardDeck::shuffle()
+{
+ PlayingCardVector cardVector;
+
+ cardVector=this->m_deckOfCards;
+
+ if (this->m_shuffledCardVector.size()>0)
+ {
+ this->m_shuffledCardVector.clear();
+ }
+
+ qsrand(QDateTime::currentDateTime().toTime_t());
+
+
+ while(cardVector.size()>0)
+ {
+ unsigned int index=qrand()%cardVector.size();
+
+ // make sure our random number is not off the end of the vector
+ if (index>=cardVector.size())
+ {
+ index=cardVector.size()-1;
+ }
+
+ this->m_shuffledCardVector.push_back(cardVector[index]);
+ cardVector.erase(cardVector.begin()+index);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+PlayingCard CardDeck::next()
+{
+ // create an invalid card.
+ PlayingCard playingCard(PlayingCard::MaxSuit,PlayingCard::MaxCardIndex);
+
+ // if we have any cards left get the first one and return it.
+ // then remove that card from the vector.
+ if (this->m_shuffledCardVector.size()>0)
+ {
+ playingCard=this->m_shuffledCardVector[0];
+ this->m_shuffledCardVector.erase(this->m_shuffledCardVector.begin());
+ }
+
+ return playingCard;
+}
diff --git a/plugins/qsolocards_plugin/CardDeck.h b/plugins/qsolocards_plugin/CardDeck.h
new file mode 100644
index 000000000..47de6992d
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardDeck.h
@@ -0,0 +1,56 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef CARDDECK_H
+#define CARDDECK_H
+
+#include
+
+#include "PlayingCard.h"
+
+typedef std::vector PlayingCardVector;
+
+class CardDeck
+{
+ public:
+ // by default we just want to include one complete deck.
+ CardDeck(unsigned short numDecks=1);
+
+ // this constructor adds a little flexibility. So, that a deck of only certain cards
+ // can be built easily.
+ CardDeck(const PlayingCardVector & cardsForDeck, unsigned short numDecks=1);
+ ~CardDeck();
+
+ // will clear any remaining cards in the shuffled deck and create a new shuffled deck
+ // this function is automatically called by the constructor.
+ void shuffle();
+
+ inline bool isEmpty() const {return m_shuffledCardVector.empty();}
+
+ // get the next card in the shuffled deck.
+ PlayingCard next();
+
+ private:
+ PlayingCardVector m_deckOfCards;
+ PlayingCardVector m_shuffledCardVector;
+
+ unsigned short m_numDecks;
+};
+
+
+#endif // CARDDECK_H
diff --git a/plugins/qsolocards_plugin/CardMoveRecord.cpp b/plugins/qsolocards_plugin/CardMoveRecord.cpp
new file mode 100644
index 000000000..0fc433bc3
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardMoveRecord.cpp
@@ -0,0 +1,68 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "CardMoveRecord.h"
+
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+CardMoveRecordItem::CardMoveRecordItem(const std::string & stackName,
+ int flipIndex)
+ :m_moveType(CardMoveRecordItem::FlipCard),
+ m_cardVector(),
+ m_flipIndex(flipIndex),
+ m_stackName(stackName)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+CardMoveRecordItem::CardMoveRecordItem(const std::string & stackName,
+ MoveType m_type,
+ const PlayingCardVector & cardVector)
+ :m_moveType(m_type),
+ m_cardVector(cardVector),
+ m_flipIndex(-1),
+ m_stackName(stackName)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+CardMoveRecordItem::CardMoveRecordItem(const CardMoveRecordItem & rh)
+{
+ *this=rh;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+CardMoveRecordItem::~CardMoveRecordItem()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////
+CardMoveRecordItem & CardMoveRecordItem::operator=(const CardMoveRecordItem & rh)
+{
+ m_moveType=rh.moveType();
+ m_cardVector=rh.cardVector();
+ m_flipIndex=rh.flipIndex();
+ m_stackName=rh.stackName();
+
+ return *this;
+}
diff --git a/plugins/qsolocards_plugin/CardMoveRecord.h b/plugins/qsolocards_plugin/CardMoveRecord.h
new file mode 100644
index 000000000..2e15f372b
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardMoveRecord.h
@@ -0,0 +1,62 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef CARDMOVERECORD_H
+#define CARDMOVERECORD_H
+
+#include "CardDeck.h"
+#include
+#include
+
+class CardMoveRecordItem
+{
+ public:
+ enum MoveType
+ {
+ AddCards=0,
+ RemoveCards=1,
+ FlipCard=2
+ };
+
+ CardMoveRecordItem(const std::string & stackName,
+ int flipIndex=-1); // Case where we are just flipping a card
+ CardMoveRecordItem(const std::string & stackName,
+ MoveType m_type,
+ const PlayingCardVector & cardVector); // case where we are adding or removing cards
+ CardMoveRecordItem(const CardMoveRecordItem & rh);
+
+ virtual ~CardMoveRecordItem();
+
+ CardMoveRecordItem & operator=(const CardMoveRecordItem & rh);
+
+ inline MoveType moveType() const {return m_moveType;}
+ inline const PlayingCardVector & cardVector() const {return m_cardVector;}
+ inline int flipIndex() const {return m_flipIndex;}
+ inline const std::string & stackName() const{return m_stackName;}
+
+ private:
+ MoveType m_moveType;
+ PlayingCardVector m_cardVector;
+ int m_flipIndex;
+ std::string m_stackName;
+};
+
+typedef std::list CardMoveRecord;
+
+
+#endif // CARDMOVERECORD_H
diff --git a/plugins/qsolocards_plugin/CardPixmaps.cpp b/plugins/qsolocards_plugin/CardPixmaps.cpp
new file mode 100644
index 000000000..95090de82
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardPixmaps.cpp
@@ -0,0 +1,193 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#include "CardPixmaps.h"
+#include
+#include
+
+const qreal CardPixmaps::CardWidthToHeight=.66;
+const QString CardPixmaps::EmptyStackName("empty");
+const QString CardPixmaps::EmptyStackRedealName("emtpy_redeal");
+const QString CardPixmaps::CardBackName("back");
+const QString CardPixmaps::TransparentNoCard("transparent");
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+CardPixmaps::~CardPixmaps()
+{
+ delete m_pSvgRendCard;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+CardPixmaps & CardPixmaps::getInst()
+{
+ static CardPixmaps cardPixmaps;
+
+ return cardPixmaps;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+void CardPixmaps::setCardWidth(unsigned int width)
+{
+ m_cardSize.setWidth(width);
+ m_cardSize.setHeight(width/CardWidthToHeight);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+void CardPixmaps::setCardHeight(unsigned int height)
+{
+ m_cardSize.setHeight(height);
+ m_cardSize.setWidth(height*CardWidthToHeight);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+CardPixmaps::CardPixmaps()
+ :m_pSvgRendCard(new QSvgRenderer(QString(":/images/anglo_bitmap.svg"))),
+ m_pixmapMap(),
+ m_cardSize(0,0)
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+const QPixmap & CardPixmaps::getCardPixmap(const QString & imageName,bool highlighted)
+{
+ QString fullImageName("");
+
+ if (highlighted)
+ {
+ fullImageName+="hl_";
+ }
+ fullImageName+=imageName;
+
+ CardPixmapMap::iterator it=m_pixmapMap.find(fullImageName.toStdString());
+
+ if (m_pixmapMap.end()!=it)
+ {
+ return it->second;
+ }
+
+ QPainter painter;
+
+ QPixmap dummyPix(m_cardSize);
+
+ dummyPix.fill(Qt::transparent);
+
+ m_pixmapMap[fullImageName.toStdString()]=dummyPix;
+ painter.begin(&m_pixmapMap[fullImageName.toStdString()]);
+ if (imageName==EmptyStackName || imageName==EmptyStackRedealName)
+ {
+ drawEmptyStack(painter,highlighted,imageName==EmptyStackRedealName);
+ }
+ else if (imageName==TransparentNoCard)
+ {
+ }
+ else if (highlighted)
+ {
+ drawHighlightedCard(painter,imageName);
+ }
+ else
+ {
+ QRect pixRect(QPoint(0,0),m_cardSize);
+
+ m_pSvgRendCard->render(&painter,imageName,pixRect);
+ }
+
+ painter.end();
+
+ return m_pixmapMap[fullImageName.toStdString()];
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+void CardPixmaps::drawEmptyStack(QPainter & painter,bool highlighted,bool redealCircle)
+{
+ QPoint topLeft(0,0);
+ QPen pen;
+
+
+ pen.setColor(QColor("#006520"));
+
+ pen.setWidth(3);
+ painter.setPen(pen);
+
+
+ QRect rect(topLeft,m_cardSize);
+
+ painter.setRenderHint(QPainter::Antialiasing,true);
+
+
+ if (redealCircle)
+ {
+ QPoint ellipseCenter(rect.left()+rect.width()/2,
+ rect.top()+rect.height()/2);
+
+ pen.setWidth(10);
+ painter.setBrush(QColor("#006520"));
+ painter.drawEllipse(ellipseCenter,
+ rect.width()/3,rect.width()/3);
+ }
+
+ painter.setBrush(Qt::transparent);
+
+ // draw the highlight rect if necessary.
+ if (highlighted)
+ {
+ painter.setBrush(QBrush(QColor("#806000"),Qt::Dense4Pattern));
+ }
+
+ painter.drawRoundedRect(rect.adjusted(1,1,-1,-1),6.0,6.0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////
+void CardPixmaps::drawHighlightedCard(QPainter & painter,const QString & imageName)
+{
+ // for the highlighted case we are going to manipulate the original
+ // image and change the background of the card to a yellowish color
+ // to highlight it.
+
+ // A QImage is necessary in Format_ARGB32_Premultiplied or Format_ARGB32
+ // is required to use the composite modes. So, draw the pixmap on the
+ // QImage. And then render the result in our pixmap.
+
+ QRect pixRect(QPoint(0,0),m_cardSize);
+
+ QImage image(m_cardSize,QImage::Format_ARGB32_Premultiplied);
+
+ image.fill(Qt::transparent);
+
+ QPainter imagePainter;
+
+ imagePainter.begin(&image);
+
+ imagePainter.setPen(Qt::NoPen);
+
+ imagePainter.setBrush(QColor("#ffff90"));
+ imagePainter.drawPixmap(QPoint(0,0),getCardPixmap(imageName));
+
+ imagePainter.setCompositionMode(QPainter::CompositionMode_Darken);
+ imagePainter.drawRoundedRect(pixRect.adjusted(0,0,-1,-1),4.0,4.0);
+
+ imagePainter.end();
+ painter.drawImage(QPoint(0,0),image);
+}
diff --git a/plugins/qsolocards_plugin/CardPixmaps.h b/plugins/qsolocards_plugin/CardPixmaps.h
new file mode 100644
index 000000000..47bce4f67
--- /dev/null
+++ b/plugins/qsolocards_plugin/CardPixmaps.h
@@ -0,0 +1,93 @@
+/*
+ QSoloCards is a collection of Solitaire card games written using Qt
+ Copyright (C) 2009 Steve Moore
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+#ifndef CARDPIXMAPS_H
+#define CARDPIXMAPS_H
+
+#include "PlayingCard.h"
+#include
+#include
+#include