|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/infoviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/intfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsystem.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpalette.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tsound_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tiio.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstream.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ttoonzimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trasterimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/toonzscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvdialog.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toutputproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/sceneproperties.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcamera.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/levelset.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcontenthistory.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfiletype.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <qslider></qslider>
|
|
Toshihiro Shimizu |
890ddd |
#include <qlabel></qlabel>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtextedit></qtextedit>
|
|
Toshihiro Shimizu |
890ddd |
#include <qdatetime></qdatetime>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace DVGui;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class InfoViewerImp
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
enum {
|
|
Toshihiro Shimizu |
890ddd |
eFullpath = 0,
|
|
Toshihiro Shimizu |
890ddd |
eFileType,
|
|
Toshihiro Shimizu |
890ddd |
eFrames,
|
|
Toshihiro Shimizu |
890ddd |
eOwner,
|
|
Toshihiro Shimizu |
890ddd |
eSize,
|
|
Toshihiro Shimizu |
890ddd |
eCreated,
|
|
Toshihiro Shimizu |
890ddd |
eModified,
|
|
Toshihiro Shimizu |
890ddd |
eLastAccess,
|
|
Toshihiro Shimizu |
890ddd |
eImageSize,
|
|
Toshihiro Shimizu |
890ddd |
eSaveBox,
|
|
Toshihiro Shimizu |
890ddd |
eBitsSample,
|
|
Toshihiro Shimizu |
890ddd |
eSamplePixel,
|
|
Toshihiro Shimizu |
890ddd |
eDpi,
|
|
Toshihiro Shimizu |
890ddd |
eOrientation,
|
|
Toshihiro Shimizu |
890ddd |
eCompression,
|
|
Toshihiro Shimizu |
890ddd |
eQuality,
|
|
Toshihiro Shimizu |
890ddd |
eSmoothing,
|
|
Toshihiro Shimizu |
890ddd |
eCodec,
|
|
Toshihiro Shimizu |
890ddd |
eAlphaChannel,
|
|
Toshihiro Shimizu |
890ddd |
eByteOrdering,
|
|
Toshihiro Shimizu |
890ddd |
eHPos,
|
|
Toshihiro Shimizu |
890ddd |
ePalettePages,
|
|
Toshihiro Shimizu |
890ddd |
ePaletteStyles,
|
|
Toshihiro Shimizu |
890ddd |
eCamera,
|
|
Toshihiro Shimizu |
890ddd |
eCameraDpi,
|
|
Toshihiro Shimizu |
890ddd |
eFrameCount,
|
|
Toshihiro Shimizu |
890ddd |
eLevelCount,
|
|
Toshihiro Shimizu |
890ddd |
eOutputPath,
|
|
Toshihiro Shimizu |
890ddd |
eEndianess,
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//sound info
|
|
Toshihiro Shimizu |
890ddd |
eLength,
|
|
Toshihiro Shimizu |
890ddd |
eChannels,
|
|
Toshihiro Shimizu |
890ddd |
eSampleRate,
|
|
Toshihiro Shimizu |
890ddd |
eSampleSize,
|
|
Toshihiro Shimizu |
890ddd |
eHowMany
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFilePath m_path;
|
|
Toshihiro Shimizu |
890ddd |
TLevelP m_level;
|
|
Shinya Kitaoka |
3bfa54 |
std::vector<tframeid> m_fids;</tframeid>
|
|
Toshihiro Shimizu |
890ddd |
QStringList m_formats;
|
|
Toshihiro Shimizu |
890ddd |
int m_currentIndex;
|
|
Toshihiro Shimizu |
890ddd |
int m_frameCount;
|
|
Toshihiro Shimizu |
890ddd |
TPalette *m_palette;
|
|
Toshihiro Shimizu |
890ddd |
QLabel m_framesLabel;
|
|
Toshihiro Shimizu |
890ddd |
IntField m_framesSlider;
|
|
Shinya Kitaoka |
3bfa54 |
std::vector<std::pair<qlabel *="" *,="" qlabel="">> m_labels;</std::pair<qlabel>
|
|
Toshihiro Shimizu |
890ddd |
QLabel m_historyLabel;
|
|
Toshihiro Shimizu |
890ddd |
QTextEdit m_history;
|
|
Toshihiro Shimizu |
890ddd |
Separator m_separator1, m_separator2;
|
|
Toshihiro Shimizu |
890ddd |
void setFileInfo(const TFileStatus &status);
|
|
Toshihiro Shimizu |
890ddd |
void setImageInfo();
|
|
Toshihiro Shimizu |
890ddd |
void setSoundInfo();
|
|
Toshihiro Shimizu |
890ddd |
//void cleanFileInfo();
|
|
Toshihiro Shimizu |
890ddd |
void cleanLevelInfo();
|
|
Toshihiro Shimizu |
890ddd |
void setToonzSceneInfo();
|
|
Toshihiro Shimizu |
890ddd |
void setPaletteInfo();
|
|
Toshihiro Shimizu |
890ddd |
void setGeneralFileInfo(const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
QString getTypeString();
|
|
Toshihiro Shimizu |
890ddd |
void onSliderChanged();
|
|
Toshihiro Shimizu |
890ddd |
InfoViewerImp();
|
|
Toshihiro Shimizu |
890ddd |
~InfoViewerImp();
|
|
Toshihiro Shimizu |
890ddd |
void clear();
|
|
Shinya Kitaoka |
3bfa54 |
bool setLabel(TPropertyGroup *pg, int index, std::string type);
|
|
Toshihiro Shimizu |
890ddd |
void create(int index, QString str);
|
|
Toshihiro Shimizu |
890ddd |
void loadPalette(const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline void setVal(int index, const QString &str)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_labels[index].second->setText(str);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool setItem(const TLevelP &level, TPalette *palette, const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
InfoViewer::InfoViewer(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: Dialog()
|
|
Shinya Kitaoka |
262a92 |
, m_imp(new InfoViewerImp())
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setWindowTitle(tr("File Info"));
|
|
Toshihiro Shimizu |
890ddd |
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
|
Toshihiro Shimizu |
890ddd |
//setAttribute(Qt::WA_DeleteOnClose);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_parent = parent;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)m_imp->m_labels.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
addWidgets(m_imp->m_labels[i].first, m_imp->m_labels[i].second);
|
|
Toshihiro Shimizu |
890ddd |
if (i == InfoViewerImp::eLastAccess)
|
|
Toshihiro Shimizu |
890ddd |
addWidget(&m_imp->m_separator1);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addWidget(&m_imp->m_separator2);
|
|
Toshihiro Shimizu |
890ddd |
addWidget(&m_imp->m_historyLabel);
|
|
Toshihiro Shimizu |
890ddd |
addWidget(&m_imp->m_history);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
addWidgets(&m_imp->m_framesLabel, &m_imp->m_framesSlider);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(&m_imp->m_framesSlider, SIGNAL(valueChanged(bool)), this, SLOT(onSliderChanged(bool)));
|
|
Toshihiro Shimizu |
890ddd |
hide();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
InfoViewer::~InfoViewer()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewer::hideEvent(QHideEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_imp->m_level = TLevelP();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_parent) {
|
|
Toshihiro Shimizu |
890ddd |
m_parent->setWindowModality(Qt::ApplicationModal);
|
|
Toshihiro Shimizu |
890ddd |
//setWindowModality(Qt::NonModal);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewer::showEvent(QShowEvent *)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_parent) {
|
|
Toshihiro Shimizu |
890ddd |
m_parent->setWindowModality(Qt::NonModal);
|
|
Toshihiro Shimizu |
890ddd |
//setWindowModality(Qt::WindowModal);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewer::onSliderChanged(bool)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_imp->onSliderChanged();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::onSliderChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_framesSlider.getValue() - 1 == m_currentIndex)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_currentIndex = m_framesSlider.getValue() - 1;
|
|
Toshihiro Shimizu |
890ddd |
setImageInfo();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
void setLabelStyle(QLabel *l)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
l->setFrameStyle(QFrame::StyledPanel);
|
|
Toshihiro Shimizu |
890ddd |
l->setStyleSheet("color: rgb(0, 0, 200);");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::create(int index, QString str)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Shinya Kitaoka |
3bfa54 |
m_labels[index] = std::pair<qlabel *="" *,="" qlabel="">(new QLabel(str), new QLabel(""));</qlabel>
|
|
Toshihiro Shimizu |
890ddd |
setLabelStyle(m_labels[index].first);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
InfoViewerImp::InfoViewerImp()
|
|
Toshihiro Shimizu |
890ddd |
: m_palette(0), m_framesLabel("Current Frame: "), m_framesSlider(), m_history(), m_historyLabel("File History")
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setLabelStyle(&m_framesLabel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelReader::getSupportedFormats(m_formats);
|
|
Toshihiro Shimizu |
890ddd |
TSoundTrackReader::getSupportedFormats(m_formats);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_labels.resize(eHowMany);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
create(eFullpath, QObject::tr("Fullpath: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eFileType, QObject::tr("File Type: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eFrames, QObject::tr("Frames: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eOwner, QObject::tr("Owner: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSize, QObject::tr("Size: "));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
create(eCreated, QObject::tr("Created: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eModified, QObject::tr("Modified: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eLastAccess, QObject::tr("Last Access: "));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//level info
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
create(eImageSize, QObject::tr("Image Size: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSaveBox, QObject::tr("SaveBox: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eBitsSample, QObject::tr("Bits/Sample: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSamplePixel, QObject::tr("Sample/Pixel: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eDpi, QObject::tr("Dpi: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eOrientation, QObject::tr("Orientation: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eCompression, QObject::tr("Compression: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eQuality, QObject::tr("Quality: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSmoothing, QObject::tr("Smoothing: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eCodec, QObject::tr("Codec: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eAlphaChannel, QObject::tr("Alpha Channel:"));
|
|
Toshihiro Shimizu |
890ddd |
create(eByteOrdering, QObject::tr("Byte Ordering:"));
|
|
Toshihiro Shimizu |
890ddd |
create(eHPos, QObject::tr("H Pos:"));
|
|
Toshihiro Shimizu |
890ddd |
create(ePalettePages, QObject::tr("Palette Pages:"));
|
|
Toshihiro Shimizu |
890ddd |
create(ePaletteStyles, QObject::tr("Palette Styles:"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
create(eCamera, QObject::tr("Camera Size: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eCameraDpi, QObject::tr("Camera Dpi: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eFrameCount, QObject::tr("Number of Frames: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eLevelCount, QObject::tr("Number of Levels: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eOutputPath, QObject::tr("Output Path: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eEndianess, QObject::tr("Endianess: "));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//sound info
|
|
Toshihiro Shimizu |
890ddd |
create(eLength, QObject::tr("Length: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eChannels, QObject::tr("Channels: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSampleRate, QObject::tr("Sample Rate: "));
|
|
Toshihiro Shimizu |
890ddd |
create(eSampleSize, QObject::tr("Sample Size: "));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_historyLabel.setStyleSheet("color: rgb(0, 0, 200);");
|
|
Toshihiro Shimizu |
890ddd |
m_history.setStyleSheet("font-size: 12px; font-family: \"courier\";");
|
|
Toshihiro Shimizu |
890ddd |
//m_history.setStyleSheet("font-family: \"courier\";");
|
|
Toshihiro Shimizu |
890ddd |
m_history.setReadOnly(true);
|
|
Toshihiro Shimizu |
890ddd |
m_history.setFixedWidth(490);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::clear()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)m_labels.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
setVal(i, "");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_history.clear();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
InfoViewerImp::~InfoViewerImp()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)m_labels.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
delete m_labels[i].first;
|
|
Toshihiro Shimizu |
890ddd |
delete m_labels[i].second;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_labels.clear();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setFileInfo(const TFileStatus &status)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//m_fPath.setText(status.
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString InfoViewerImp::getTypeString()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QString ext = QString::fromStdString(m_path.getType());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (ext == "tlv" || ext == "tzp" || ext == "tzu")
|
|
Toshihiro Shimizu |
890ddd |
return "Toonz Cmapped Raster Level";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "pli" || ext == "svg")
|
|
Toshihiro Shimizu |
890ddd |
return "Toonz Vector Level";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "mov" || ext == "avi" || ext == "3gp")
|
|
Toshihiro Shimizu |
890ddd |
return "Movie File";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "tnz")
|
|
Toshihiro Shimizu |
890ddd |
return "Toonz Scene";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "tab")
|
|
Toshihiro Shimizu |
890ddd |
return "Tab Scene";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "plt")
|
|
Toshihiro Shimizu |
890ddd |
return "Toonz Palette";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "wav" || ext == "aiff" || ext == "mp3")
|
|
Toshihiro Shimizu |
890ddd |
return "Audio File";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "mesh")
|
|
Toshihiro Shimizu |
890ddd |
return "Toonz Mesh Level";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "pic")
|
|
Toshihiro Shimizu |
890ddd |
return "Pic File";
|
|
Toshihiro Shimizu |
890ddd |
else if (Tiio::makeReader(ext.toStdString()))
|
|
Toshihiro Shimizu |
890ddd |
return (m_fids.size() == 1) ? "Single Raster Image" : "Raster Image Level";
|
|
Toshihiro Shimizu |
890ddd |
else if (ext == "psd")
|
|
Toshihiro Shimizu |
890ddd |
return "Photoshop Image";
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
return "Unmanaged File Type";
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setGeneralFileInfo(const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QFileInfo fi = toQString(path);
|
|
Toshihiro Shimizu |
890ddd |
assert(fi.exists());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setVal(eFullpath, fi.absoluteFilePath());
|
|
Toshihiro Shimizu |
890ddd |
setVal(eFileType, getTypeString());
|
|
Toshihiro Shimizu |
890ddd |
if (fi.owner() != "")
|
|
Toshihiro Shimizu |
890ddd |
setVal(eOwner, fi.owner());
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSize, fileSizeString(fi.size()));
|
|
Toshihiro Shimizu |
890ddd |
setVal(eCreated, fi.created().toString());
|
|
Toshihiro Shimizu |
890ddd |
setVal(eModified, fi.lastModified().toString());
|
|
Toshihiro Shimizu |
890ddd |
setVal(eLastAccess, fi.lastRead().toString());
|
|
Toshihiro Shimizu |
890ddd |
m_separator1.show();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
3bfa54 |
bool InfoViewerImp::setLabel(TPropertyGroup *pg, int index, std::string type)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TProperty *p = pg->getProperty(type);
|
|
Toshihiro Shimizu |
890ddd |
if (!p)
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
QString str = QString::fromStdString(p->getValueAsString());
|
|
Toshihiro Shimizu |
890ddd |
if (dynamic_cast<tboolproperty *="">(p))</tboolproperty>
|
|
Toshihiro Shimizu |
890ddd |
setVal(index, str == "0" ? "No" : "Yes");
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
setVal(index, str);
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setImageInfo()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_path != TFilePath() && !m_fids.empty())
|
|
Toshihiro Shimizu |
890ddd |
setGeneralFileInfo(m_path.getType() == "tlv" || !m_path.isLevelName() ? m_path : m_path.withFrame(m_fids[m_currentIndex]));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
assert(m_level);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setVal(eFrames, QString::number(m_level->getFrameCount()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP lr(m_path);
|
|
Toshihiro Shimizu |
890ddd |
const TImageInfo *ii;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
ii = lr->getImageInfo(m_fids[m_currentIndex]);
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (!m_fids.empty() && lr && ii) {
|
|
Toshihiro Shimizu |
890ddd |
setVal(eImageSize, QString::number(ii->m_lx) + " X " + QString::number(ii->m_ly));
|
|
Toshihiro Shimizu |
890ddd |
if (ii->m_x0 <= ii->m_x1)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSaveBox, "(" + QString::number(ii->m_x0) + ", " + QString::number(ii->m_y0) + ", " + QString::number(ii->m_x1) + ", " + QString::number(ii->m_y1) + ")");
|
|
Toshihiro Shimizu |
890ddd |
if (ii->m_bitsPerSample > 0)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eBitsSample, QString::number(ii->m_bitsPerSample));
|
|
Toshihiro Shimizu |
890ddd |
if (ii->m_samplePerPixel > 0)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSamplePixel, QString::number(ii->m_samplePerPixel));
|
|
Toshihiro Shimizu |
890ddd |
if (ii->m_dpix > 0 || ii->m_dpiy > 0)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eDpi, "(" + QString::number(ii->m_dpix) + ", " + QString::number(ii->m_dpiy) + ")");
|
|
Toshihiro Shimizu |
890ddd |
TPropertyGroup *pg = ii->m_properties;
|
|
Toshihiro Shimizu |
890ddd |
if (pg) {
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eOrientation, "Orientation");
|
|
Toshihiro Shimizu |
890ddd |
if (!setLabel(pg, eCompression, "Compression") && !setLabel(pg, eCompression, "Compression Type") && !setLabel(pg, eCompression, "RLE-Compressed"))
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eCompression, "File Compression");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eQuality, "Quality");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eSmoothing, "Smoothing");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eCodec, "Codec");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eAlphaChannel, "Alpha Channel");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eByteOrdering, "Byte Ordering");
|
|
Toshihiro Shimizu |
890ddd |
setLabel(pg, eEndianess, "Endianess");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
m_separator1.hide();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
const TContentHistory *ch = 0;
|
|
Toshihiro Shimizu |
890ddd |
if (lr)
|
|
Toshihiro Shimizu |
890ddd |
ch = lr->getContentHistory();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (ch) {
|
|
Toshihiro Shimizu |
890ddd |
QString str = ch->serialize();
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove('\n');
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove(QChar(0));
|
|
Toshihiro Shimizu |
890ddd |
str = str.replace("||", "\n");
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove('|');
|
|
Toshihiro Shimizu |
890ddd |
m_history.setPlainText(str);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TImageP img = m_level->frame(m_fids[m_currentIndex]);
|
|
Toshihiro Shimizu |
890ddd |
TToonzImageP timg = (TToonzImageP)img;
|
|
Toshihiro Shimizu |
890ddd |
TRasterImageP rimg = (TRasterImageP)img;
|
|
Toshihiro Shimizu |
890ddd |
TVectorImageP vimg = (TVectorImageP)img;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (img) {
|
|
Toshihiro Shimizu |
890ddd |
TRect r = convert(timg->getBBox());
|
|
Toshihiro Shimizu |
890ddd |
if (r.x0 <= r.x1)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSaveBox, "(" + QString::number(r.x0) + ", " + QString::number(r.y0) + ", " + QString::number(r.x1) + ", " + QString::number(r.y1) + ")");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
double dpix, dpiy;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (timg) {
|
|
Toshihiro Shimizu |
890ddd |
//setVal(eHPos, QString::number(timg->gethPos()));
|
|
Toshihiro Shimizu |
890ddd |
timg->getDpi(dpix, dpiy);
|
|
Toshihiro Shimizu |
890ddd |
setVal(eDpi, "(" + QString::number(dpix) + ", " + QString::number(dpiy) + ")");
|
|
Toshihiro Shimizu |
890ddd |
TDimension dim = timg->getRaster()->getSize();
|
|
Toshihiro Shimizu |
890ddd |
setVal(eImageSize, QString::number(dim.lx) + " X " + QString::number(dim.ly));
|
|
Toshihiro Shimizu |
890ddd |
m_palette = timg->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
} else if (rimg) {
|
|
Toshihiro Shimizu |
890ddd |
rimg->getDpi(dpix, dpiy);
|
|
Toshihiro Shimizu |
890ddd |
setVal(eDpi, "(" + QString::number(dpix) + ", " + QString::number(dpiy) + ")");
|
|
Toshihiro Shimizu |
890ddd |
TDimension dim = rimg->getRaster()->getSize();
|
|
Toshihiro Shimizu |
890ddd |
setVal(eImageSize, QString::number(dim.lx) + " X " + QString::number(dim.ly));
|
|
Toshihiro Shimizu |
890ddd |
} else if (vimg)
|
|
Toshihiro Shimizu |
890ddd |
m_palette = vimg->getPalette();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//TImageP img = m_level->frame(m_fids[m_currentIndex]);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setSoundInfo()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_path != TFilePath())
|
|
Toshihiro Shimizu |
890ddd |
setGeneralFileInfo(m_path);
|
|
Toshihiro Shimizu |
890ddd |
TSoundTrackP sndTrack;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
TSoundTrackReaderP sr(m_path);
|
|
Toshihiro Shimizu |
890ddd |
if (sr)
|
|
Toshihiro Shimizu |
890ddd |
sndTrack = sr->load();
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (!sndTrack)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int seconds = sndTrack->getDuration();
|
|
Toshihiro Shimizu |
890ddd |
int minutes = seconds / 60;
|
|
Toshihiro Shimizu |
890ddd |
seconds = seconds % 60;
|
|
Toshihiro Shimizu |
890ddd |
QString label;
|
|
Toshihiro Shimizu |
890ddd |
if (minutes > 0)
|
|
Toshihiro Shimizu |
890ddd |
label += QString::number(minutes) + " min ";
|
|
Toshihiro Shimizu |
890ddd |
label += QString::number(seconds) + " sec";
|
|
Toshihiro Shimizu |
890ddd |
setVal(eLength, label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
label = QString::number(sndTrack->getChannelCount());
|
|
Toshihiro Shimizu |
890ddd |
setVal(eChannels, label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TUINT32 sampleRate = sndTrack->getSampleRate();
|
|
Toshihiro Shimizu |
890ddd |
label = QString::number(sampleRate / 1000) + " KHz";
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSampleRate, label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
label = QString::number(sndTrack->getBitPerSample()) + " bit";
|
|
Toshihiro Shimizu |
890ddd |
setVal(eSampleSize, label);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::cleanLevelInfo()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewer::setItem(const TLevelP &level, TPalette *palette, const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_imp->setItem(level, palette, path))
|
|
Toshihiro Shimizu |
890ddd |
show();
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
hide();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setToonzSceneInfo()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ToonzScene scene;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
scene.loadNoResources(m_path);
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TCamera *cam = scene.getCurrentCamera();
|
|
Toshihiro Shimizu |
890ddd |
if (!cam)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TContentHistory *ch = scene.getContentHistory();
|
|
Toshihiro Shimizu |
890ddd |
if (ch) {
|
|
Toshihiro Shimizu |
890ddd |
QString str = ch->serialize();
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove('\n');
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove(QChar(0));
|
|
Toshihiro Shimizu |
890ddd |
str = str.replace("||", "\n");
|
|
Toshihiro Shimizu |
890ddd |
str = str.remove('|');
|
|
Toshihiro Shimizu |
890ddd |
m_history.setPlainText(str);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TLevelSet *set = scene.getLevelSet();
|
|
Toshihiro Shimizu |
890ddd |
TSceneProperties *prop = scene.getProperties();
|
|
Toshihiro Shimizu |
890ddd |
TOutputProperties *oprop = prop->getOutputProperties();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setVal(eCamera, QString::number(cam->getRes().lx) + " X " + QString::number(cam->getRes().ly));
|
|
Toshihiro Shimizu |
890ddd |
setVal(eCameraDpi, QString::number(cam->getDpi().x) + ", " + QString::number(cam->getDpi().y));
|
|
Toshihiro Shimizu |
890ddd |
setVal(eFrameCount, QString::number(scene.getFrameCount()));
|
|
Toshihiro Shimizu |
890ddd |
if (set)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eLevelCount, QString::number(set->getLevelCount()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (oprop)
|
|
Toshihiro Shimizu |
890ddd |
setVal(eOutputPath, toQString(oprop->getPath()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::setPaletteInfo()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_palette)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setVal(ePalettePages, QString::number(m_palette->getPageCount()));
|
|
Toshihiro Shimizu |
890ddd |
setVal(ePaletteStyles, QString::number(m_palette->getStyleCount()));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void InfoViewerImp::loadPalette(const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TIStream is(path);
|
|
Toshihiro Shimizu |
890ddd |
if (is) {
|
|
Toshihiro Shimizu |
890ddd |
TPersist *p = 0;
|
|
Toshihiro Shimizu |
890ddd |
is >> p;
|
|
Toshihiro Shimizu |
890ddd |
m_palette = dynamic_cast<tpalette *="">(p);</tpalette>
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//----------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool InfoViewerImp::setItem(const TLevelP &level, TPalette *palette, const TFilePath &path)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_path = path;
|
|
Toshihiro Shimizu |
890ddd |
m_level = level;
|
|
Toshihiro Shimizu |
890ddd |
m_fids.clear();
|
|
Toshihiro Shimizu |
890ddd |
m_currentIndex = 0;
|
|
Toshihiro Shimizu |
890ddd |
m_palette = palette;
|
|
Toshihiro Shimizu |
890ddd |
m_framesLabel.hide();
|
|
Toshihiro Shimizu |
890ddd |
m_framesSlider.hide();
|
|
Toshihiro Shimizu |
890ddd |
m_separator1.hide();
|
|
Toshihiro Shimizu |
890ddd |
m_separator2.hide();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString ext = QString::fromStdString(m_path.getType());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_path != TFilePath() && !m_formats.contains(ext) && !Tiio::makeReader(m_path.getType())) {
|
|
Toshihiro Shimizu |
890ddd |
// e' un file non di immagine (plt, tnz, ...)
|
|
Toshihiro Shimizu |
890ddd |
assert(!m_level);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!TSystem::doesExistFileOrLevel(m_path)) {
|
|
Shinya Kitaoka |
eabf18 |
DVGui::warning(QObject::tr("The file %1 does not exist.").arg(QString::fromStdWString(path.getWideString())));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setGeneralFileInfo(m_path);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (ext == "plt") {
|
|
Toshihiro Shimizu |
890ddd |
assert(!m_level && !m_palette);
|
|
Toshihiro Shimizu |
890ddd |
loadPalette(m_path);
|
|
Toshihiro Shimizu |
890ddd |
} else if (ext == "tnz")
|
|
Toshihiro Shimizu |
890ddd |
setToonzSceneInfo();
|
|
Toshihiro Shimizu |
890ddd |
} else if (TFileType::getInfo(m_path) == TFileType::AUDIO_LEVEL) {
|
|
Toshihiro Shimizu |
890ddd |
setSoundInfo();
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
if (ext == "tlv")
|
|
Toshihiro Shimizu |
890ddd |
loadPalette(m_path.withNoFrame().withType("tpl"));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (!m_level) {
|
|
Toshihiro Shimizu |
890ddd |
assert(m_path != TFilePath());
|
|
Toshihiro Shimizu |
890ddd |
TLevelReaderP lr;
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
lr = TLevelReaderP(m_path);
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
if (lr) {
|
|
Toshihiro Shimizu |
890ddd |
try {
|
|
Toshihiro Shimizu |
890ddd |
m_level = lr->loadInfo();
|
|
Toshihiro Shimizu |
890ddd |
} catch (...) {
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_level) {
|
|
Toshihiro Shimizu |
890ddd |
// Image or level of images case
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TLVs are not intended as movie file here (why?). Neither are those
|
|
Toshihiro Shimizu |
890ddd |
bool isMovieFile =
|
|
Toshihiro Shimizu |
890ddd |
(ext != "tlv" && m_formats.contains(ext) && !m_path.isLevelName());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_frameCount = m_level->getFrameCount();
|
|
Toshihiro Shimizu |
890ddd |
assert(m_frameCount);
|
|
Toshihiro Shimizu |
890ddd |
m_fids.resize(m_frameCount);
|
|
Toshihiro Shimizu |
890ddd |
TLevel::Iterator it = m_level->begin();
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; it != m_level->end(); ++it, ++i)
|
|
Toshihiro Shimizu |
890ddd |
m_fids[i] = it->first;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_frameCount > 1 && !isMovieFile) {
|
|
Toshihiro Shimizu |
890ddd |
m_framesSlider.setRange(1, m_frameCount);
|
|
Toshihiro Shimizu |
890ddd |
m_framesSlider.setValue(0);
|
|
Toshihiro Shimizu |
890ddd |
m_framesSlider.show();
|
|
Toshihiro Shimizu |
890ddd |
m_framesLabel.show();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setImageInfo();
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_palette)
|
|
Toshihiro Shimizu |
890ddd |
setPaletteInfo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < (int)m_labels.size(); i++)
|
|
Toshihiro Shimizu |
890ddd |
if (m_labels[i].second->text() == "")
|
|
Toshihiro Shimizu |
890ddd |
m_labels[i].first->hide(), m_labels[i].second->hide();
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
m_labels[i].first->show(), m_labels[i].second->show();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_history.toPlainText() == "") {
|
|
Toshihiro Shimizu |
890ddd |
m_separator2.hide();
|
|
Toshihiro Shimizu |
890ddd |
m_historyLabel.hide();
|
|
Toshihiro Shimizu |
890ddd |
m_history.hide();
|
|
Toshihiro Shimizu |
890ddd |
} else {
|
|
Toshihiro Shimizu |
890ddd |
m_separator2.show();
|
|
Toshihiro Shimizu |
890ddd |
m_historyLabel.show();
|
|
Toshihiro Shimizu |
890ddd |
m_history.show();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|