void WTrackTableView
::setup(QDomNode node
) {
// Position
if (!WWidget::selectNode(node, "Pos").isNull())
{
QString pos
= WWidget
::selectNodeQString(node,
"Pos");
int x = pos.left(pos.find(",")).toInt();
int y = pos.mid(pos.find(",")+1).toInt();
move(x,y);
}
// Size
if (!WWidget::selectNode(node, "Size").isNull())
{
QString size
= WWidget
::selectNodeQString(node,
"Size");
int x = size.left(size.find(",")).toInt();
int y = size.mid(size.find(",")+1).toInt();
setFixedSize(x,y);
}
// Background color
if (!WWidget::selectNode(node, "BgColor").isNull())
{
bgc.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
}
m_pTable->setBackgroundColor(bgc);
// Foreground color
if (!WWidget::selectNode(node, "FgColor").isNull())
{
fgc.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
}
m_pTable->setForegroundColor(bgc);
/*
// Row colors
if (!WWidget::selectNode(node, "BgColorRowEven").isNull())
{
QColor r1;
r1.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowEven"));
QColor r2;
r2.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowUneven"));
setAlternatingRowColors ( true );
m_pTable->setRowColor(r1, r2);
}
// BPM confidence colors
if (!WWidget::selectNode(node, "BgColorBpmNoConfirm").isNull())
{
QColor c1;
c1.setNamedColor(WWidget::selectNodeQString(node, "BgColorBpmNoConfirm"));
QColor c2;
c2.setNamedColor(WWidget::selectNodeQString(node, "BgColorBpmConfirm"));
WTrackTableItem::setBpmBgColors(WSkinColor::getCorrectColor(c1),
WSkinColor::getCorrectColor(c2));
}
*/
}
void WTrackTableView::setup(QDomNode node)
{
// Position
if (!WWidget::selectNode(node, "Pos").isNull())
{
QString pos = WWidget::selectNodeQString(node, "Pos");
int x = pos.left(pos.find(",")).toInt();
int y = pos.mid(pos.find(",")+1).toInt();
move(x,y);
}
// Size
if (!WWidget::selectNode(node, "Size").isNull())
{
QString size = WWidget::selectNodeQString(node, "Size");
int x = size.left(size.find(",")).toInt();
int y = size.mid(size.find(",")+1).toInt();
setFixedSize(x,y);
}
// Background color
QColor bgc(255,255,255);
if (!WWidget::selectNode(node, "BgColor").isNull())
{
bgc.setNamedColor(WWidget::selectNodeQString(node, "BgColor"));
}
m_pTable->setBackgroundColor(bgc);
// Foreground color
QColor fgc(0,0,0);
if (!WWidget::selectNode(node, "FgColor").isNull())
{
fgc.setNamedColor(WWidget::selectNodeQString(node, "FgColor"));
}
m_pTable->setForegroundColor(bgc);
/*
// Row colors
if (!WWidget::selectNode(node, "BgColorRowEven").isNull())
{
QColor r1;
r1.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowEven"));
QColor r2;
r2.setNamedColor(WWidget::selectNodeQString(node, "BgColorRowUneven"));
setAlternatingRowColors ( true );
m_pTable->setRowColor(r1, r2);
}
// BPM confidence colors
if (!WWidget::selectNode(node, "BgColorBpmNoConfirm").isNull())
{
QColor c1;
c1.setNamedColor(WWidget::selectNodeQString(node, "BgColorBpmNoConfirm"));
QColor c2;
c2.setNamedColor(WWidget::selectNodeQString(node, "BgColorBpmConfirm"));
WTrackTableItem::setBpmBgColors(WSkinColor::getCorrectColor(c1),
WSkinColor::getCorrectColor(c2));
}
*/
}
To copy to clipboard, switch view to plain text mode
void WTrackTableModel
::setBackgroundColor(QColor bgColor
) {
backgroundColor = bgColor;
}
void WTrackTableModel
::setForegroundColor(QColor fgColor
) {
foregroundColor = fgColor;
}
void WTrackTableModel
::setRowColor(QColor evenColor,
QColor unevenColor
) {
rowEvenColor = evenColor;
rowUnevenColor = unevenColor;
}
void WTrackTableModel
::setBpmColor(QColor confirmColor,
QColor noConfirmColor
) {
bpmNoConfirmColor = noConfirmColor;
bpmConfirmColor = confirmColor;
}
void WTrackTableModel::setBackgroundColor(QColor bgColor)
{
backgroundColor = bgColor;
}
void WTrackTableModel::setForegroundColor(QColor fgColor)
{
foregroundColor = fgColor;
}
void WTrackTableModel::setRowColor(QColor evenColor, QColor unevenColor)
{
rowEvenColor = evenColor;
rowUnevenColor = unevenColor;
}
void WTrackTableModel::setBpmColor(QColor confirmColor, QColor noConfirmColor)
{
bpmNoConfirmColor = noConfirmColor;
bpmConfirmColor = confirmColor;
}
To copy to clipboard, switch view to plain text mode
{
TrackInfoObject *m_pTrackInfo = m_pTrackCollection->getTrack(index.row()+1);
if (!index.isValid())
if (index.row() >= m_pTrackCollection->getSize())
if (role == Qt::BackgroundRole)
{
return backgroundColor;
}
if (role == Qt::ForegroundRole )
{
return foregroundColor;
}
else if (role == Qt::DisplayRole )
{
switch(index.column())
{
case 0: return m_pTrackInfo->getScoreStr();
case 1: return m_pTrackInfo->getTitle();
case 2: return m_pTrackInfo->getArtist();
case 3: return m_pTrackInfo->getType();
case 4: return m_pTrackInfo->getDurationStr();
case 5: return m_pTrackInfo->getBitrateStr();
case 6: return m_pTrackInfo->getBpmStr();
case 7: return m_pTrackInfo->getComment();
}
}
else
}
QVariant WTrackTableModel :: data(const QModelIndex &index, int role) const
{
TrackInfoObject *m_pTrackInfo = m_pTrackCollection->getTrack(index.row()+1);
if (!index.isValid())
return QVariant();
if (index.row() >= m_pTrackCollection->getSize())
return QVariant();
if (role == Qt::BackgroundRole)
{
return backgroundColor;
}
if (role == Qt::ForegroundRole )
{
return foregroundColor;
}
else if (role == Qt::DisplayRole )
{
switch(index.column())
{
case 0: return m_pTrackInfo->getScoreStr();
case 1: return m_pTrackInfo->getTitle();
case 2: return m_pTrackInfo->getArtist();
case 3: return m_pTrackInfo->getType();
case 4: return m_pTrackInfo->getDurationStr();
case 5: return m_pTrackInfo->getBitrateStr();
case 6: return m_pTrackInfo->getBpmStr();
case 7: return m_pTrackInfo->getComment();
}
}
else
return QVariant();
}
To copy to clipboard, switch view to plain text mode
Bookmarks