Commit 840869d7 authored by Dirk Wilden's avatar Dirk Wilden

enhanced LoadSaveInterface

+some ViewerSnapshot code

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5346 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 42483677
...@@ -105,7 +105,14 @@ class LoadSaveInterface { ...@@ -105,7 +105,14 @@ class LoadSaveInterface {
* @param _id Id of the new object * @param _id Id of the new object
*/ */
virtual void fileOpened( int /*_id*/ ) {}; virtual void fileOpened( int /*_id*/ ) {};
/** \brief An empty object has been added
*
* This slot is called if an empty object has been added by the core.\n
* @param _id Id of the new object
*/
virtual void addedEmptyObject( int /*_id*/ ) {};
}; };
Q_DECLARE_INTERFACE(LoadSaveInterface,"OpenFlipper.LoadSaveInterface/1.0") Q_DECLARE_INTERFACE(LoadSaveInterface,"OpenFlipper.LoadSaveInterface/1.0")
......
...@@ -1043,6 +1043,12 @@ void Core::applicationSnapshotName(QString _name){ ...@@ -1043,6 +1043,12 @@ void Core::applicationSnapshotName(QString _name){
coreWidget_->applicationSnapshotName(_name); coreWidget_->applicationSnapshotName(_name);
} }
void Core::viewerSnapshot(){
if ( OpenFlipper::Options::gui() )
coreWidget_->viewerSnapshot();
}
void Core::resizeViewer(int _width, int _height ){ void Core::resizeViewer(int _width, int _height ){
if ( OpenFlipper::Options::gui() ){ if ( OpenFlipper::Options::gui() ){
//+40 / +20 corresponds to the bottom and right scrollbar //+40 / +20 corresponds to the bottom and right scrollbar
......
...@@ -191,6 +191,9 @@ signals: ...@@ -191,6 +191,9 @@ signals:
/// Tell the plugins that a file has been opened ( -> Database) /// Tell the plugins that a file has been opened ( -> Database)
void openedFile( int _id ); void openedFile( int _id );
/// Tell the plugins that an empty object has been added
void emptyObjectAdded( int _id);
/// Called after all plugins are loaded /// Called after all plugins are loaded
void pluginsInitialized(); void pluginsInitialized();
...@@ -315,6 +318,9 @@ public slots: ...@@ -315,6 +318,9 @@ public slots:
/// Set the baseName for the application snapshot /// Set the baseName for the application snapshot
void applicationSnapshotName(QString _name); void applicationSnapshotName(QString _name);
/// Take a snapshot from all viewers
void viewerSnapshot();
/// resize the examinerViewer /// resize the examinerViewer
void resizeViewer(int _width, int _height ); void resizeViewer(int _width, int _height );
......
...@@ -871,6 +871,10 @@ void Core::loadPlugin(QString filename, bool silent){ ...@@ -871,6 +871,10 @@ void Core::loadPlugin(QString filename, bool silent){
connect(plugin , SIGNAL( emptyObjectAdded( int ) ) , connect(plugin , SIGNAL( emptyObjectAdded( int ) ) ,
this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::DirectConnection); this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::DirectConnection);
if ( checkSlot(plugin,"addedEmptyObject(int)" ) )
connect(this , SIGNAL( emptyObjectAdded( int ) ) ,
plugin , SLOT( addedEmptyObject( int ) ),Qt::DirectConnection);
if ( checkSignal(plugin,"getAllFilters(QStringList&)" ) ) if ( checkSignal(plugin,"getAllFilters(QStringList&)" ) )
connect(plugin , SIGNAL( getAllFilters( QStringList& ) ) , connect(plugin , SIGNAL( getAllFilters( QStringList& ) ) ,
this , SLOT( slotGetAllFilters ( QStringList& ) ),Qt::DirectConnection); this , SLOT( slotGetAllFilters ( QStringList& ) ),Qt::DirectConnection);
......
...@@ -270,6 +270,8 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) { ...@@ -270,6 +270,8 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
BaseObjectData* object; BaseObjectData* object;
PluginFunctions::getObject(_id,object); PluginFunctions::getObject(_id,object);
emit emptyObjectAdded( _id );
///@todo : set a default path for new objects ///@todo : set a default path for new objects
// QString filename = object->path() + OpenFlipper::Options::dirSeparator() + object->name(); // QString filename = object->path() + OpenFlipper::Options::dirSeparator() + object->name();
......
...@@ -617,7 +617,7 @@ public: ...@@ -617,7 +617,7 @@ public:
// void viewerSnapshotDialog(); // void viewerSnapshotDialog();
/// Create a snapshot of the whole app /// Create a snapshot of the whole app
// void viewerSnapshot(); void viewerSnapshot();
/// Create a snapshot of the whole app with fileDialog /// Create a snapshot of the whole app with fileDialog
void applicationSnapshotDialog(); void applicationSnapshotDialog();
......
...@@ -306,37 +306,71 @@ void CoreWidget::applicationSnapshot() { ...@@ -306,37 +306,71 @@ void CoreWidget::applicationSnapshot() {
} }
///Take a snapshot of all viewers ///Take a snapshot of all viewers
// void CoreWidget::viewerSnapshot() { void CoreWidget::viewerSnapshot() {
//
// QFileInfo fi(snapshotName_); QFileInfo fi(snapshotName_);
//
// QString suggest = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(snapshotCounter_++) + "."; QString suggest = fi.path() + QDir::separator() +fi.baseName() + "." + QString::number(snapshotCounter_++) + ".";
//
// QString format="png"; QString format="png";
//
// if (fi.completeSuffix() == "ppm") if (fi.completeSuffix() == "ppm")
// format="ppmraw"; format="ppmraw";
//
// suggest += format; suggest += format;
//
// switch ( coreWidget_->baseLayout_->mode() ){
// switch ( baseLayout_->mode() ){
// case QtMultiViewLayout::SingleView:
// case QtMultiViewLayout::SingleView:
// QImage img; {
// examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(img); QImage finalImage;
examiner_widgets_[PluginFunctions::activeExaminer()]->snapshot(finalImage);
finalImage.save(suggest);
break;
}
case QtMultiViewLayout::Grid:
{
// QImage img0,img1,img2,img3;
// //
// img.save(suggest); // QImage finalImage(img0.width() + img1.width(), img0.height() + img2.height(), QImage::Format_ARGB32_Premultiplied);
// //
// break; // examiner_widgets_[0]->snapshot(finalImage, 0, 0);
// case QtMultiViewLayout::Grid: // examiner_widgets_[1]->snapshot(finalImage,examiner_widgets_[0]->glWidth(), 0);
// break; // examiner_widgets_[2]->snapshot(finalImage,0, examiner_widgets_[0]->glHeight());
// case QtMultiViewLayout::HSplit: // examiner_widgets_[3]->snapshot(finalImage,examiner_widgets_[0]->glWidth(),examiner_widgets_[0]->glHeight());
// break;
// default: break;
// //
// } // finalImage.save(suggest);
// }
break;
}
case QtMultiViewLayout::HSplit:
{
QImage img0,img1,img2,img3;
examiner_widgets_[0]->snapshot(img0);
examiner_widgets_[1]->snapshot(img1);
examiner_widgets_[2]->snapshot(img2);
examiner_widgets_[3]->snapshot(img3);
QImage finalImage(img0.width() + img1.width(), img0.height(), QImage::Format_ARGB32_Premultiplied);
// finalImage.paintEngine()->drawImage(QRectF(0,0,img0.width(),img0.height()),img0, QRectF(0,0,img0.width(),img0.height()) );
// finalImage.paintEngine()->drawImage(QRectF(img0.width(),0,img1.width(),img1.height()),img1, QRectF(0,0,img1.width(),img1.height()) );
// finalImage.paintEngine()->drawImage(QRectF(img0.width(),img1.height(),img2.width(),img2.height()),img2, QRectF(0,0,img2.width(),img2.height()) );
// finalImage.paintEngine()->drawImage(QRectF(img0.width(),img2.height(),img3.width(),img3.height()),img3, QRectF(0,0,img3.width(),img3.height()) );
finalImage.save(suggest);
break;
}
default: break;
}
}
void CoreWidget::applicationSnapshotName(QString _name) { void CoreWidget::applicationSnapshotName(QString _name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment