2014-11-12 15:01:08 +01:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2014 Werner Schweer
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License version 2
|
|
|
|
// as published by the Free Software Foundation and appearing in
|
|
|
|
// the file LICENCE.GPL
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#include "scorePreview.h"
|
|
|
|
#include "libmscore/score.h"
|
2014-11-14 13:17:56 +01:00
|
|
|
#include "musescore.h"
|
|
|
|
#include "scoreInfo.h"
|
2014-11-12 15:01:08 +01:00
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// ScorePreview
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
ScorePreview::ScorePreview(QWidget* parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
{
|
2019-01-06 02:53:21 +01:00
|
|
|
messageNothingToShow = tr("Nothing selected");
|
2014-11-12 15:01:08 +01:00
|
|
|
setupUi(this);
|
2019-01-06 02:53:21 +01:00
|
|
|
icon->setText(messageNothingToShow);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// displayInfo
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void ScorePreview::displayInfo(bool show)
|
|
|
|
{
|
|
|
|
info->setVisible(show);
|
2014-11-12 15:01:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setScore
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void ScorePreview::setScore(const QString& s)
|
|
|
|
{
|
2014-11-14 13:17:56 +01:00
|
|
|
ScoreInfo fi(s);
|
|
|
|
fi.setPixmap(mscore->extractThumbnail(s));
|
|
|
|
setScore(fi);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScorePreview::setScore(const ScoreInfo& si)
|
|
|
|
{
|
2014-11-21 12:52:07 +01:00
|
|
|
scoreInfo = si;
|
2014-11-19 15:25:03 +01:00
|
|
|
name->setText(si.completeBaseName());
|
2014-11-14 13:17:56 +01:00
|
|
|
creationDate->setText(si.created().toString());
|
|
|
|
fileSize->setText(QString("%1 KiB").arg(si.size() / 1024));
|
2014-11-19 15:25:03 +01:00
|
|
|
name->setEnabled(true);
|
2014-11-12 15:01:08 +01:00
|
|
|
creationDate->setEnabled(true);
|
|
|
|
fileSize->setEnabled(true);
|
2014-11-14 13:17:56 +01:00
|
|
|
icon->setPixmap(si.pixmap());
|
2014-11-12 15:01:08 +01:00
|
|
|
}
|
2019-01-06 02:53:21 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// unsetScore
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void ScorePreview::unsetScore()
|
|
|
|
{
|
|
|
|
scoreInfo = ScoreInfo();
|
|
|
|
name->setText("");
|
|
|
|
creationDate->setText("");
|
|
|
|
fileSize->setText("");
|
|
|
|
name->setEnabled(false);
|
|
|
|
creationDate->setEnabled(true);
|
|
|
|
fileSize->setEnabled(true);
|
|
|
|
icon->setText(messageNothingToShow);
|
|
|
|
}
|
2014-11-12 15:01:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|