File indexing completed on 2024-04-14 14:32:01

0001 // Copyright (c) 2002-2003 Rob Kaper <cap@capsi.com>
0002 //
0003 // This library is free software; you can redistribute it and/or
0004 // modify it under the terms of the GNU Lesser General Public
0005 // License version 2.1 as published by the Free Software Foundation.
0006 //
0007 // This library is distributed in the hope that it will be useful,
0008 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0010 // Lesser General Public License for more details.
0011 //
0012 // You should have received a copy of the GNU Lesser General Public License
0013 // along with this library; see the file COPYING.LIB.  If not, write to
0014 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0015 // Boston, MA 02110-1301, USA.
0016 
0017 #ifndef ATLANTIK_PORTFOLIOVIEW_H
0018 #define ATLANTIK_PORTFOLIOVIEW_H
0019 
0020 #include <QWidget>
0021 #include <QList>
0022 
0023 #include "libatlantikui_export.h"
0024 #include "tokentheme.h"
0025 
0026 class QColor;
0027 class QPixmap;
0028 class QString;
0029 
0030 class AtlanticCore;
0031 class Player;
0032 class Estate;
0033 class PortfolioEstate;
0034 
0035 class LIBATLANTIKUI_EXPORT PortfolioView : public QWidget
0036 {
0037 Q_OBJECT
0038 
0039 public:
0040     PortfolioView(AtlanticCore *core, Player *_player, QColor activeColor, QColor inactiveColor, QWidget *parent);
0041     ~PortfolioView();
0042 
0043     void buildPortfolio();
0044     void clearPortfolio();
0045 
0046     Player *player() const;
0047 
0048     void setTokenTheme(const TokenTheme &theme);
0049 
0050 protected:
0051     void paintEvent(QPaintEvent *) override;
0052     void resizeEvent(QResizeEvent *) override;
0053     void contextMenuEvent(QContextMenuEvent *) override;
0054 
0055 Q_SIGNALS:
0056     void newTrade(Player *player);
0057     void kickPlayer(Player *player);
0058     void estateClicked(Estate *);
0059 
0060 private Q_SLOTS:
0061     void playerChanged();
0062     void slotMenuActionTrade();
0063     void slotMenuActionKick();
0064 
0065 private:
0066     void loadIcon(bool force = false);
0067 
0068     AtlanticCore *m_atlanticCore;
0069     Player *m_player;
0070     QColor m_activeColor, m_inactiveColor;
0071     QPixmap *qpixmap, *m_image;
0072     QString m_imageName;
0073     bool b_recreate;
0074     QList<PortfolioEstate *> m_portfolioEstates;
0075     TokenTheme m_tokenTheme;
0076 };
0077 
0078 #endif