code:
###########################################################################################
##      Created using Monkey Studio v1.8.4.0 (1.8.4.0)
##
##  Author     : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
##  Project    : qwbfs
##  FileName   : qwbfs.pro
##  Date       : 2010-04-04T11:04:05
##  License    : GPL2
##  Comment    : Creating using Monkey Studio RAD
##  Home Page  : https://github.com/pasnox/qwbfsmanager
##
###########################################################################################

TEMPLATE = app
LANGUAGE = C++/Qt4
TARGET = $$quote( qwbfsmanager )
macx:TARGET = $$quote( QWBFSManager )
BUILD_PATH = ../build
DESTDIR = ../bin

include( ../shared.pri )

CONFIG *= warn_on thread x11 windows qt resources embed_manifest_exe app_bundle
QT *= core gui network xml
greaterThan( QT_MAJOR_VERSION, 4 ):QT *= widgets

include( ../libwbfs/libwbfs.pri )

win32_crossbuild {
    exists( "$(QT_WIN32_PATH)/lib/*fresh*" ):CONFIG *= fresh
} else {
    exists( "$$[QT_INSTALL_LIBS]/*fresh*" ):CONFIG *= fresh
}

fresh {
    !build_pass:message( "Using system fresh library." )
} else {
    exists( ../fresh.git/fresh.pro ) {
        !build_pass:message( "Using bundled fresh library." )
        FRESH_PATH = ../fresh.git

        include( $$FRESH_PATH/qmake-extensions.git/qmake-extensions.pri )

        FRESH_SOURCES_PATHS = $$getFolders( $$PWD/$$FRESH_PATH/src )

        DEFINES *= FRESH_CORE_BUILD

        DEPENDPATH *= $${FRESH_SOURCES_PATHS}
        DEPENDPATH *= $$FRESH_PATH/include/FreshCore \
            $$FRESH_PATH/include/FreshGui

        INCLUDEPATH *= $$FRESH_PATH/include
        INCLUDEPATH *= $${FRESH_SOURCES_PATHS}

        PRE_TARGETDEPS *= $${FRESH_PATH}

        QMAKE_RPATHDIR *= $$OUT_PWD/$$FRESH_PATH/build
        macx:LIBS *= -F$$OUT_PWD/$$FRESH_PATH/build
        LIBS *= -L$$OUT_PWD/$$FRESH_PATH/build

        QT *= xml network
        CONFIG( debug, debug|release ) {
            # Debug
            macx:LIBS *= -lfresh_debug
            else:LIBS *= -lfreshd
        } else {
            # Release
            LIBS *= -lfresh
        }
    } else {
        !build_pass:error( "Fresh library not found - initialize the submodules using the init-repositories script." )
    }
}

# define some usefull values
OS = $$lower( $$QMAKE_HOST.os )
QMAKE_TARGET_COMPANY = "QWBFS Team"
QMAKE_TARGET_PRODUCT = "QWBFS Manager"
QMAKE_TARGET_DESCRIPTION = "The Free, Fast and Powerful cross platform Wii Backup File System manager"
greaterThan( QT_MAJOR_VERSION, 4 ) {
    QMAKE_TARGET_COPYRIGHT = "© 2010 - 2016 Filipe Azevedo"
} else {
    QMAKE_TARGET_COPYRIGHT = "\\251 2010 - 2016 Filipe Azevedo"
}
PACKAGE_DOMAIN = "github.com/pasnox/qwbfsmanager"
PACKAGE_DOWNLOADS_FEED = "http://to-be-changed"
PACKAGE_REPORT_BUG_URL = "https://github.com/pasnox/qwbfsmanager/issues"
PACKAGE_DISCUSS_URL = "http://groups.google.com/group/qwbfs-discuss"
PACKAGE_VERSION = 1.2.6
!isEqual( OS, "windows" ):exists( "$$PWD/../.git" ):SVN_REVISION = $$system( export LANG=C && [ -f /usr/bin/git ] && git --git-dir="$$PWD/../.git" describe )
isEmpty( SVN_REVISION ):SVN_REVISION = $(SVN_REVISION)
isEmpty( SVN_REVISION ):SVN_REVISION = "N/C"

!isEqual( OS, "windows" ):system( touch $$PWD/src/main.h )

isEqual( SVN_REVISION, "N/C" ) {
    CONFIG( debug, debug|release ) {
        PACKAGE_VERSION_STR = $${PACKAGE_VERSION} (debug)
    } else {
        PACKAGE_VERSION_STR = $${PACKAGE_VERSION} (release)
    }
} else {
    CONFIG( debug, debug|release ) {
        PACKAGE_VERSION_STR = $${PACKAGE_VERSION} ($$SVN_REVISION debug)
    } else {
        PACKAGE_VERSION_STR = $${PACKAGE_VERSION} ($$SVN_REVISION release)
    }
}

# define variable for source code
DEFINES *= "_APPLICATION_NAME=\"\\\"$${QMAKE_TARGET_PRODUCT}\\\"\"" \
    "_APPLICATION_VERSION=\"\\\"$${PACKAGE_VERSION}\\\"\"" \
    "_APPLICATION_VERSION_STR=\"\\\"$${PACKAGE_VERSION_STR}\\\"\"" \
    "_APPLICATION_DOMAIN=\"\\\"$${PACKAGE_DOMAIN}\\\"\"" \
    "_APPLICATION_COPYRIGHTS=\"\\\"$${QMAKE_TARGET_COPYRIGHT}\\\"\"" \
    "_APPLICATION_DESCRIPTION=\"\\\"$${QMAKE_TARGET_DESCRIPTION}\\\"\"" \
    "_APPLICATION_ORGANIZATION=\"\\\"$${QMAKE_TARGET_COMPANY}\\\"\"" \
    "_APPLICATION_DOWNLOADS_FEED=\"\\\"$${PACKAGE_DOWNLOADS_FEED}\\\"\"" \
    "_APPLICATION_REPORT_BUG_URL=\"\\\"$${PACKAGE_REPORT_BUG_URL}\\\"\"" \
    "_APPLICATION_DISCUSS_URL=\"\\\"$${PACKAGE_DISCUSS_URL}\\\"\""

INCLUDEPATH *= src

DEPENDPATH *= src \
    src/models \
    src/qwbfsdriver \
    src/wiitdb

macx:ICON = resources/qwbfsmanager.icns
win32:RC_FILE = resources/qwbfsmanager.rc

RESOURCES = resources/resources.qrc

XUP.TRANSLATIONS_BASENAME = qwbfsmanager
XUP.TRANSLATIONS_DIRECTORY = ../translations

TRANSLATIONS *= ../translations/qwbfsmanager-ru_RU.ts \
    ../translations/qwbfsmanager-sl_SI.ts \
    ../translations/qwbfsmanager-pl_PL.ts \
    ../translations/qwbfsmanager-zh_CN.ts \
    ../translations/qwbfsmanager-he_IL.ts \
    ../translations/qwbfsmanager-da_DK.ts \
    ../translations/qwbfsmanager-sk_SK.ts \
    ../translations/qwbfsmanager-ja_JP.ts \
    ../translations/qwbfsmanager-uk_UA.ts \
    ../translations/qwbfsmanager-cs_CZ.ts \
    ../translations/qwbfsmanager-ca_ES.ts \
    ../translations/qwbfsmanager-ar_SA.ts \
    ../translations/qwbfsmanager-fr_FR.ts \
    ../translations/qwbfsmanager-zh_TW.ts \
    ../translations/qwbfsmanager-es_ES.ts \
    ../translations/qwbfsmanager-de_DE.ts \
    ../translations/qwbfsmanager-pt_PT.ts \
    ../translations/qwbfsmanager-sv_SE.ts \
    ../translations/qwbfsmanager-it_IT.ts

FORMS *= src/UIMain.ui \
    src/PartitionWidget.ui \
    src/ProgressDialog.ui \
    src/UIAbout.ui \
    src/PropertiesDialog.ui

HEADERS *= src/main.h \
    src/Utils.h \
    src/UIMain.h \
    src/Gauge.h \
    src/PartitionWidget.h \
    src/ProgressDialog.h \
    src/WorkerThread.h \
    src/qwbfsdriver/PartitionDiscHandle.h \
    src/qwbfsdriver/PartitionHandle.h \
    src/qwbfsdriver/PartitionProperties.h \
    src/qwbfsdriver/PartitionStatus.h \
    src/models/Disc.h \
    src/models/DiscDelegate.h \
    src/models/DiscModel.h \
    src/qwbfsdriver/Driver.h \
    src/UIAbout.h \
    src/wiitdb/Covers.h \
    src/PropertiesDialog.h \
    src/Properties.h \
    src/ListView.h \
    src/ofi-labs-pictureflow/pictureflow-qt/pictureflow.h \
    src/CoverFlowView.h \
    src/models/pPartitionModel.h \
    src/models/PartitionDelegate.h \
    src/PartitionComboBox.h \
    src/models/pPartition.h

SOURCES *= src/main.cpp \
    src/Utils.cpp \
    src/UIMain.cpp \
    src/Gauge.cpp \
    src/PartitionWidget.cpp \
    src/ProgressDialog.cpp \
    src/WorkerThread.cpp \
    src/qwbfsdriver/PartitionDiscHandle.cpp \
    src/qwbfsdriver/PartitionHandle.cpp \
    src/qwbfsdriver/PartitionProperties.cpp \
    src/qwbfsdriver/PartitionStatus.cpp \
    src/models/Disc.cpp \
    src/models/DiscDelegate.cpp \
    src/models/DiscModel.cpp \
    src/qwbfsdriver/Driver.cpp \
    src/UIAbout.cpp \
    src/wiitdb/Covers.cpp \
    src/PropertiesDialog.cpp \
    src/Properties.cpp \
    src/ListView.cpp \
    src/ofi-labs-pictureflow/pictureflow-qt/pictureflow.cpp \
    src/CoverFlowView.cpp \
    src/models/pPartitionModel.cpp \
    src/models/PartitionDelegate.cpp \
    src/PartitionComboBox.cpp \
    src/models/pPartition.cpp

linux* {
    QT *= dbus
    LIBS *= -ludev
    SOURCES *= src/models/pPartitionModel_linux.cpp
}

macx {
    LIBS *= "-framework DiskArbitration" "-framework CoreServices"
    OBJECTIVE_SOURCES *= src/models/pPartitionModel_mac.mm
}

win32 {
    SOURCES *= src/models/pPartitionModel_win.cpp
}

include( installs.pri )


code: IDI_ICON1   ICON    DISCARDABLE "qwbfsmanager.ico"

repo_name: CYBERDEViL/qwbfsmanager

license: unknown


code:
<RCC>
  <qresource prefix="/files">
    <file>../../GPL-2</file>
  </qresource>
  <qresource prefix="/wii">
    <file alias="wiitdb.png">wiitdb.png</file>
    <file alias="cover.png">wii-cover.png</file>
    <file alias="disc.png">wii-disc.png</file>
  </qresource>
  <qresource prefix="/icons">
    <file>128/iso-to-wbfs.png</file>
    <file>128/wbfs-to-iso.png</file>
    <file>donation.png</file>
    <file>qwbfsmanager.png</file>
    <file>splashscreen.png</file>
    <file>256/tools.png</file>
    <file>256/covers.png</file>
    <file>256/read-partition.png</file>
    <file>256/folder.png</file>
    <file>256/about.png</file>
    <file>256/add.png</file>
    <file>256/clear.png</file>
    <file>256/detailed.png</file>
    <file>256/error.png</file>
    <file>256/export.png</file>
    <file>256/format.png</file>
    <file>256/import.png</file>
    <file>256/properties.png</file>
    <file>256/quit.png</file>
    <file>256/reload.png</file>
    <file>256/remove.png</file>
    <file>256/rename.png</file>
    <file>256/success.png</file>
    <file>256/tree.png</file>
    <file>256/linux.png</file>
    <file>256/mac.png</file>
    <file>256/windows.png</file>
    <file>256/wii.png</file>
    <file>256/hdd.png</file>
  </qresource>
</RCC>


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : CoverFlowView.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "CoverFlowView.h"
#include "models/DiscModel.h"

#include <QScrollBar>
#include <QTimer>
#include <QHelpEvent>
#include <QToolTip>
#include <QWhatsThis>
#include <QPainter>
#include <QDebug>

#define COVERFLOWVIEW_ITEM_SIZE QSize( 180, 240 )

CoverFlowView::CoverFlowView( QWidget* parent )
    : PictureFlow( parent )
{
    mScrollBar = new QScrollBar( Qt::Horizontal, this );
    mModel = 0;
    mColumn = -1;
    mDisplayTextColumn = -1;
    mTimer = new QTimer( this );
    mTimer->setSingleShot( true );

    mScrollBar->setSingleStep( 1 );
    mScrollBar->setPageStep( 1 );

    setBackgroundColor( palette().color( backgroundRole() ).darker() );

    connect( mTimer, SIGNAL( timeout() ), this, SLOT( delayedResizeEvent() ) );
    connect( mScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( showSlide( int ) ) );
    connect( this, SIGNAL( centerIndexChanged( int ) ), this, SLOT( updateScrollBarState() ) );
}

CoverFlowView::~CoverFlowView()
{
}

bool CoverFlowView::event( QEvent* event )
{
    switch ( event->type() ) {
        case QEvent::ToolTip:
        case QEvent::WhatsThis: {
            const QHelpEvent* he = static_cast<QHelpEvent*>( event );
            const QString text = modelIndex( centerIndex(), mColumn ).data( Qt::ToolTipRole ).toString();

            if ( !text.isEmpty() ) {
                if ( event->type() == QEvent::ToolTip ) {
                    QToolTip::showText( he->globalPos(), text, this );
                }
                else if ( event->type() == QEvent::ToolTip ) {
                    QWhatsThis::showText( he->globalPos(), text, this );
                }
            }

            event->accept();
            return true;
        }
        default:
            break;
    }

    return PictureFlow::event( event );
}

void CoverFlowView::resizeEvent( QResizeEvent* event )
{
    PictureFlow::resizeEvent( event );

    const int sbMargin = 10;
    const int sbHeight = 16;
    QRect sbRect = QRect( QPoint( sbMargin, height() -sbHeight -sbMargin ), QSize( width() -( sbMargin *2 ), sbHeight ) );
    mScrollBar->setGeometry( sbRect );

    mTimer->start( 500 );
}

void CoverFlowView::paintEvent( QPaintEvent* event )
{
    PictureFlow::paintEvent( event );

    QPainter painter( this );

    const QString text = modelIndex( centerIndex(), mDisplayTextColumn ).data( Qt::DisplayRole ).toString();
    const int flags = Qt::AlignCenter | Qt::TextWordWrap;
    QRect rect = QRect( QPoint(), QSize( width(), 40 ) );

    rect.moveBottom( mScrollBar->pos().y() -5 );

    painter.drawText( rect, flags, text );
}

void CoverFlowView::_q_dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight )
{
    if ( topLeft.parent() != mRootIndex || ( mColumn < topLeft.column() && mColumn > bottomRight.column() ) ) {
        return;
    }

    const int start = topLeft.row();
    const int end = bottomRight.row();

    for ( int i = start; i < end +1; i++ ) {
        setSlide( i, pixmap( i ) );
    }
}

void CoverFlowView::_q_layoutChanged()
{
    initialize();
}

void CoverFlowView::_q_modelReset()
{
    initialize();
}

void CoverFlowView::_q_rowsInserted( const QModelIndex& parent, int start, int end )
{
    if ( parent == mRootIndex ) {
        for ( int i = start; i < end +1; i++ ) {
            insertSlide( i, pixmap( i ) );
        }

        setCenterIndex( start );
        updateScrollBarState();
    }
}

void CoverFlowView::_q_rowsMoved( const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destinationParent, int destinationRow )
{
    Q_UNUSED( sourceParent );
    Q_UNUSED( sourceStart );
    Q_UNUSED( sourceEnd );
    Q_UNUSED( destinationParent );
    Q_UNUSED( destinationRow );
    qWarning() << Q_FUNC_INFO;
}

void CoverFlowView::_q_rowsRemoved( const QModelIndex& parent, int start, int end )
{
    if ( parent == mRootIndex ) {
        for ( int i = end; i >= start; i-- ) {
            removeSlide( i );
        }

        updateScrollBarState();
    }
}

void CoverFlowView::delayedResizeEvent()
{
    const qreal height = (qreal)this->height() *(qreal)0.50;
    const qreal factor = 180.0 /240.0;
    QSize size = QSize( height *factor, height );

    setSlideSize( size );
    initialize( centerIndex() );
}

void CoverFlowView::initialize( int index )
{
    clear();

    if ( mModel ) {
        for ( int i = 0; i < mModel->rowCount(); i++ ) {
            addSlide( pixmap( i ) );
        }
    }

    setCenterIndex( index );
    updateScrollBarState();
}

void CoverFlowView::updateScrollBarState()
{
    mScrollBar->setMinimum( 0 );
    mScrollBar->setMaximum( mModel ? mModel->rowCount() -1 : 0 );

    if ( animatorStep() == 0 ) {
        mScrollBar->setValue( centerIndex() );
    }

    emit centerIndexChanged( modelIndex( centerIndex() ) );
}

void CoverFlowView::preload()
{
    if ( !mModel ) {
        return;
    }

    // try to load only few images on the left and right side
    // i.e. all visible ones plus some extra
    #define COUNT 10

    int indexes[ 2 *COUNT +1 ] ;
    int center = centerIndex();
    indexes[ 0 ] = center;

    for ( int j = 0; j < COUNT; j++ ) {
        indexes[ j *2 +1 ] = center +j +1;
        indexes[ j *2 +2 ] = center -j -1;
    }

    for ( int c = 0; c < 2 *COUNT +1; c++ ) {
        int i = indexes[ c ];

        if ( ( i >= 0 ) && ( i < slideCount() ) ) {
            if ( slide( i ).isNull() ) {
                // schedule thumbnail loading
                Q_UNUSED( pixmap( i ) );
            }
        }
    }
}

void CoverFlowView::setModel( QAbstractItemModel* model )
{
    if ( mModel == model ) {
        return;
    }

    if ( mModel ) {
        disconnect( this, SIGNAL( centerIndexChanged( int ) ), this, SLOT( preload() ) );

        disconnect( mModel, SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( _q_dataChanged( const QModelIndex&, const QModelIndex& ) ) );
        disconnect( mModel, SIGNAL( layoutChanged() ), this, SLOT( _q_layoutChanged() ) );
        disconnect( mModel, SIGNAL( modelReset() ), this, SLOT( _q_modelReset() ) );
        disconnect( mModel, SIGNAL( rowsInserted( const QModelIndex&, int, int ) ), this, SLOT( _q_rowsInserted( const QModelIndex&, int, int ) ) );
        disconnect( mModel, SIGNAL( rowsMoved( const QModelIndex&, int, int, const QModelIndex&, int ) ), this, SLOT( _q_rowsMoved( const QModelIndex&, int, int, const QModelIndex&, int ) ) );
        disconnect( mModel, SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ), this, SLOT( _q_rowsRemoved( const QModelIndex&, int, int ) ) );

        mModel = 0;
    }

    mModel = model;
    mColumn = -1;
    mDisplayTextColumn = -1;

    if ( mModel ) {
        connect( this, SIGNAL( centerIndexChanged( int ) ), this, SLOT( preload() ) );

        connect( mModel, SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ), this, SLOT( _q_dataChanged( const QModelIndex&, const QModelIndex& ) ) );
        connect( mModel, SIGNAL( layoutChanged() ), this, SLOT( _q_layoutChanged() ) );
        connect( mModel, SIGNAL( modelReset() ), this, SLOT( _q_modelReset() ) );
        connect( mModel, SIGNAL( rowsInserted( const QModelIndex&, int, int ) ), this, SLOT( _q_rowsInserted( const QModelIndex&, int, int ) ) );
        connect( mModel, SIGNAL( rowsMoved( const QModelIndex&, int, int, const QModelIndex&, int ) ), this, SLOT( _q_rowsMoved( const QModelIndex&, int, int, const QModelIndex&, int ) ) );
        connect( mModel, SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ), this, SLOT( _q_rowsRemoved( const QModelIndex&, int, int ) ) );
    }
}

QAbstractItemModel* CoverFlowView::model() const
{
    return mModel;
}

void CoverFlowView::setColumn( int column )
{
    if ( !mModel ) {
        return;
    }

    const int min = mModel->columnCount() > 0 ? 0 : -1;
    const int max = mModel->columnCount() > 0 ? mModel->columnCount() : -1;

    mColumn = qBound( min, column, max );

    initialize();
}

int CoverFlowView::column() const
{
    return mColumn;
}

void CoverFlowView::setDisplayTextColumn( int column )
{
    if ( !mModel ) {
        return;
    }

    const int min = mModel->columnCount() > 0 ? 0 : -1;
    const int max = mModel->columnCount() > 0 ? mModel->columnCount() : -1;

    mDisplayTextColumn = qBound( min, column, max );
}

int CoverFlowView::displayTextColumn() const
{
    return mDisplayTextColumn;
}

QModelIndex CoverFlowView::modelIndex( int index, int column ) const
{
    return mModel ? mModel->index( index, column == -1 ? mColumn : column, mRootIndex ) : QModelIndex();
}

QPixmap CoverFlowView::pixmap( int _index ) const
{
    const QModelIndex index = modelIndex( _index );
    const QWBFS::Model::DiscModel* model = qobject_cast<QWBFS::Model::DiscModel*>( mModel );
    const QWBFS::Model::Disc disc = model ? model->disc( index ) : QWBFS::Model::Disc();
    return model ? model->coverPixmap( disc.id, slideSize(), true ) : QPixmap();
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : CoverFlowView.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef COVERFLOWVIEW_H
#define COVERFLOWVIEW_H

#include "ofi-labs-pictureflow/pictureflow-qt/pictureflow.h"

#include <QPersistentModelIndex>

class QScrollBar;
class QAbstractItemModel;
class QModelIndex;
class QTimer;

class CoverFlowView : public PictureFlow
{
    Q_OBJECT

public:
    CoverFlowView( QWidget* parent = 0 );
    virtual ~CoverFlowView();

    void setModel( QAbstractItemModel* model );
    QAbstractItemModel* model() const;

    void setColumn( int column );
    int column() const;

    void setDisplayTextColumn( int column );
    int displayTextColumn() const;

protected:
    QScrollBar* mScrollBar;
    QAbstractItemModel* mModel;
    QPersistentModelIndex mRootIndex;
    int mColumn;
    int mDisplayTextColumn;
    QTimer* mTimer;

    virtual bool event( QEvent* event );
    virtual void resizeEvent( QResizeEvent* event );
    virtual void paintEvent( QPaintEvent* event );

    QModelIndex modelIndex( int index, int column = -1 ) const;
    virtual QPixmap pixmap( int index ) const;

protected slots:
    void _q_dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight );
    void _q_layoutChanged();
    void _q_modelReset();
    void _q_rowsInserted( const QModelIndex& parent, int start, int end );
    void _q_rowsMoved( const QModelIndex& sourceParent, int sourceStart, int sourceEnd, const QModelIndex& destinationParent, int destinationRow );
    void _q_rowsRemoved( const QModelIndex& parent, int start, int end );

    void delayedResizeEvent();
    void initialize( int index = 0 );
    void updateScrollBarState();
    void preload();

signals:
    void centerIndexChanged( const QModelIndex& index );
};

#endif // COVERFLOWVIEW_H


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : Gauge.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "Gauge.h"
#include "Utils.h"

#include <FreshCore/pCoreUtils>

#include <QStyleFactory>
#include <QStyleOptionProgressBarV2>
#include <QPainter>
#include <QDebug>

Gauge::Gauge( QWidget* parent )
    : QWidget( parent )
{
    setStyle( Utils::neutralStyle() );

    mSize = 0;
    mUsedSize = 0;
    mFreeSize = 0;
    mTemporarySize = 0;
}

Gauge::~Gauge()
{
}

QSize Gauge::sizeHint() const
{
    return QSize( 200, 21 );
}

QSize Gauge::minimumSizeHint() const
{
    return QSize( -1, sizeHint().height() );
}

void Gauge::setSize( qint64 value )
{
    mSize = qMax( Q_INT64_C( 0 ), value );
    update();
}

qint64 Gauge::size() const
{
    return mSize;
}

void Gauge::setUsedSize( qint64 value )
{
    mUsedSize = qMax( Q_INT64_C( 0 ), value );
    update();
}

qint64 Gauge::usedSize() const
{
    return mUsedSize;
}

void Gauge::setFreeSize( qint64 value )
{
    mFreeSize = qMax( Q_INT64_C( 0 ), value );
    update();
}

qint64 Gauge::freeSize() const
{
    return mFreeSize;
}

void Gauge::setTemporarySize( qint64 value )
{
    mTemporarySize = qMax( Q_INT64_C( 0 ), value );
    update();
}

qint64 Gauge::temporarySize() const
{
    return mTemporarySize;
}

void Gauge::paintEvent( QPaintEvent* event )
{
    Q_UNUSED( event );
    QPainter painter( this );
    const qreal available = mSize;
    const qreal used = mUsedSize;
    const qreal free = mFreeSize;
    const qreal max = used +mTemporarySize;
    const qreal total = qMax( available, max );
    const qreal cent = 100;
    const int totalPercent = available != 0 ? int( total /available *cent ) : 0;
    const int usedPercent = available != 0 ? int( used /available *cent ) : 0;
    const int extraPercent = max != used && available != 0 ? int( qBound( qreal(usedPercent), qreal(max /available *cent), cent ) ) : 0;
    const int overflowPercent = max > available ? int( available != 0 ? max /available *cent : 0 ) : 0;
    const int flags = Qt::AlignCenter | Qt::TextWordWrap;

    QStyleOptionProgressBarV2 option;
    option.bottomToTop = false;
    option.invertedAppearance = false;
    option.orientation = Qt::Horizontal;
    option.maximum = totalPercent;
    option.minimum = 0;
    option.progress = 0;
    option.text = option.text = tr( "Usage %1 (%2%) / %3 - Free %4 (%5%)" )
        .arg( pCoreUtils::fileSizeToString( used ) )
        .arg( pCoreUtils::fileSizeAdaptString( available != 0 ? used /available *cent : 0 ) )
        .arg( pCoreUtils::fileSizeToString( available ) )
        .arg( pCoreUtils::fileSizeToString( free ) )
        .arg( pCoreUtils::fileSizeAdaptString( available != 0 ? free /available *cent : 0 ) );
    option.textAlignment = Qt::AlignCenter;
    option.textVisible = true;
    option.direction = layoutDirection();
    option.fontMetrics = QFontMetrics( font() );
    option.palette = palette();
    option.rect = rect();
    option.state = QStyle::State_Horizontal;

    if ( isEnabled() ) {
        option.state |= QStyle::State_Active;
        option.state |= QStyle::State_Enabled;
    }

    if ( hasFocus() ) {
        option.state |= QStyle::State_HasFocus;
    }

    // groove
    style()->drawControl( QStyle::CE_ProgressBarGroove, &option, &painter, this );

    // overflow
    if ( overflowPercent != 0 ) {
        option.progress = overflowPercent;
        option.palette.setColor( QPalette::Highlight, QColor( 255, 181, 213, 255 ) );
        style()->drawControl( QStyle::CE_ProgressBarContents, &option, &painter, this );
    }

    // extra
    if ( extraPercent != 0 ) {
        option.progress = extraPercent;
        option.palette.setColor( QPalette::Highlight, QColor( 213, 255, 181, 255 ) );
        style()->drawControl( QStyle::CE_ProgressBarContents, &option, &painter, this );
    }

    // used
    if ( usedPercent != 0 ) {
        option.progress = usedPercent;
        option.palette.setColor( QPalette::Highlight, palette().color( QPalette::Highlight ) );
        style()->drawControl( QStyle::CE_ProgressBarContents, &option, &painter, this );
    }

    // text painter.setPen( option.palette.color( QPalette::Text ) );
    painter.setBrush( Qt::NoBrush );
    painter.drawText( rect(), flags, option.text );
    //style()->drawControl( QStyle::CE_ProgressBarLabel, &option, &painter, this );
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : Gauge.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef GAUGE_H
#define GAUGE_H

#include <QWidget>

class Gauge : public QWidget
{
    Q_OBJECT

public:
    Gauge( QWidget* parent = 0 );
    virtual ~Gauge();

    virtual QSize sizeHint() const;
    virtual QSize minimumSizeHint() const;

    qint64 size() const;
    qint64 usedSize() const;
    qint64 freeSize() const;
    qint64 temporarySize() const;

public slots:
    void setSize( qint64 value );
    void setUsedSize( qint64 value );
    void setFreeSize( qint64 value );
    void setTemporarySize( qint64 value );

protected:
    qint64 mSize;
    qint64 mUsedSize;
    qint64 mFreeSize;
    qint64 mTemporarySize;

    virtual void paintEvent( QPaintEvent* event );
};

#endif // GAUGE_H


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : ListView.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "ListView.h"
#include "models/DiscModel.h"
#include "models/DiscDelegate.h"

#include <QMouseEvent>
#include <QHeaderView>
#include <QPainter>
#include <QDrag>
#include <QDebug>

ListView::ListView( QWidget* parent )
    : QListView( parent )
{
    mIconType = QWBFS::WiiTDB::Cover;
    mDriver = 0;
    mModel = 0;
    mDelegate = 0;
    mHeader = new QHeaderView( Qt::Horizontal, this );
    mCacheManager = 0;

    QPalette pal = viewport()->palette();
    pal.setColor( viewport()->backgroundRole(), pal.color( viewport()->backgroundRole() ).darker() );

    setMouseTracking( true );
    setAttribute( Qt::WA_MacShowFocusRect, false );
    setViewportMargins( 0, HEADER_HEIGHT, 0, 0 );
    viewport()->setPalette( pal );
    viewport()->setAutoFillBackground( true );

    connect( mHeader, SIGNAL( sortIndicatorChanged( int, Qt::SortOrder ) ), this, SLOT( header_sortIndicatorChanged( int, Qt::SortOrder ) ) );
}

ListView::~ListView()
{
}

void ListView::initialize( QWBFS::Driver* driver, pNetworkAccessManager* manager )
{
    delete mModel;
    delete mDelegate;
    mDriver = driver;
    mModel = new QWBFS::Model::DiscModel( this, mDriver );
    mDelegate = new QWBFS::Model::DiscDelegate( mModel, manager );
    mCacheManager = manager;

    setModel( mModel );
    setItemDelegate( mDelegate );
    mHeader->setModel( mModel );

    mHeader->setSectionHidden( 0, true );
    mHeader->setSectionHidden( 5, true );

    for ( int i = 0; i < mModel->columnCount(); i++ ) {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
        mHeader->setSectionResizeMode( i, QHeaderView::ResizeToContents );
#else
        mHeader->setResizeMode( i, QHeaderView::ResizeToContents );
#endif
    }

#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
    mHeader->setSectionResizeMode( 2, QHeaderView::Stretch );
    mHeader->setSectionsClickable( true );
#else
    mHeader->setResizeMode( 2, QHeaderView::Stretch );
    mHeader->setClickable( true );
#endif
    mHeader->setSortIndicatorShown( true );
}

void ListView::setViewMode( QListView::ViewMode mode )
{
    const bool wasDragEnabled = dragEnabled();
    const bool wasAcceptDrops = acceptDrops();
    const bool wasViewportAcceptDrops = viewport()->acceptDrops();

    QListView::setViewMode( mode );
    setMovement( QListView::Static );
    setResizeMode( QListView::Adjust );
    setAlternatingRowColors( false );

    switch ( mode ) {
        case QListView::ListMode: {
            setFlow( QListView::TopToBottom );
            break;
        }
        case QListView::IconMode: {
            setFlow( QListView::LeftToRight );
            break;
        }
    }

    setDragEnabled( wasDragEnabled );
    setAcceptDrops( wasAcceptDrops );
    viewport()->setAcceptDrops( wasViewportAcceptDrops );
}

void ListView::setViewIconType( QWBFS::WiiTDB::Scan scan )
{
    mIconType = scan;
    updateGeometries();
}

QWBFS::WiiTDB::Scan ListView::viewIconType() const
{
    return mIconType;
}

QWBFS::Driver* ListView::driver() const
{
    return mDriver;
}

QWBFS::Model::DiscModel* ListView::model() const
{
    return mModel;
}

pNetworkAccessManager* ListView::cacheManager() const
{
    return mCacheManager;
}

void ListView::header_sortIndicatorChanged( int logicalIndex, Qt::SortOrder order )
{
    mModel->sort( logicalIndex, order );

    if ( selectionModel()->hasSelection() ) {
        scrollTo( selectionModel()->selectedIndexes().last() );
    }
}

void ListView::resizeEvent( QResizeEvent* event )
{
    QListView::resizeEvent( event );

    QRect rect = QRect( QPoint( frameWidth(), frameWidth() ), QSize( viewport()->width(), HEADER_HEIGHT ) );
    mHeader->setGeometry( rect );
}

void ListView::mousePressEvent( QMouseEvent* event )
{
    const QModelIndex index = indexAt( event->pos() );
    const bool isSelected = selectionModel()->isSelected( index );
    const bool leftButtonNoModifier = event->buttons() == Qt::LeftButton && event->modifiers() == Qt::NoModifier;

    QListView::mousePressEvent( event );

    if ( isSelected && leftButtonNoModifier && dragEnabled() ) {
        setState( QAbstractItemView::DraggingState );
    }
    else {
        setState( QAbstractItemView::DragSelectingState );
    }
}

void ListView::startDrag( Qt::DropActions supportedActions )
{
    QModelIndexList indexes = selectionModel()->selectedIndexes();

    if ( indexes.count() > 0 ) {
        QMimeData *data = model()->mimeData( indexes );

        if ( !data ) {
            return;
        }

        QRect rect;
        QPixmap pixmap = renderToPixmap( indexes, &rect );
        //rect.adjust( horizontalOffset(), verticalOffset(), 0, 0 ); // P@sNox: This cause a decal in the preview that cause the QDrag pixmap to not be visible.

        QDrag* drag = new QDrag( this );
        drag->setPixmap( pixmap );
        drag->setMimeData( data );
        drag->setHotSpot( viewport()->mapFromGlobal( QCursor::pos() ) -rect.topLeft() );

        Qt::DropAction defaultDropAction = Qt::IgnoreAction;

        if ( this->defaultDropAction() != Qt::IgnoreAction && (supportedActions & this->defaultDropAction() ) ) {
            defaultDropAction = this->defaultDropAction();
        }
        else if ( supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove ) {
            defaultDropAction = Qt::CopyAction;
        }

        if ( drag->exec(supportedActions, defaultDropAction ) == Qt::MoveAction ) {
            clearOrRemove();
        }
    }
}

// dirty code get from QAbstractItemView for avoid drag & drop bug (no preview when dragging)

QItemViewPaintPairs ListView::draggablePaintPairs( const QModelIndexList& indexes, QRect* r ) const
{
    Q_ASSERT( r );
    QRect& rect = *r;
    const QRect viewportRect = viewport()->rect();
    QItemViewPaintPairs ret;

    for ( int i = 0; i < indexes.count(); ++i ) {
        const QModelIndex& index = indexes.at( i );
        const QRect current = visualRect( index );

        if ( current.intersects( viewportRect ) ) {
            ret += qMakePair( current, index );
            rect |= current;
        }
    }

    rect &= viewportRect;
    return ret;
}

QStyleOptionViewItemV4 ListView::viewOptionsV4() const
{
    QStyleOptionViewItemV4 option = viewOptions();

    if ( wordWrap() ) {
        option.features = QStyleOptionViewItemV2::WrapText;
    }

    option.locale = locale();
    option.locale.setNumberOptions( QLocale::OmitGroupSeparator );
    option.widget = this;

    return option;
}

QPixmap ListView::renderToPixmap( const QModelIndexList& indexes, QRect* r ) const
{
    Q_ASSERT( r );
    QItemViewPaintPairs paintPairs = draggablePaintPairs( indexes, r );

    if ( paintPairs.isEmpty() ) {
        return QPixmap();
    }

    QPixmap pixmap( r->size() );
    pixmap.fill( Qt::transparent );

    QPainter painter( &pixmap );
    QStyleOptionViewItemV4 option = viewOptionsV4();
    option.state |= QStyle::State_Selected;

    for ( int j = 0; j < paintPairs.count(); ++j ) {
        option.rect = paintPairs.at( j ).first.translated( -r->topLeft() );
        const QModelIndex& current = paintPairs.at( j ).second;

        itemDelegate( current )->paint( &painter, option, current );
    }

    return pixmap;
}

void ListView::clearOrRemove()
{
    const QItemSelection selection = selectionModel()->selection();
    QList<QItemSelectionRange>::const_iterator it = selection.constBegin();

    if ( !dragDropOverwriteMode() ) {
        for ( ; it != selection.constEnd(); ++it ) {
            QModelIndex parent = (*it).parent();

            if ( (*it).left() != 0 ) {
                continue;
            }

            if ( (*it).right() != ( model()->columnCount( parent ) -1 ) ) {
                continue;
            }

            int count = (*it).bottom() -(*it).top() +1;
            model()->removeRows( (*it).top(), count, parent );
        }
    } else {
        // we can't remove the rows so reset the items (i.e. the view is like a table)
        QModelIndexList list = selection.indexes();

        for ( int i = 0; i < list.size(); ++i ) {
            QModelIndex index = list.at( i );
            QMap<int, QVariant> roles = model()->itemData( index );

            for ( QMap<int, QVariant>::Iterator it = roles.begin(); it != roles.end(); ++it ) {
                it.value() = QVariant();
            }

            model()->setItemData( index, roles );
        }
    }
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : ListView.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef LISTVIEW_H
#define LISTVIEW_H

#include <QListView>

#include "wiitdb/Covers.h"

class QHeaderView;
class pNetworkAccessManager;

namespace QWBFS {
class Driver;
namespace Model {
struct Disc;
class DiscModel;
class DiscDelegate;
}; // Model
}; // QWBFS

typedef QPair<QRect, QModelIndex> QItemViewPaintPair;
typedef QList<QItemViewPaintPair> QItemViewPaintPairs;

#define HEADER_HEIGHT 21

class ListView : public QListView
{
    Q_OBJECT

public:
    ListView( QWidget* parent = 0 );
    virtual ~ListView();

    void initialize( QWBFS::Driver* driver, pNetworkAccessManager* manager );
    void setViewMode( QListView::ViewMode mode );
    void setViewIconType( QWBFS::WiiTDB::Scan scan );

    QWBFS::WiiTDB::Scan viewIconType() const;
    QWBFS::Driver* driver() const;
    QWBFS::Model::DiscModel* model() const;
    pNetworkAccessManager* cacheManager() const;

protected slots:
    void header_sortIndicatorChanged( int logicalIndex, Qt::SortOrder order );

protected:
    QWBFS::WiiTDB::Scan mIconType;
    QWBFS::Driver* mDriver;
    QWBFS::Model::DiscModel* mModel;
    QWBFS::Model::DiscDelegate* mDelegate;
    pNetworkAccessManager* mCacheManager;
    QHeaderView* mHeader;

    virtual void resizeEvent( QResizeEvent* event );
    virtual void mousePressEvent( QMouseEvent* event );
    virtual void startDrag( Qt::DropActions supportedActions );

    // dirty code get from QAbstractItemView for avoid drag & drop bug (no preview when dragging)

    QItemViewPaintPairs draggablePaintPairs( const QModelIndexList& indexes, QRect* r ) const;
    QPixmap renderToPixmap( const QModelIndexList& indexes, QRect* r ) const;
    QStyleOptionViewItemV4 viewOptionsV4() const;
    void clearOrRemove();
};

#endif // LISTVIEW_H


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : PartitionComboBox.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "PartitionComboBox.h"
#include "models/PartitionDelegate.h"

#include "models/pPartitionModel.h"

#include <QPainter>
#include <QHelpEvent>
#include <QToolTip>
#include <QToolButton>
#include <QHBoxLayout>
#include <QInputDialog>
#include <QDebug>

Q_GLOBAL_STATIC( pPartitionModel, _partitionModel );

pPartitionModel* PartitionComboBox::partitionModel()
{
    return _partitionModel();
}

PartitionComboBox::PartitionComboBox( QWidget* parent )
    : QComboBox( parent )
{
    mButton = new QToolButton( this );
    mButton->setAutoRaise( true );
    mButton->setIcon( QIcon( ":/icons/256/properties.png" ) );
    mButton->setToolTip( tr( "Add a partition" ) );

    QHBoxLayout* hl = new QHBoxLayout( this );
    hl->setMargin( 0 );
    hl->setSpacing( 5 );
    hl->addStretch();
    hl->addWidget( mButton );

    setAttribute( Qt::WA_Hover, true );
    setModel( partitionModel() );
    setModelColumn( pPartition::DevicePath );
    setItemDelegate( new PartitionDelegate( partitionModel() ) );

    connect( partitionModel(), SIGNAL( rowsInserted( const QModelIndex&, int, int ) ), this, SLOT( modelChanged() ) );
    connect( partitionModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ), this, SLOT( modelChanged() ) );
    connect( partitionModel(), SIGNAL( layoutChanged() ), this, SLOT( modelChanged() ) );
    connect( partitionModel(), SIGNAL( modelReset() ), this, SLOT( modelChanged() ) );
    connect( mButton, SIGNAL( clicked() ), this, SLOT( addPartition() ) );

    modelChanged();
}

PartitionComboBox::~PartitionComboBox()
{
}

void PartitionComboBox::modelChanged()
{
    bool custom = true;

    foreach ( const pPartition& partition, partitionModel()->partitions() ) {
        if ( !partition.isCustom() ) {
            custom = false;
            break;
        }
    }

    mButton->setVisible( custom );
}

void PartitionComboBox::addPartition()
{
    const QString partition = QInputDialog::getText( this, QString::null, tr( "Enter a partition path" ) );

    if ( !partition.isNull() && findText( partition ) == -1 ) {
        partitionModel()->addPartition( partition );
    }

    if ( !partition.isNull() ) {
        setCurrentIndex( findText( partition ) );
    }
}

bool PartitionComboBox::event( QEvent* event )
{
    if ( event->type() == QEvent::ToolTip ) {
        QHelpEvent* he = static_cast<QHelpEvent*>( event );
        QStringList tooltip( toolTip() );

        if ( currentIndex() != -1 ) {
            tooltip << QString( "%1" ).arg( tr( "Current Partition" ) );
            tooltip << itemData( currentIndex(), Qt::ToolTipRole ).toString();
        }

        QToolTip::showText( he->globalPos(), tooltip.join( "
" ), this );
        return true;
    }

    return QComboBox::event( event );
}

void PartitionComboBox::paintEvent( QPaintEvent* event )
{
    Q_UNUSED( event );
    QPainter painter( this );

    QStyleOptionComboBox option;
    initStyleOption( &option );
    option.rect.setWidth( layout()->itemAt( 0 )->geometry().width() -layout()->spacing() );

    if ( option.state & QStyle::State_MouseOver || currentIndex() == -1 ) {
        style()->drawComplexControl( QStyle::CC_ComboBox, &option, &painter, this );
        style()->drawControl( QStyle::CE_ComboBoxLabel, &option, &painter, this );
    }
    else {
        const QModelIndex index = partitionModel()->QAbstractTableModel::index( currentIndex(), modelColumn(), rootModelIndex() );

        QStyleOptionViewItemV4 o;
        o.initFrom( this );
        o.widget = this;
        o.rect = option.rect;

        itemDelegate()->paint( &painter, o, index );
    }
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : PartitionComboBox.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef PARTITIONCOMBOBOX_H
#define PARTITIONCOMBOBOX_H

#include <QComboBox>

class pPartitionModel;
class QToolButton;

class PartitionComboBox : public QComboBox
{
    Q_OBJECT

public:
    PartitionComboBox( QWidget* parent = 0 );
    virtual ~PartitionComboBox();

    static pPartitionModel* partitionModel();

protected slots:
    void modelChanged();
    void addPartition();

protected:
    QToolButton* mButton;

    virtual bool event( QEvent* event );
    virtual void paintEvent( QPaintEvent* event );
};

#endif // PARTITIONCOMBOBOX_H


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : PartitionWidget.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "PartitionWidget.h"
#include "qwbfsdriver/Driver.h"
#include "models/DiscModel.h"
#include "Properties.h"
#include "ProgressDialog.h"
#include "UIMain.h"

#include <FreshCore/pNetworkAccessManager>
#include "models/pPartitionModel.h"

#include <QLineEdit>
#include <QInputDialog>
#include <QMessageBox>
#include <QMimeData>
#include <QDebug>

PartitionWidget::PartitionWidget( QWidget* parent )
    : QWidget( parent )
{
    Q_ASSERT( parent );
    const UIMain* window = qobject_cast<UIMain*>( parent->window() );
    const Properties properties( this );

    setupUi( this );
    setAcceptDrops( true );

    mDriver = new QWBFS::Driver( this );

    lvDiscs->initialize( mDriver, window->cache() );
    lvDiscs->setViewMode( properties.viewMode() );
    lvDiscs->setViewIconType( properties.viewIconType() );
    cfvDiscs->setModel( lvDiscs->model() );
    cfvDiscs->setColumn( 0 );
    cfvDiscs->setDisplayTextColumn( 2 );
    lvImport->initialize( mDriver, window->cache() );
    lvImport->setViewMode( properties.viewMode() );
    lvImport->setViewIconType( properties.viewIconType() );

    QPalette cfvPal = cfvDiscs->palette();
    cfvPal.setColor( QPalette::WindowText, QColor( 255, 255, 255 ) );
    cfvDiscs->setPalette( cfvPal );

    QFont cfvFont = cfvDiscs->font();
    cfvFont.setBold( true );
    cfvFont.setPixelSize( 18 );
    cfvDiscs->setFont( cfvFont );

    sViews->setSizes( QList<int>() << QWIDGETSIZE_MAX << fImport->minimumSizeHint().height() );

    localeChanged();

    connect( lvDiscs->model(), SIGNAL( countChanged( int ) ), this, SLOT( models_countChanged() ) );
    connect( lvImport->model(), SIGNAL( countChanged( int ) ), this, SLOT( models_countChanged() ) );
    connect( cfvDiscs, SIGNAL( centerIndexChanged( const QModelIndex& ) ), this, SLOT( coverFlow_centerIndexChanged( const QModelIndex& ) ) );
    connect( lvDiscs->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( views_selectionChanged() ) );
    connect( lvImport->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( views_selectionChanged() ) );
}

PartitionWidget::~PartitionWidget()
{
    mDriver->close();
}

bool PartitionWidget::event( QEvent* event )
{
    switch ( event->type() ) {
        case QEvent::LocaleChange:
            localeChanged();
            break;
        default:
            break;
    }

    return QWidget::event( event );
}

const QWBFS::Driver* PartitionWidget::driver() const
{
    return mDriver;
}

QWBFS::Model::DiscModel* PartitionWidget::discModel() const
{
    return lvDiscs->model();
}

QWBFS::Model::DiscModel* PartitionWidget::importModel() const
{
    return lvImport->model();
}

QToolButton* PartitionWidget::showHideImportViewButton() const
{
    return tbShowHideImportView;
}

QString PartitionWidget::currentPartition() const
{
    return cbPartitions->itemText( cbPartitions->currentIndex() );
}

void PartitionWidget::setMainView( bool main )
{
    tbOpen->setVisible( main );
    tbClose->setVisible( !main );
}

void PartitionWidget::setCurrentPartition( const QString& partition )
{
    if ( mDriver->partition() != partition || currentPartition() != partition ) {
        mDriver->setPartition( partition );
        cbPartitions->setCurrentIndex( cbPartitions->findText( partition ) );
        tbLoad->click();
    }
}

void PartitionWidget::showError( const QString& error )
{
    mainWindow()->messageToolBar()->appendMessage( error );
}

void PartitionWidget::showError( int error )
{
    showError( QWBFS::Driver::errorToString( QWBFS::Driver::Error( error ) ) );
}

void PartitionWidget::dragEnterEvent( QDragEnterEvent* event )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
    if ( mDriver->isOpen() && !findChildren<QWidget*>().contains( qobject_cast<QWidget*>( event->source() ) ) ) {
#else
    if ( mDriver->isOpen() && !findChildren<QWidget*>().contains( event->source() ) ) {
#endif
        foreach ( const QString& mimeType, importModel()->mimeTypes() ) {
            if ( event->mimeData()->hasFormat( mimeType ) ) {
                event->setDropAction( Qt::CopyAction );
                event->accept();
                return;
            }
        }
    }
}

void PartitionWidget::dropEvent( QDropEvent* event )
{
    if ( !fImport->isVisible() ) {
        tbShowHideImportView->toggle();
    }

    importModel()->dropMimeData( event->mimeData(), event->proposedAction(), -1, -1, QModelIndex() );
    event->acceptProposedAction();
}

UIMain* PartitionWidget::mainWindow() const
{
    return qobject_cast<UIMain*>( window() );
}

void PartitionWidget::localeChanged()
{
    retranslateUi( this );
    lInformations->setText( tr( "%1 disc(s) on the partition - %2 disc(s) to import." ).arg( discModel()->rowCount() ).arg( importModel()->rowCount() ) );
}

void PartitionWidget::models_countChanged()
{
    QWBFS::Partition::Status status;
    /*const int result = */mDriver->status( status );

    gStatus->setSize( status.size );
    gStatus->setUsedSize( status.used );
    gStatus->setFreeSize( status.free );
    gStatus->setTemporarySize( importModel()->size() );
    lInformations->setText( tr( "%1 disc(s) on the partition - %2 disc(s) to import." ).arg( discModel()->rowCount() ).arg( importModel()->rowCount() ) );

    /*if ( result != QWBFS::Driver::Ok ) {
        showError( result );
    }*/
}

void PartitionWidget::views_selectionChanged()
{
    const QItemSelectionModel* sm = qobject_cast<const QItemSelectionModel*>( sender() );
    const QWBFS::Model::DiscModel* model = qobject_cast<const QWBFS::Model::DiscModel*>( sm->model() );
    const QModelIndexList indexes = sm->selectedIndexes();

    emit coverRequested( indexes.isEmpty() ? QString::null : model->discId( indexes.last() ) );
}

void PartitionWidget::coverFlow_centerIndexChanged( const QModelIndex& index )
{
    emit coverRequested( index.isValid() ? lvDiscs->model()->discId( index ) : QString::null );
}

void PartitionWidget::progress_jobFinished( const QWBFS::Model::Disc& disc )
{
    importModel()->updateDisc( disc );
}

void PartitionWidget::progress_finished()
{
    PartitionComboBox::partitionModel()->update();
    tbLoad->click();
}

void PartitionWidget::on_cbPartitions_currentIndexChanged( int index )
{
    if ( window()->isVisible() ) { // dirty hack because qcombobox automatically set the current index to the first item on model set and this can produce errors (partition is not wbfs)
        setCurrentPartition( cbPartitions->itemText( index ) );
    }
}

void PartitionWidget::on_tbLoad_clicked()
{
    if ( !mDriver->open() && !mDriver->partition().isEmpty() ) {
        showError( tr( "Can't open partition." ) );
    }

    if ( discModel()->rowCount() == 0 ) {
        models_countChanged();
    }
    else {
        discModel()->clear();
    }

    if ( mDriver->isOpen() ) {
        QWBFS::Model::DiscList discs;
        const int result = mDriver->discList( discs );

        if ( result == QWBFS::Driver::Ok ) {
            discModel()->setDiscs( discs );

            if ( discModel()->rowCount() == 0 ) {
                models_countChanged();
            }
        }
        else {
            showError( result );
        }
    }
}

void PartitionWidget::on_tbFormat_clicked()
{
    const QString text = tr( "The partition '%1' will be formatted,\nall data will be erased permanently, are you sure?" ).arg( mDriver->partition() );
    const QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
    const QMessageBox::StandardButton button = QMessageBox::No;

    if ( QMessageBox::question( this, QString::null, text, buttons, button ) == button ) {
        return;
    }

    if ( mDriver->format() ) {
        tbLoad->click();
    }
    else {
        showError( tr( "Can't format partition." ) );
    }
}

void PartitionWidget::on_tbOpen_clicked()
{
    emit openViewRequested();
}

void PartitionWidget::on_tbClose_clicked()
{
    emit closeViewRequested();
}

void PartitionWidget::on_tbRemoveDiscs_clicked()
{
    const QModelIndexList indexes = lvDiscs->selectionModel()->selectedIndexes();

    const QString text = tr( "You are about to permanently delete %1 disc(s) on partition '%2', are you sure?" ).arg( indexes.count() ).arg( mDriver->partition() );
    const QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
    const QMessageBox::StandardButton button = QMessageBox::No;

    if ( indexes.isEmpty() || QMessageBox::question( this, QString::null, text, buttons, button ) == button ) {
        return;
    }

    int errors = 0;

    for ( int i = indexes.count() -1; i >= 0; i-- ) {
        const QModelIndex& index = indexes[ i ];
        const QString discId = discModel()->discId( index );

        if ( mDriver->removeDisc( discId ) == QWBFS::Driver::Ok ) {
            discModel()->removeRow( index.row() );
        }
        else {
            errors++;
        }
    }

    if ( errors > 0 ) {
        showError( tr( "One or more discs have failed to be removed." ) );
    }
}

void PartitionWidget::on_tbRenameDisc_clicked()
{
    const QModelIndex index = lvDiscs->selectionModel()->selectedIndexes().value( 0 );
    const QWBFS::Model::Disc disc = discModel()->disc( index );

    if ( !index.isValid() ) {
        return;
    }

    const QString name = QInputDialog::getText( this, QString::null, tr( "Choose a new name for the disc" ), QLineEdit::Normal, disc.title );

    if ( name.isNull() ) {
        return;
    }

    if ( mDriver->renameDisc( disc.id, name ) == QWBFS::Driver::Ok ) {
        discModel()->setData( index, name, Qt::DisplayRole );
    }
    else {
        showError( tr( "Can't rename disc id #%1 (%2) to '%3'" ).arg( disc.id ).arg( disc.title ).arg( name ) );
    }
}

void PartitionWidget::on_tbClearImport_clicked()
{
    importModel()->clear();
}

void PartitionWidget::on_tbRemoveImport_clicked()
{
    importModel()->removeSelection( lvImport->selectionModel()->selection() );
}

void PartitionWidget::on_tbImport_clicked()
{
    if ( importModel()->rowCount() == 0 ) {
        return;
    }

    ProgressDialog* dlg = new ProgressDialog( this );

    connect( dlg, SIGNAL( jobFinished( const QWBFS::Model::Disc& ) ), this, SLOT( progress_jobFinished( const QWBFS::Model::Disc& ) ) );
    connect( dlg, SIGNAL( finished() ), this, SLOT( progress_finished() ) );

    WorkerThread::Work work;
    work.task = WorkerThread::ImportWBFS;
    work.discs = importModel()->discs();
    work.target = mDriver->handle().partition();
    work.window = dlg;

    dlg->setWork( work );
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : PartitionWidget.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef PARTITIONWIDGET_H
#define PARTITIONWIDGET_H

#include "ui_PartitionWidget.h"

class UIMain;

namespace QWBFS {
class Driver;
namespace Model {
struct Disc;
class DiscModel;
}; // Model
}; // QWBFS

class PartitionWidget : public QWidget, public Ui::PartitionWidget
{
    Q_OBJECT

public:
    PartitionWidget( QWidget* parent = 0 );
    virtual ~PartitionWidget();

    virtual bool event( QEvent* event );

    const QWBFS::Driver* driver() const;
    QWBFS::Model::DiscModel* discModel() const;
    QWBFS::Model::DiscModel* importModel() const;
    QToolButton* showHideImportViewButton() const;
    QString currentPartition() const;

    void setMainView( bool main );

public slots:
    void setCurrentPartition( const QString& partition );
    void showError( const QString& error );
    void showError( int error );

protected:
    QWBFS::Driver* mDriver;

    virtual void dragEnterEvent( QDragEnterEvent* event );
    virtual void dropEvent( QDropEvent* event );

    UIMain* mainWindow() const;
    void localeChanged();

protected slots:
    void models_countChanged();
    void views_selectionChanged();
    void coverFlow_centerIndexChanged( const QModelIndex& index );
    void progress_jobFinished( const QWBFS::Model::Disc& disc );
    void progress_finished();

    void on_cbPartitions_currentIndexChanged( int index );

    void on_tbLoad_clicked();
    void on_tbFormat_clicked();
    void on_tbOpen_clicked();
    void on_tbClose_clicked();

    void on_tbRemoveDiscs_clicked();
    void on_tbRenameDisc_clicked();

    void on_tbClearImport_clicked();
    void on_tbRemoveImport_clicked();
    void on_tbImport_clicked();

signals:
    void openViewRequested();
    void closeViewRequested();
    void coverRequested( const QString& id );
};

#endif // PARTITIONWIDGET_H


code:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>PartitionWidget</class>
 <widget class="QWidget" name="PartitionWidget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>272</width>
    <height>447</height>
   </rect>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout_3">
   <property name="margin">
    <number>0</number>
   </property>
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="PartitionComboBox" name="cbPartitions">
       <property name="toolTip">
        <string>Set the current partition</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QToolButton" name="tbLoad">
       <property name="toolTip">
        <string>Load/Reload the discs from the current partition</string>
       </property>
       <property name="icon">
        <iconset resource="../resources/resources.qrc">
         <normaloff>:/icons/256/read-partition.png</normaloff>:/icons/256/read-partition.png</iconset>
       </property>
       <property name="iconSize">
        <size>
         <width>20</width>
         <height>20</height>
        </size>
       </property>
       <property name="autoRaise">
        <bool>true</bool>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QToolButton" name="tbFormat">
       <property name="toolTip">
        <string>Format the partition</string>
       </property>
       <property name="icon">
        <iconset resource="../resources/resources.qrc">
         <normaloff>:/icons/256/format.png</normaloff>:/icons/256/format.png</iconset>
       </property>
       <property name="iconSize">
        <size>
         <width>20</width>
         <height>20</height>
        </size>
       </property>
       <property name="autoRaise">
        <bool>true</bool>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QToolButton" name="tbOpen">
       <property name="toolTip">
        <string>Add a new view</string>
       </property>
       <property name="icon">
        <iconset resource="../resources/resources.qrc">
         <normaloff>:/icons/256/add.png</normaloff>:/icons/256/add.png</iconset>
       </property>
       <property name="iconSize">
        <size>
         <width>20</width>
         <height>20</height>
        </size>
       </property>
       <property name="autoRaise">
        <bool>true</bool>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QToolButton" name="tbClose">
       <property name="toolTip">
        <string>Remove the view</string>
       </property>
       <property name="icon">
        <iconset resource="../resources/resources.qrc">
         <normaloff>:/icons/256/remove.png</normaloff>:/icons/256/remove.png</iconset>
       </property>
       <property name="iconSize">
        <size>
         <width>20</width>
         <height>20</height>
        </size>
       </property>
       <property name="autoRaise">
        <bool>true</bool>
       </property>
      </widget>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QSplitter" name="sViews">
     <property name="orientation">
      <enum>Qt::Vertical</enum>
     </property>
     <property name="childrenCollapsible">
      <bool>false</bool>
     </property>
     <widget class="QGroupBox" name="fWBFS">
      <layout class="QVBoxLayout" name="verticalLayout_2">
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
          <widget class="QLabel" name="label">
           <property name="text">
            <string>WBFS View</string>
           </property>
          </widget>
         </item>
         <item>
          <spacer name="horizontalSpacer_2">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
          <widget class="QToolButton" name="tbRemoveDiscs">
           <property name="toolTip">
            <string>Remove the selected discs</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/remove.png</normaloff>:/icons/256/remove.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
          <widget class="QToolButton" name="tbRenameDisc">
           <property name="toolTip">
            <string>Rename the selected disc</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/rename.png</normaloff>:/icons/256/rename.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
          <widget class="QToolButton" name="tbShowHideImportView">
           <property name="toolTip">
            <string>Show/Hide Import View</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/detailed.png</normaloff>:/icons/256/detailed.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="checkable">
            <bool>true</bool>
           </property>
           <property name="checked">
            <bool>true</bool>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <widget class="QTabWidget" name="tabWidget">
         <property name="tabPosition">
          <enum>QTabWidget::South</enum>
         </property>
         <property name="currentIndex">
          <number>0</number>
         </property>
         <widget class="QWidget" name="wList">
          <attribute name="title">
           <string>List</string>
          </attribute>
          <layout class="QVBoxLayout" name="verticalLayout_4">
           <property name="spacing">
            <number>0</number>
           </property>
           <property name="margin">
            <number>0</number>
           </property>
           <item>
            <widget class="ListView" name="lvDiscs">
             <property name="editTriggers">
              <set>QAbstractItemView::NoEditTriggers</set>
             </property>
             <property name="showDropIndicator" stdset="0">
              <bool>false</bool>
             </property>
             <property name="dragEnabled">
              <bool>true</bool>
             </property>
             <property name="selectionMode">
              <enum>QAbstractItemView::ExtendedSelection</enum>
             </property>
             <property name="verticalScrollMode">
              <enum>QAbstractItemView::ScrollPerPixel</enum>
             </property>
             <property name="horizontalScrollMode">
              <enum>QAbstractItemView::ScrollPerPixel</enum>
             </property>
             <property name="uniformItemSizes">
              <bool>true</bool>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
         <widget class="QWidget" name="wCoverFlow">
          <attribute name="title">
           <string>CoverFlow</string>
          </attribute>
          <layout class="QVBoxLayout" name="verticalLayout_6">
           <property name="spacing">
            <number>0</number>
           </property>
           <property name="margin">
            <number>0</number>
           </property>
           <item>
            <widget class="QFrame" name="frame">
             <property name="frameShape">
              <enum>QFrame::StyledPanel</enum>
             </property>
             <property name="frameShadow">
              <enum>QFrame::Raised</enum>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_5">
              <property name="spacing">
               <number>0</number>
              </property>
              <property name="margin">
               <number>0</number>
              </property>
              <item>
               <widget class="CoverFlowView" name="cfvDiscs" native="true"/>
              </item>
             </layout>
            </widget>
           </item>
          </layout>
         </widget>
        </widget>
       </item>
      </layout>
     </widget>
     <widget class="QGroupBox" name="fImport">
      <layout class="QVBoxLayout" name="verticalLayout">
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout_2">
         <item>
          <widget class="QLabel" name="label_2">
           <property name="text">
            <string>Import View</string>
           </property>
          </widget>
         </item>
         <item>
          <spacer name="horizontalSpacer">
           <property name="orientation">
            <enum>Qt::Horizontal</enum>
           </property>
           <property name="sizeHint" stdset="0">
            <size>
             <width>40</width>
             <height>20</height>
            </size>
           </property>
          </spacer>
         </item>
         <item>
          <widget class="QToolButton" name="tbClearImport">
           <property name="toolTip">
            <string>Clear the discs</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/clear.png</normaloff>:/icons/256/clear.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
          <widget class="QToolButton" name="tbRemoveImport">
           <property name="toolTip">
            <string>Remove the selected discs</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/remove.png</normaloff>:/icons/256/remove.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
          <widget class="QToolButton" name="tbImport">
           <property name="toolTip">
            <string>Import the discs to the WBFS partition</string>
           </property>
           <property name="icon">
            <iconset resource="../resources/resources.qrc">
             <normaloff>:/icons/256/import.png</normaloff>:/icons/256/import.png</iconset>
           </property>
           <property name="iconSize">
            <size>
             <width>20</width>
             <height>20</height>
            </size>
           </property>
           <property name="autoRaise">
            <bool>true</bool>
           </property>
          </widget>
         </item>
        </layout>
       </item>
       <item>
        <widget class="ListView" name="lvImport">
         <property name="editTriggers">
          <set>QAbstractItemView::NoEditTriggers</set>
         </property>
         <property name="showDropIndicator" stdset="0">
          <bool>false</bool>
         </property>
         <property name="selectionMode">
          <enum>QAbstractItemView::ExtendedSelection</enum>
         </property>
         <property name="verticalScrollMode">
          <enum>QAbstractItemView::ScrollPerPixel</enum>
         </property>
         <property name="horizontalScrollMode">
          <enum>QAbstractItemView::ScrollPerPixel</enum>
         </property>
         <property name="uniformItemSizes">
          <bool>true</bool>
         </property>
        </widget>
       </item>
      </layout>
     </widget>
    </widget>
   </item>
   <item>
    <widget class="Gauge" name="gStatus" native="true"/>
   </item>
   <item>
    <widget class="QLabel" name="lInformations">
     <property name="alignment">
      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>ListView</class>
   <extends>QListView</extends>
   ListView.h
  </customwidget>
  <customwidget>
   <class>Gauge</class>
   <extends>QWidget</extends>
   Gauge.h
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>CoverFlowView</class>
   <extends>QWidget</extends>
   CoverFlowView.h
   <container>1</container>
  </customwidget>
  <customwidget>
   <class>PartitionComboBox</class>
   <extends>QComboBox</extends>
   PartitionComboBox.h
  </customwidget>
 </customwidgets>
 <resources>
  <include location="../resources/resources.qrc"/>
 </resources>
 <connections>
  <connection>
   <sender>tbShowHideImportView</sender>
   <signal>toggled(bool)</signal>
   <receiver>fImport</receiver>
   <slot>setVisible(bool)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>258</x>
     <y>68</y>
    </hint>
    <hint type="destinationlabel">
     <x>73</x>
     <y>241</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : ProgressDialog.cpp
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#include "ProgressDialog.h"

#include <QPushButton>
#include <QTimer>
#include <QDesktopWidget>
#include <QDebug>

ProgressDialog::ProgressDialog( QWidget* parent )
    : QDialog( parent )
{
    setupUi( this );
    setAttribute( Qt::WA_DeleteOnClose );
    cbDetails->setChecked( false );
    dbbButtons->button( QDialogButtonBox::Ok )->setEnabled( false );
    dbbButtons->button( QDialogButtonBox::Cancel )->setEnabled( false );

    mThread = new WorkerThread( this );
    doConnections();
    localeChanged();
}

ProgressDialog::~ProgressDialog()
{
    //qWarning() << Q_FUNC_INFO;
}

bool ProgressDialog::event( QEvent* event )
{
    switch ( event->type() ) {
        case QEvent::LocaleChange:
            localeChanged();
            break;
        default:
            break;
    }

    return QDialog::event( event );
}

void ProgressDialog::setWork( const WorkerThread::Work& work )
{
    open();

    if ( !mThread->setWork( work ) ) {
        deleteLater();
    }
}

void ProgressDialog::done( int r )
{
    if ( mThread->isRunning() ) {
        return;
    }

    QDialog::done( r );
}

void ProgressDialog::closeEvent( QCloseEvent* event )
{
    if ( mThread->isRunning() ) {
        event->ignore();
        return;
    }

    QDialog::closeEvent( event );
}

void ProgressDialog::localeChanged()
{
    retranslateUi( this );
}

void ProgressDialog::doConnections()
{
    connect( dbbButtons->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( close() ) );
    connect( dbbButtons->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), mThread, SLOT( stop() ) );
    connect( mThread, SIGNAL( started() ), this, SLOT( thread_started() ) );
    connect( mThread, SIGNAL( message( const QString& ) ), this, SLOT( thread_message( const QString& ) ) );
    connect( mThread, SIGNAL( log( const QString& ) ), this, SLOT( thread_log( const QString& ) ) );
    connect( mThread, SIGNAL( jobFinished( const QWBFS::Model::Disc& ) ), this, SLOT( thread_jobFinished( const QWBFS::Model::Disc& ) ) );
    connect( mThread, SIGNAL( currentProgressChanged( int, int, const QTime& ) ), this, SLOT( thread_currentProgressChanged( int, int, const QTime& ) ) );
    connect( mThread, SIGNAL( globalProgressChanged( int, int ) ), this, SLOT( thread_globalProgressChanged( int, int ) ) );
    connect( mThread, SIGNAL( canceled() ), this, SLOT( thread_canceled() ) );
    connect( mThread, SIGNAL( finished() ), this, SLOT( thread_finished() ) );
}

void ProgressDialog::thread_started()
{
    mElapsed.restart();
    dbbButtons->button( QDialogButtonBox::Cancel )->setEnabled( true );
}

void ProgressDialog::thread_message( const QString& text )
{
    lCurrentInformations->setText( text );
    pteErrors->appendPlainText( text );
}

void ProgressDialog::thread_log( const QString& text )
{
    pteErrors->appendPlainText( text );

    if ( !cbDetails->isChecked() ) {
        cbDetails->toggle();
    }
}

void ProgressDialog::thread_jobFinished( const QWBFS::Model::Disc& disc )
{
    const QString text = QString( "%1 '%2': %3 (%4)" )
        .arg( WorkerThread::taskToLabel( mThread->task() ) )
        .arg( disc.baseName() )
        .arg( QWBFS::Driver::stateToString( QWBFS::Driver::State( disc.state ) ) )
        .arg( QWBFS::Driver::errorToString( QWBFS::Driver::Error( disc.error ) ) );

    pteErrors->appendPlainText( text );

    if ( !cbDetails->isChecked() && disc.hasError() ) {
        cbDetails->toggle();
    }

    emit jobFinished( disc );
}

void ProgressDialog::thread_currentProgressChanged( int value, int maximum, const QTime& remaining )
{
    pbCurrent->setMaximum( maximum );
    pbCurrent->setValue( value );
    lCurrentRemaining->setText( tr( "Time remaining: %1" ).arg( remaining.toString() ) );
}

void ProgressDialog::thread_globalProgressChanged( int value, int maximum )
{
    pbGlobal->setMaximum( maximum );
    pbGlobal->setValue( value );
}

void ProgressDialog::thread_canceled()
{
    lGlobalInformations->setText( tr( "Cancel requested, the process will stop after the current operation." ) );
}

void ProgressDialog::thread_finished()
{
    QTime time( 0, 0, 0, 0 );
    time = time.addMSecs( mElapsed.elapsed() );

    lCurrentInformations->setText( "Tasks finished." );
    lCurrentRemaining->clear();
    lGlobalInformations->setText( tr( "The thread finished in %1" ).arg( time.toString() ) );
    dbbButtons->button( QDialogButtonBox::Ok )->setEnabled( true );
    dbbButtons->button( QDialogButtonBox::Cancel )->setEnabled( false );

    emit finished();
}

void ProgressDialog::on_cbDetails_toggled()
{
    QTimer::singleShot( 0, this, SLOT( updateSpace() ) );
}

void ProgressDialog::updateSpace()
{
    QWidget* widget = parentWidget();
    QRect rect = geometry();

    if ( !widget ) {
        widget = QApplication::desktop();
    }

    widget = widget->window();

    if ( !cbDetails->isChecked() ) {
        rect.setHeight( minimumSizeHint().height() );
    }

    rect.moveCenter( widget->mapToGlobal( widget->rect().center() ) );
#if defined( Q_OS_MAC )
    rect.moveTop( widget->mapToGlobal( widget->rect().topLeft() ).y() );
#endif
    resize( rect.size() );
    move( rect.topLeft() );
}


code:
/****************************************************************************
**
**      Created using Monkey Studio IDE v1.8.4.0 (1.8.4.0)
** Authors   : Filipe Azevedo aka Nox P@sNox <pasnox@gmail.com>
** Project   : QWBFS Manager
** FileName  : ProgressDialog.h
** Date      : 2010-06-16T14:19:29
** License   : GPL2
** Home Page : https://github.com/pasnox/qwbfsmanager
** Comment   : QWBFS Manager is a cross platform WBFS manager developed using C++/Qt4.
** It's currently working fine under Windows (XP to Seven, 32 & 64Bits), Mac OS X (10.4.x to 10.6.x), Linux & unix like.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This package is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
** In addition, as a special exception, the copyright holders give permission
** to link this program with the OpenSSL project's "OpenSSL" library (or with
** modified versions of it that use the same license as the "OpenSSL"
** library), and distribute the linked executables. You must obey the GNU
** General Public License in all respects for all of the code used other than
** "OpenSSL".  If you modify file(s), you may extend this exception to your
** version of the file(s), but you are not obligated to do so. If you do not
** wish to do so, delete this exception statement from your version.
**
****************************************************************************/
#ifndef PROGRESSDIALOG_H
#define PROGRESSDIALOG_H

#include "ui_ProgressDialog.h"
#include "WorkerThread.h"
#include "models/Disc.h"

#include <QTime>

class ProgressDialog : public QDialog, public Ui::ProgressDialog
{
    Q_OBJECT

public:
    ProgressDialog( QWidget* parent = 0 );
    virtual ~ProgressDialog();

    virtual bool event( QEvent* event );

    void setWork( const WorkerThread::Work& work );

public slots:
    virtual void done( int r );

protected:
    WorkerThread* mThread;
    QTime mElapsed;

    void closeEvent( QCloseEvent* event );
    void localeChanged();
    void doConnections();

protected slots:
    void thread_started();
    void thread_message( const QString& text );
    void thread_log( const QString& text );
    void thread_jobFinished( const QWBFS::Model::Disc& disc );
    void thread_currentProgressChanged( int value, int maximum, const QTime& remaining );
    void thread_globalProgressChanged( int value, int maximum );
    void thread_canceled();
    void thread_finished();
    void on_cbDetails_toggled();
    void updateSpace();

signals:
    void jobFinished( const QWBFS::Model::Disc& disc );
    void finished();
};

#endif // PROGRESSDIALOG_H


code:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>ProgressDialog</class>
 <widget class="QDialog" name="ProgressDialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>238</height>
   </rect>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout">
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="QLabel" name="lCurrentInformations">
       <property name="sizePolicy">
        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
         <horstretch>0</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLabel" name="lCurrentRemaining">
       <property name="sizePolicy">
        <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
         <horstretch>0</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
       </property>
      </widget>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QProgressBar" name="pbCurrent"/>
   </item>
   <item>
    <widget class="QLabel" name="lGlobalInformations">
     <property name="text">
      <string>Global progression...</string>
     </property>
    </widget>
   </item>
   <item>
    <widget class="QProgressBar" name="pbGlobal"/>
   </item>
   <item>
    <widget class="QCheckBox" name="cbDetails">
     <property name="text">
      <string>Details.</string>
     </property>
     <property name="checked">
      <bool>true</bool>
     </property>
    </widget>
   </item>
   <item>
    <widget class="QPlainTextEdit" name="pteErrors">
     <property name="tabChangesFocus">
      <bool>true</bool>
     </property>
     <property name="undoRedoEnabled">
      <bool>false</bool>
     </property>
     <property name="readOnly">
      <bool>true</bool>
     </property>
     <property name="tabStopWidth">
      <number>40</number>
     </property>
    </widget>
   </item>
   <item>
    <widget class="QDialogButtonBox" name="dbbButtons">
     <property name="standardButtons">
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <resources/>
 <connections>
  <connection>
   <sender>cbDetails</sender>
   <signal>toggled(bool)</signal>
   <receiver>pteErrors</receiver>
   <slot>setVisible(bool)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>55</x>
     <y>105</y>
    </hint>
    <hint type="destinationlabel">
     <x>47</x>
     <y>130</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>