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