35 |
35 |
36 #include <QPushButton> |
36 #include <QPushButton> |
37 #include <QBuffer> |
37 #include <QBuffer> |
38 #include <QUuid> |
38 #include <QUuid> |
39 |
39 |
40 #include <QDebug> |
|
41 |
|
42 HWMapContainer::HWMapContainer(QWidget * parent) : |
40 HWMapContainer::HWMapContainer(QWidget * parent) : |
43 QWidget(parent), mainLayout(this) |
41 QWidget(parent), mainLayout(this) |
44 { |
42 { |
45 imageButt=new QPushButton(this); |
43 imageButt=new QPushButton(this); |
46 imageButt->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
44 imageButt->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
47 mainLayout.addWidget(imageButt); |
45 mainLayout.addWidget(imageButt); |
48 connect(imageButt, SIGNAL(clicked()), this, SLOT(changeImage())); |
46 connect(imageButt, SIGNAL(clicked()), this, SLOT(changeImage())); |
49 connect(&m_hwmap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); |
|
50 changeImage(); |
47 changeImage(); |
51 } |
48 } |
52 |
49 |
53 void HWMapContainer::setImage(const QImage newImage) |
50 void HWMapContainer::setImage(const QImage newImage) |
54 { |
51 { |
55 qDebug() << "image received"; |
|
56 // unfortunately QPixmap::fromImage doesn't work |
52 // unfortunately QPixmap::fromImage doesn't work |
57 // with this image in current (4.1.4) version of QT |
53 // with this image in current (4.1.4) version of QT |
58 QByteArray ba; |
54 QByteArray ba; |
59 QBuffer buffer(&ba); |
55 QBuffer buffer(&ba); |
60 buffer.open(QIODevice::ReadWrite); |
56 buffer.open(QIODevice::ReadWrite); |
66 imageButt->setIconSize(QSize(128, 256)); |
62 imageButt->setIconSize(QSize(128, 256)); |
67 } |
63 } |
68 |
64 |
69 void HWMapContainer::changeImage() |
65 void HWMapContainer::changeImage() |
70 { |
66 { |
|
67 pMap=new HWMap(); |
|
68 connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); |
71 m_seed = QUuid::createUuid().toString(); |
69 m_seed = QUuid::createUuid().toString(); |
72 //pMap=new HWMap(); |
70 pMap->getImage(m_seed.toStdString()); |
73 m_hwmap.getImage(m_seed.toStdString()); |
|
74 } |
71 } |
75 |
72 |
76 QString HWMapContainer::getCurrentSeed() const |
73 QString HWMapContainer::getCurrentSeed() const |
77 { |
74 { |
78 return m_seed; |
75 return m_seed; |