Crossfire Server, Trunk
FacePanel.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "FacePanel.h"
14 #include "CRESmoothFaceMaker.h"
15 #include "LicenseManager.h"
16 #include "assets/AssetModel.h"
17 #include "ResourcesManager.h"
18 
20  myMaps = maps;
21  myResources = resources;
22 
23  myUseModel = new UseFilterAssetModel(this);
24  myUseModel->setSourceModel(model);
25 
26  myUseView = new QTreeView(this);
27  myUseView->setIconSize(QSize(32, 32));
28  myUseView->setModel(myUseModel);
29  myLayout->addWidget(myUseView, 1, 1, 3, 2);
30 
31  myLicenses = new QTreeWidget(this);
32  myLicenses->setColumnCount(2);
33  myLicenses->setHeaderLabels(QStringList(tr("License field")) << tr("Value"));
34  myLicenses->setIconSize(QSize(32, 32));
35  myLicenses->setRootIsDecorated(false);
36  myLayout->addWidget(myLicenses, 1, 3, 3, 2);
37 
38  myColor = new QComboBox(this);
39  myLayout->addWidget(new QLabel(tr("Magicmap color: ")), 4, 1);
40  myLayout->addWidget(myColor, 4, 2, 1, 3);
41 
42  const char *name;
43  for(uint color = 0; strcmp(name = get_colorname(color), "") != 0; color++)
44  myColor->addItem(name, color);
45 
46  myFile = new QLineEdit(this);
47  myFile->setReadOnly(true);
48  myLayout->addWidget(new QLabel(tr("Face file: ")), 5, 1);
49  myLayout->addWidget(myFile, 5, 2, 1, 3);
50 
51  mySave = new QPushButton(tr("Save face"));
52  myLayout->addWidget(mySave, 6, 1);
53  connect(mySave, SIGNAL(clicked(bool)), this, SLOT(saveClicked(bool)));
54 
55  QPushButton* smooth = new QPushButton(tr("Make smooth base"), this);
56  myLayout->addWidget(smooth, 6, 2, 1, 3);
57  connect(smooth, SIGNAL(clicked(bool)), this, SLOT(makeSmooth(bool)));
58 }
59 
61 {
63  myUseView->expandAll();
64 
65  myColor->setCurrentIndex(myItem->magicmap);
66 
67  myLicenses->clear();
68 
69  auto licenses = myResources->licenseManager()->getForFace(myItem->name);
70  for (auto l : licenses) {
71  QTreeWidgetItem *wi = new QTreeWidgetItem(QStringList(QString(l.first.c_str())));
72  for (auto p : l.second) {
73  auto twi = new QTreeWidgetItem(wi, QStringList(p.first.c_str()) << p.second.c_str());
74  twi->setToolTip(1, p.second.c_str());
75  }
76  myLicenses->addTopLevelItem(wi);
77  wi->setExpanded(true);
78  }
79 
80  myFile->setText(QString::fromStdString(myResources->originOf(myItem)));
81 }
83 {
84 }
85 
87 {
88  CRESmoothFaceMaker maker;
89  maker.setSelectedFace(myItem);
90  maker.setAutoClose();
91  maker.exec();
92 }
ResourcesManager::licenseManager
LicenseManager * licenseManager()
Definition: ResourcesManager.h:152
banquet.l
l
Definition: banquet.py:164
LicenseManager.h
FacePanel.h
CREFacePanel::myResources
ResourcesManager * myResources
Definition: FacePanel.h:42
CRESmoothFaceMaker::setSelectedFace
void setSelectedFace(const Face *face)
Definition: CRESmoothFaceMaker.cpp:61
CREFacePanel::myUseView
QTreeView * myUseView
Definition: FacePanel.h:40
CREFacePanel::makeSmooth
void makeSmooth(bool)
Definition: FacePanel.cpp:86
AssetWrapperPanel::myLayout
QGridLayout * myLayout
Definition: AssetWrapperPanel.h:56
get_colorname
const char * get_colorname(uint8_t index)
Definition: image.cpp:86
CREFacePanel::myUseModel
UseFilterAssetModel * myUseModel
Definition: FacePanel.h:41
AssetModel.h
CREMapInformationManager
Definition: CREMapInformationManager.h:27
LicenseManager::getForFace
LicenseItems getForFace(const std::string &face)
Definition: LicenseManager.cpp:75
smoking_pipe.color
color
Definition: smoking_pipe.py:5
name
Plugin animator file specs[Config] name
Definition: animfiles.txt:4
CREFacePanel::myMaps
CREMapInformationManager * myMaps
Definition: FacePanel.h:38
UseFilterAssetModel
Definition: AssetModel.h:58
Face::name
sstring name
Definition: face.h:19
AssetWrapperPanel::myAsset
AssetWrapper * myAsset
Definition: AssetWrapperPanel.h:58
UseFilterAssetModel::setFilter
void setFilter(AssetWrapper *asset)
Definition: AssetModel.cpp:197
CRESmoothFaceMaker.h
ResourcesManager
Definition: ResourcesManager.h:80
CREFacePanel::saveClicked
void saveClicked(bool)
Definition: FacePanel.cpp:82
ResourcesManager::originOf
std::string originOf(const archetype *arch) const
Definition: ResourcesManager.h:110
maps
this information may not reflect the current implementation This brief document is meant to describe the operation of the crossfire as well as the form of the data The metaserver listens on port for tcp and on port for udp packets The server sends updates to the metaserver via udp The metaserver only does basic checking on the data that server sends It trusts the server for the ip name it provides The metaserver does add the ip address and also tracks the idle time(time since last packet received). The client gets its information from the metaserver through connecting by means of tcp. The client should retrieve http the body s content type is text plain The current metaserver implementation is in Perl But the metaserver could be in any language perl is fast enough for the amount of data that is being exchanged The response includes zero or more server entries Each entry begins with the line START_SERVER_DATA and ends with the line END_SERVER_DATA Between these lines key value pairs("key=value") may be present. The entries are sent in arbitrary order. A client should apply some ordering when displaying the entries to the user. TODO b additional information outside BEGIN_SERVER_DATA END_SERVER_DATA maps
Definition: arch-handbook.txt:189
AssetTWrapperPanel
Definition: AssetWrapperPanel.h:92
Face::magicmap
uint8_t magicmap
Definition: face.h:17
ResourcesManager.h
CREFacePanel::updateItem
virtual void updateItem() override
Definition: FacePanel.cpp:60
CREFacePanel::myLicenses
QTreeWidget * myLicenses
Definition: FacePanel.h:46
CREFacePanel::myColor
QComboBox * myColor
Definition: FacePanel.h:43
CRESmoothFaceMaker::setAutoClose
void setAutoClose(bool autoClose=true)
Definition: CRESmoothFaceMaker.cpp:71
CREFacePanel::mySave
QPushButton * mySave
Definition: FacePanel.h:45
AssetTWrapperPanel< Face >::myItem
Face * myItem
Definition: AssetWrapperPanel.h:106
AssetModel
Definition: AssetModel.h:29
connect
Definition: connect.py:1
CRESmoothFaceMaker
Definition: CRESmoothFaceMaker.h:23
CREFacePanel::CREFacePanel
CREFacePanel(QWidget *parent, AssetModel *model, ResourcesManager *resources, CREMapInformationManager *maps)
Definition: FacePanel.cpp:19
CREFacePanel::myFile
QLineEdit * myFile
Definition: FacePanel.h:44