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