-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Found a better implementation for the image viewer. Has more features, and suites more the "vibe" of this IDE. Removed the old image viewer. The image viewers are now full qmdiClients. We can at least restore loaded files.
- Loading branch information
Showing
5 changed files
with
34 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,34 @@ | ||
#include "imageviewer_plg.h" | ||
#include "QImageViewer.h" | ||
/** | ||
* \file imageviewer_plg | ||
* \brief Definition of | ||
* \author Diego Iastrubni [email protected] | ||
* License MIT | ||
* \see class name | ||
*/ | ||
|
||
|
||
#include <QFileInfo> | ||
#include <pal/image-viewer.h> | ||
#include "imageviewer_plg.h" | ||
|
||
class qmdiImageViewer : public pal::ImageViewer, public qmdiClient { | ||
public: | ||
QString thisFileName; | ||
qmdiImageViewer(QWidget *p, const QString &fileName) : pal::ImageViewer(p) { | ||
this->setImage(QImage(fileName)); | ||
auto fi = QFileInfo(fileName); | ||
this->mdiClientName = fi.fileName(); | ||
this->thisFileName = fileName; | ||
} | ||
|
||
virtual QString mdiClientFileName() override { | ||
return thisFileName; | ||
} | ||
|
||
virtual std::optional<std::tuple<int, int, int>> get_coordinates() const override { | ||
return {}; | ||
} | ||
}; | ||
|
||
ImageViewrPlugin::ImageViewrPlugin() { | ||
name = tr("Image viewer plugin - based on QutePart"); | ||
|
@@ -40,13 +67,8 @@ int ImageViewrPlugin::canOpenFile(const QString fileName) { | |
|
||
bool ImageViewrPlugin::openFile(const QString fileName, int x, int y, int z) { | ||
auto tabWidget = dynamic_cast<QTabWidget *>(mdiServer); | ||
auto viewer = new QImageViewer(getManager()); | ||
viewer->loadFile(fileName); | ||
auto fi = QFileInfo(fileName); | ||
tabWidget->addTab(viewer, fi.fileName()); | ||
auto viewer = new qmdiImageViewer(tabWidget, fileName); | ||
mdiServer->addClient(viewer); | ||
return true; | ||
} | ||
|
||
void ImageViewrPlugin::showAbout() {} | ||
|
||
void ImageViewrPlugin::actionAbout_triggered() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* \file imageviewer_plg.h | ||
* \brief Definition of the image viewer system plugin | ||
* \author Diego Iastrubni ([email protected]) | ||
* License LGPL | ||
* License MIT | ||
* \see ImageViewer plugin | ||
*/ | ||
|
||
|
@@ -21,11 +21,4 @@ class ImageViewrPlugin : public IPlugin { | |
QStringList myExtensions() override; | ||
int canOpenFile(const QString fileName) override; | ||
bool openFile(const QString fileName, int x = -1, int y = -1, int z = -1) override; | ||
|
||
void showAbout() override; | ||
public slots: | ||
void actionAbout_triggered(); | ||
|
||
private: | ||
QAction *actionAbout; | ||
}; |