41
43
connect(scene_, SIGNAL(changed(QList<QRectF>)), this, SLOT(sceneChanged()));
42
44
ui->graphicsView->setScene(scene_);
46
if (QFile::exists(gv.wallchHomePath+LE_POINT_IMAGE)) {
47
// the image has already been fetched
48
backgroundImageReady(gv.wallchHomePath+LE_POINT_IMAGE);
52
// initiate the image fetch
53
tryFetch_ = new TryHard(this, lePointImages_);
54
connect(tryFetch_, SIGNAL(failed()), this, SLOT(cannotFetchLeImage()));
55
connect(tryFetch_, SIGNAL(success(const QByteArray&)), this, SLOT(leImageFetchSuccess(const QByteArray&)));
59
(void) new QShortcut(Qt::Key_Delete, this, SLOT(removeItem()));
67
void LEPoint::showTools()
69
// remove the progressbar
70
ui->infoLabel->hide();
71
ui->progressBar->hide();
73
// make sure everything else is shown
74
ui->graphicsView->show();
76
ui->horizontalSlider->show();
78
ui->horizontalSlider_2->show();
79
ui->iconCombo->show();
80
ui->addButton->show();
84
void LEPoint::hideTools()
86
// remove the progressbar
87
ui->infoLabel->show();
88
ui->progressBar->show();
90
// make sure everything else is hidden
91
ui->graphicsView->hide();
93
ui->horizontalSlider->hide();
95
ui->horizontalSlider_2->hide();
96
ui->iconCombo->hide();
97
ui->addButton->hide();
101
void LEPoint::backgroundImageReady(const QPixmap &background)
105
// setting background
45
106
QGraphicsPixmapItem *backgroundItem = new QGraphicsPixmapItem();
46
QPixmap background = QPixmap(":/images/le.jpg");
47
107
backgroundItem->setPixmap(background);
49
109
backgroundHeight_ = background.height();
192
void LEPoint::cannotFetchLeImage()
195
ui->progressBar->hide();
196
ui->infoLabel->setText(tr("The Live Earth image used for setting the mark points, failed to download. Please check your internet connection or try later."));
197
this->resize(this->minimumWidth(), this->minimumHeight());
198
this->move(QDesktopWidget().availableGeometry().center() - this->rect().center());
201
void LEPoint::leImageFetchSuccess(const QByteArray &array)
204
background.loadFromData(array);
205
background.save(gv.wallchHomePath+LE_POINT_IMAGE);
207
backgroundImageReady(background);
139
210
void LEPoint::on_horizontalSlider_valueChanged(int value)
141
212
Q_FOREACH(MarkItem *pointItem, marks_){
200
271
if(alteringIndexesFromCode_){
201
272
//do not run this function unless user generated the action through the UI
202
qDebug() << "code alter!";
206
qDebug() << index << ui->iconCombo->count();
208
276
if(index == (ui->iconCombo->count()-1)){
209
277
//select new custom image
210
278
QString path = QFileDialog::getOpenFileName(this, tr("Select Image"), QDir::homePath());
305
void LEPoint::on_saveButton_clicked()
373
void LEPoint::on_ok_clicked()
307
379
QSettings settings("wallch", "Settings");
309
381
// clean the array to start writing to it anew