Kstars

thumbnailpicker.h
1 /*
2  SPDX-FileCopyrightText: 2005 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "ui_thumbnailpicker.h"
10 
11 #include <KIO/Job>
12 
13 #include <QDialog>
14 #include <QPixmap>
15 
16 class QRect;
17 class KJob;
18 class DetailDialog;
19 class SkyObject;
20 
21 class ThumbnailPickerUI : public QFrame, public Ui::ThumbnailPicker
22 {
23  Q_OBJECT
24  public:
25  explicit ThumbnailPickerUI(QWidget *p);
26 };
27 
28 /**
29  * @short Dialog for modifying an object's thumbnail image
30  *
31  * @author Jason Harris
32  */
33 class ThumbnailPicker : public QDialog
34 {
35  Q_OBJECT
36  public:
37  ThumbnailPicker(SkyObject *o, const QPixmap &current, QWidget *parent = nullptr, double w = 200, double h = 200,
38  QString cap = i18n("Choose Thumbnail Image"));
39  ~ThumbnailPicker() override;
40 
41  QPixmap *image() { return Image; }
42  QPixmap *currentListImage() { return PixList.at(SelectedImageIndex); }
43  bool imageFound() const { return bImageFound; }
44  QRect *imageRect() const { return ImageRect; }
45 
46  private slots:
47  void slotEditImage();
48  void slotUnsetImage();
49  void slotSetFromList(int i);
50  void slotSetFromURL();
51  void slotFillList();
52  void slotProcessGoogleResult(KJob *);
53 
54  /** Make sure download has finished, then make sure file exists, then add image to list */
55  void slotJobResult(KJob *);
56 
57  private:
58  QPixmap shrinkImage(QPixmap *original, int newSize, bool setImage = false);
59  void parseGooglePage(const QString &URL);
60 
61  int SelectedImageIndex;
62  double thumbWidth, thumbHeight;
63  ThumbnailPickerUI *ui;
64  QPixmap *Image;
65  SkyObject *Object;
66  QList<KIO::Job *> JobList;
67  QList<QPixmap *> PixList;
68  bool bImageFound;
69  QRect *ImageRect;
70 };
Q_OBJECTQ_OBJECT
Dialog for modifying an object's thumbnail image.
QString i18n(const char *text, const TYPE &arg...)
const T & at(int i) const const
Information about an object in the sky.
Definition: skyobject.h:41
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 18 2022 03:56:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.