mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-20 15:02:27 +02:00
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
* Added RD_LISTWIDGET_ITEM_WIDTH_PADDING and RD_LISTWIDGET_ITEM_HEIGHT defines in 'lib/rd.h' to define consistent item sizes in list-style widgets. * Modified rdlibrary(1) to use a tree-based model. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
4731b3e520
commit
f558125a7a
@ -20773,3 +20773,8 @@
|
||||
* Added a 'RDLibraryModel' model.
|
||||
* Refactored rdlibrary(1)'s main window to use the model-based
|
||||
API.
|
||||
2021-01-13 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added RD_LISTWIDGET_ITEM_WIDTH_PADDING and
|
||||
RD_LISTWIDGET_ITEM_HEIGHT defines in 'lib/rd.h' to define consistent
|
||||
item sizes in list-style widgets.
|
||||
* Modified rdlibrary(1) to use a tree-based model.
|
||||
|
@ -2693,6 +2693,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Záběr</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
@ -2684,6 +2684,10 @@ Bitte Kofiguration prüfen und erneut versuchen.</translation>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Cut</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
@ -2682,6 +2682,10 @@ Do you still want to proceed?</source>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Cortar</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
@ -2311,6 +2311,10 @@ Do you want to overwrite it?</source>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDListGroups</name>
|
||||
|
@ -2663,6 +2663,10 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Klypp</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
@ -2663,6 +2663,10 @@ Sjekk eksportoppsettet ditt og prøv att.</translation>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Klypp</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
@ -2688,6 +2688,10 @@ Por Favor, cheque suas configurações e tenbte outra vez.</translation>
|
||||
<source>Conductor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation type="unfinished">Conteúdo</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RDLicense</name>
|
||||
|
7
lib/rd.h
7
lib/rd.h
@ -625,4 +625,11 @@
|
||||
*/
|
||||
#define RD_GPIO_EVENT_DAYS 30
|
||||
|
||||
/*
|
||||
* Height/Width for QTreeWidget, QTableWidget and QListView widgets
|
||||
*/
|
||||
#define RD_LISTWIDGET_ITEM_HEIGHT 25
|
||||
#define RD_LISTWIDGET_ITEM_WIDTH_PADDING 20
|
||||
|
||||
|
||||
#endif // RD_H
|
||||
|
@ -244,7 +244,8 @@ QString RDCartFilter::filterSql(const QStringList &and_fields) const
|
||||
for(int i=0;i<and_fields.size();i++) {
|
||||
sql+="&& "+and_fields.at(i)+" ";
|
||||
}
|
||||
sql+=" group by CART.NUMBER order by CART.NUMBER ";
|
||||
// sql+=" group by CART.NUMBER order by CART.NUMBER ";
|
||||
sql+=" order by CART.NUMBER ";
|
||||
if(d_showmatches_box->isChecked()) {
|
||||
sql+=QString().sprintf("limit %d ",RD_LIMITED_CART_SEARCH_QUANTITY);
|
||||
}
|
||||
|
@ -23,9 +23,11 @@
|
||||
#include "rdlibrarymodel.h"
|
||||
|
||||
RDLibraryModel::RDLibraryModel(QObject *parent)
|
||||
: QAbstractTableModel(parent)
|
||||
: QAbstractItemModel(parent)
|
||||
{
|
||||
d_log_icons=new RDLogIcons();
|
||||
d_font_metrics=NULL;
|
||||
d_bold_font_metrics=NULL;
|
||||
|
||||
//
|
||||
// Column Attributes
|
||||
@ -120,9 +122,39 @@ void RDLibraryModel::setPalette(const QPalette &pal)
|
||||
void RDLibraryModel::setFont(const QFont &font)
|
||||
{
|
||||
d_font=font;
|
||||
if(d_font_metrics!=NULL) {
|
||||
delete d_font_metrics;
|
||||
}
|
||||
d_font_metrics=new QFontMetrics(d_font);
|
||||
|
||||
d_bold_font=font;
|
||||
d_bold_font.setWeight(QFont::Bold);
|
||||
if(d_bold_font_metrics!=NULL) {
|
||||
delete d_bold_font_metrics;
|
||||
}
|
||||
d_bold_font_metrics=new QFontMetrics(d_bold_font);
|
||||
}
|
||||
|
||||
|
||||
QModelIndex RDLibraryModel::index(int row,int col,
|
||||
const QModelIndex &parent) const
|
||||
{
|
||||
if(!parent.isValid()) {
|
||||
return createIndex(row,col,(quint32)0);
|
||||
}
|
||||
if((parent.column()==0)&&(parent.internalId()==0)) {
|
||||
return createIndex(row,col,(quint32)(1+parent.row()));
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
|
||||
QModelIndex RDLibraryModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if(index.isValid()&&(index.internalId()>0)) {
|
||||
return createIndex(index.internalId()-1,0,(quint32)0);
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
|
||||
@ -134,10 +166,28 @@ int RDLibraryModel::columnCount(const QModelIndex &parent) const
|
||||
|
||||
int RDLibraryModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid()) {
|
||||
if(parent.internalId()==0) {
|
||||
return d_cut_texts.at(parent.row()).size();
|
||||
}
|
||||
return d_cut_texts.at(parent.internalId()-1).size();
|
||||
}
|
||||
return d_texts.size();
|
||||
}
|
||||
|
||||
|
||||
bool RDLibraryModel::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
if(parent.isValid()) {
|
||||
if((parent.internalId()==0)&&(parent.column()==0)) {
|
||||
return d_cut_texts.at(parent.row()).size()>0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariant RDLibraryModel::headerData(int section,Qt::Orientation orient,
|
||||
int role) const
|
||||
{
|
||||
@ -153,7 +203,31 @@ QVariant RDLibraryModel::data(const QModelIndex &index,int role) const
|
||||
QString str;
|
||||
int col=index.column();
|
||||
int row=index.row();
|
||||
QPixmap pix;
|
||||
|
||||
if(!index.isValid()) {
|
||||
return QVariant();
|
||||
}
|
||||
if(index.internalId()>0) { // Cuts
|
||||
if(row<d_cut_texts.at(index.internalId()-1).size()) {
|
||||
switch((Qt::ItemDataRole)role) {
|
||||
case Qt::DisplayRole:
|
||||
return d_cut_texts.at(index.internalId()-1).at(row).at(col);
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
return d_alignments.at(col);
|
||||
|
||||
case Qt::SizeHintRole:
|
||||
return QSize(RD_LISTWIDGET_ITEM_WIDTH_PADDING+
|
||||
d_font_metrics->width(d_cut_texts.
|
||||
at(index.internalId()-1).at(row).at(col).toString()),
|
||||
RD_LISTWIDGET_ITEM_HEIGHT);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // Carts
|
||||
if(row<d_texts.size()) {
|
||||
switch((Qt::ItemDataRole)role) {
|
||||
case Qt::DisplayRole:
|
||||
@ -180,10 +254,17 @@ QVariant RDLibraryModel::data(const QModelIndex &index,int role) const
|
||||
case Qt::BackgroundRole:
|
||||
return d_background_colors.at(row);
|
||||
|
||||
case Qt::SizeHintRole:
|
||||
return QSize(RD_LISTWIDGET_ITEM_WIDTH_PADDING+
|
||||
(d_icons.at(row).at(col).value<QPixmap>().width())+
|
||||
d_font_metrics->width(d_texts.at(row).at(col).toString()),
|
||||
RD_LISTWIDGET_ITEM_HEIGHT);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
@ -225,8 +306,11 @@ int RDLibraryModel::addCart(unsigned cartnum)
|
||||
for(int i=0;i<columnCount();i++) {
|
||||
list.push_back(QVariant());
|
||||
}
|
||||
QList<QList<QVariant> > list_list;
|
||||
list_list.push_back(list);
|
||||
d_icons.insert(offset,list);
|
||||
d_texts.insert(offset,list);
|
||||
d_cut_texts.insert(offset,list_list);
|
||||
d_background_colors.insert(offset,QVariant());
|
||||
d_cart_types.insert(offset,RDCart::All);
|
||||
|
||||
@ -252,6 +336,7 @@ void RDLibraryModel::removeCart(unsigned cartnum)
|
||||
beginRemoveRows(QModelIndex(),i,i);
|
||||
|
||||
d_texts.removeAt(i);
|
||||
d_cut_texts.removeAt(i);
|
||||
d_background_colors.removeAt(i);
|
||||
d_cart_types.removeAt(i);
|
||||
d_icons.removeAt(i);
|
||||
@ -272,7 +357,7 @@ void RDLibraryModel::refreshRow(int row)
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(q->first()) {
|
||||
updateRow(row,q);
|
||||
emit dataChanged(createIndex(row,0),createIndex(row,columnCount()));
|
||||
emit dataChanged(createIndex(row,0,0),createIndex(row,columnCount(),(quint32)0));
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
@ -305,6 +390,18 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
|
||||
QString sql;
|
||||
RDSqlQuery *q=NULL;
|
||||
|
||||
//
|
||||
// Placeholder values
|
||||
//
|
||||
QList<QVariant> list;
|
||||
QList<QVariant> icons;
|
||||
for(int i=0;i<columnCount();i++) {
|
||||
list.push_back(QVariant());
|
||||
icons.push_back(QVariant());
|
||||
}
|
||||
QList<QList<QVariant> > list_list;
|
||||
list_list.push_back(list);
|
||||
|
||||
//
|
||||
// Reload the color table
|
||||
//
|
||||
@ -323,22 +420,24 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
|
||||
filter_sql;
|
||||
beginResetModel();
|
||||
d_texts.clear();
|
||||
d_cut_texts.clear();
|
||||
d_background_colors.clear();
|
||||
d_cart_types.clear();
|
||||
d_icons.clear();
|
||||
unsigned prev_cartnum=0;
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
QList<QVariant> texts;
|
||||
QList<QVariant> icons;
|
||||
for(int i=0;i<columnCount();i++) {
|
||||
texts.push_back(QVariant());
|
||||
icons.push_back(QVariant());
|
||||
}
|
||||
d_texts.push_back(texts);
|
||||
if(q->value(0).toUInt()!=prev_cartnum) {
|
||||
d_texts.push_back(list);
|
||||
d_cut_texts.push_back(list_list);
|
||||
d_background_colors.push_back(QVariant());
|
||||
d_cart_types.push_back(RDCart::All);
|
||||
d_icons.push_back(icons);
|
||||
updateRow(d_texts.size()-1,q);
|
||||
prev_cartnum=q->value(0).toUInt();
|
||||
}
|
||||
// if(q->value(15).toUInt()==RDCart::Audio) {
|
||||
|
||||
}
|
||||
delete q;
|
||||
endResetModel();
|
||||
@ -348,6 +447,11 @@ void RDLibraryModel::updateModel(const QString &filter_sql)
|
||||
|
||||
void RDLibraryModel::updateRow(int row,RDSqlQuery *q)
|
||||
{
|
||||
unsigned cartnum=q->value(0).toUInt();
|
||||
|
||||
//
|
||||
// Text Values (Qt::Display)
|
||||
//
|
||||
switch((RDCart::Type)q->value(15).toUInt()) {
|
||||
case RDCart::Audio:
|
||||
if(q->value(21).isNull()) {
|
||||
@ -373,7 +477,7 @@ void RDLibraryModel::updateRow(int row,RDSqlQuery *q)
|
||||
if(q->value(16).toUInt()==1) {
|
||||
d_texts[row][2]=RDGetTimeLength(q->value(1).toUInt()); // Total Length
|
||||
d_texts[row][3]= // Talk Length
|
||||
RDGetTimeLength(q->value(25).toUInt()-q->value(24).toUInt());
|
||||
RDGetTimeLength(q->value(28).toUInt()-q->value(27).toUInt());
|
||||
}
|
||||
|
||||
d_texts[row][4]=q->value(2); // Title
|
||||
@ -437,6 +541,33 @@ void RDLibraryModel::updateRow(int row,RDSqlQuery *q)
|
||||
d_background_colors[row]=QColor(RD_CART_EVERGREEN_COLOR);
|
||||
break;
|
||||
}
|
||||
|
||||
// printf("start at: %d\n",q->at());
|
||||
|
||||
//
|
||||
// Cut Attributes
|
||||
//
|
||||
d_cut_texts[row].clear();
|
||||
QList<QVariant> list;
|
||||
for(int i=0;i<columnCount();i++) {
|
||||
list.push_back(QVariant());
|
||||
}
|
||||
|
||||
do {
|
||||
if(q->value(24).isNull()) {
|
||||
return; // No cuts!
|
||||
}
|
||||
// Process
|
||||
d_cut_texts[row].push_back(list);
|
||||
d_cut_texts[row].back()[0]=tr("Cut")+ // Cut Number
|
||||
QString().sprintf(" %03d",RDCut::cutNumber(q->value(24).toString()));
|
||||
d_cut_texts[row].back()[2]= // Length
|
||||
RDGetTimeLength(q->value(26).toUInt()-q->value(25).toUInt());
|
||||
d_cut_texts[row].back()[3]= // Talk Length
|
||||
RDGetTimeLength(q->value(28).toUInt()-q->value(27).toUInt());
|
||||
d_cut_texts[row].back()[4]=q->value(29).toString(); // Description
|
||||
} while(q->next()&&(q->value(0).toUInt()==cartnum));
|
||||
q->previous();
|
||||
}
|
||||
|
||||
|
||||
@ -467,11 +598,34 @@ QString sql=QString("select ")+
|
||||
"CART.OWNER,"+ // 21
|
||||
"CART.VALIDITY,"+ // 22
|
||||
"GROUPS.COLOR,"+ // 23
|
||||
"CUTS.TALK_START_POINT,"+ // 24
|
||||
"CUTS.TALK_END_POINT "+ // 25
|
||||
"CUTS.CUT_NAME,"+ // 24
|
||||
"CUTS.START_POINT,"+ // 25
|
||||
"CUTS.END_POINT,"+ // 26
|
||||
"CUTS.TALK_START_POINT,"+ // 27
|
||||
"CUTS.TALK_END_POINT,"+ // 28
|
||||
"CUTS.DESCRIPTION "+ // 29
|
||||
"from CART "+
|
||||
"left join GROUPS on CART.GROUP_NAME=GROUPS.NAME "+
|
||||
"left join CUTS on CART.NUMBER=CUTS.CART_NUMBER ";
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
QByteArray RDLibraryModel::DumpIndex(const QModelIndex &index,const QString &caption) const
|
||||
{
|
||||
QByteArray ret;
|
||||
|
||||
if(!caption.isEmpty()) {
|
||||
ret+=(caption+": ").toUtf8();
|
||||
}
|
||||
if(index.isValid()) {
|
||||
ret+=QString().sprintf("QModelIndex(%d,%d,%llu)",
|
||||
index.row(),index.column(),index.internalId()).
|
||||
toUtf8();
|
||||
}
|
||||
else {
|
||||
ret+=QString("QModelIndex()").toUtf8();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef RDLIBRARYMODEL_H
|
||||
#define RDLIBRARYMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QList>
|
||||
@ -33,7 +33,7 @@
|
||||
#include <rdlog_icons.h>
|
||||
#include <rdnotification.h>
|
||||
|
||||
class RDLibraryModel : public QAbstractTableModel
|
||||
class RDLibraryModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -42,8 +42,12 @@ class RDLibraryModel : public QAbstractTableModel
|
||||
QPalette palette();
|
||||
void setPalette(const QPalette &pal);
|
||||
void setFont(const QFont &font);
|
||||
QModelIndex index(int row,int col,
|
||||
const QModelIndex &parent=QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &index) const;
|
||||
int columnCount(const QModelIndex &parent=QModelIndex()) const;
|
||||
int rowCount(const QModelIndex &parent=QModelIndex()) const;
|
||||
bool hasChildren(const QModelIndex &parent=QModelIndex()) const;
|
||||
QVariant headerData(int section,Qt::Orientation orient,
|
||||
int role=Qt::DisplayRole) const;
|
||||
QVariant data(const QModelIndex &index,int role=Qt::DisplayRole) const;
|
||||
@ -68,12 +72,16 @@ class RDLibraryModel : public QAbstractTableModel
|
||||
QString sqlFields() const;
|
||||
|
||||
private:
|
||||
QByteArray DumpIndex(const QModelIndex &index,const QString &caption="") const;
|
||||
QPalette d_palette;
|
||||
QFont d_font;
|
||||
QFontMetrics *d_font_metrics;
|
||||
QFont d_bold_font;
|
||||
QFontMetrics *d_bold_font_metrics;
|
||||
QList<QVariant> d_headers;
|
||||
QList<QList<QVariant> > d_texts;
|
||||
QList<QList<QVariant> > d_icons;
|
||||
QList<QList<QList<QVariant> > > d_cut_texts;
|
||||
QList<QVariant> d_alignments;
|
||||
QList<QVariant> d_background_colors;
|
||||
QList<RDCart::Type> d_cart_types;
|
||||
|
@ -166,10 +166,10 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
//
|
||||
// Cart List
|
||||
//
|
||||
lib_cart_view=new QTableView(this);
|
||||
lib_cart_view=new QTreeView(this);
|
||||
lib_cart_view->setGeometry(100,0,430,sizeHint().height());
|
||||
lib_cart_view->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
lib_cart_view->setShowGrid(false);
|
||||
// lib_cart_view->setShowGrid(false);
|
||||
lib_cart_view->setSortingEnabled(false);
|
||||
lib_cart_view->setWordWrap(false);
|
||||
lib_cart_model=new RDLibraryModel(this);
|
||||
@ -180,8 +180,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
lib_cart_model,SLOT(setFilterSql(const QString &)));
|
||||
connect(lib_cart_filter,SIGNAL(dragEnabledChanged(bool)),
|
||||
this,SLOT(dragsChangedData(bool)));
|
||||
connect(lib_cart_model,SIGNAL(modelReset()),
|
||||
lib_cart_view,SLOT(resizeColumnsToContents()));
|
||||
connect(lib_cart_model,SIGNAL(modelReset()),this,SLOT(modelResetData()));
|
||||
connect(lib_cart_model,SIGNAL(rowCountChanged(int)),
|
||||
lib_cart_filter,SLOT(setMatchCount(int)));
|
||||
connect(lib_cart_view,SIGNAL(doubleClicked(const QModelIndex &)),
|
||||
@ -295,7 +294,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
|
||||
|
||||
dragsChangedData(lib_cart_filter->dragEnabled());
|
||||
lib_cart_model->setFilterSql(lib_cart_filter->filterSql());
|
||||
lib_cart_view->resizeColumnsToContents();
|
||||
// lib_cart_view->resizeColumnsToContents();
|
||||
|
||||
LoadGeometry();
|
||||
}
|
||||
@ -386,7 +385,7 @@ void MainWidget::addData()
|
||||
new EditCart(cart_num,&lib_import_path,true,profile_ripping,this);
|
||||
if(cart->exec()) {
|
||||
int row=lib_cart_model->addCart(cart_num);
|
||||
lib_cart_view->selectRow(row);
|
||||
// lib_cart_view->selectRow(row);
|
||||
lib_cart_view->scrollTo(lib_cart_model->index(row,0));
|
||||
SendNotification(RDNotification::AddAction,cart_num);
|
||||
}
|
||||
@ -432,7 +431,7 @@ void MainWidget::macroData()
|
||||
{
|
||||
int row=-1;
|
||||
|
||||
if(((row=SingleSelectedLine())<0)||
|
||||
if(((row=SingleSelectedCartLine())<0)||
|
||||
(lib_cart_model->cartType(row)!=RDCart::Macro)) {
|
||||
return;
|
||||
}
|
||||
@ -547,7 +546,7 @@ void MainWidget::deleteData()
|
||||
delete rdcart;
|
||||
}
|
||||
|
||||
lib_cart_view->selectRow(rows.first().row());
|
||||
// lib_cart_view->selectRow(rows.first().row());
|
||||
lib_cart_view->scrollTo(lib_cart_model->index(rows.first().row(),0));
|
||||
|
||||
UnlockUser();
|
||||
@ -597,8 +596,14 @@ void MainWidget::cartDoubleClickedData(const QModelIndex &)
|
||||
void MainWidget::selectionChangedData(const QItemSelection &,
|
||||
const QItemSelection &)
|
||||
{
|
||||
QList<int> cartlines;
|
||||
QStringList cutnames;
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
|
||||
for(int i=0;i<rows.size();i++) {
|
||||
|
||||
}
|
||||
|
||||
lib_player->playButton()->setEnabled(rows.size()==1);
|
||||
lib_player->stopButton()->setEnabled(rows.size()==1);
|
||||
lib_macro_button->setEnabled(rows.size()==1);
|
||||
@ -629,6 +634,14 @@ void MainWidget::selectionChangedData(const QItemSelection &,
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::modelResetData()
|
||||
{
|
||||
for(int i=0;i<lib_cart_model->columnCount();i++) {
|
||||
lib_cart_view->resizeColumnToContents(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWidget::audioChangedData(int state)
|
||||
{
|
||||
// filterChangedData("");
|
||||
@ -646,7 +659,7 @@ void MainWidget::dragsChangedData(bool state)
|
||||
if(state) {
|
||||
QModelIndexList rows=lib_cart_view->selectionModel()->selectedRows();
|
||||
if(rows.size()>1) {
|
||||
lib_cart_view->selectRow(rows.first().row());
|
||||
//lib_cart_view->selectRow(rows.first().row());
|
||||
}
|
||||
lib_cart_view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
}
|
||||
@ -1169,11 +1182,13 @@ void MainWidget::SetCaption(QString user)
|
||||
}
|
||||
|
||||
|
||||
int MainWidget::SingleSelectedLine() const
|
||||
int MainWidget::SingleSelectedCartLine() const
|
||||
{
|
||||
int row=-1;
|
||||
|
||||
if(lib_cart_view->selectionModel()->selectedRows().size()==1) {
|
||||
if((lib_cart_view->selectionModel()->selectedRows().size()==1)&&
|
||||
(lib_cart_view->selectionModel()->selectedRows().first().internalId()==
|
||||
0)) {
|
||||
return lib_cart_view->selectionModel()->selectedRows().first().row();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QProgressDialog>
|
||||
#include <QTableView>
|
||||
#include <QTreeView>
|
||||
|
||||
#include <rdcartfilter.h>
|
||||
#include <rdlibrarymodel.h>
|
||||
@ -74,6 +74,7 @@ class MainWidget : public RDWidget
|
||||
void playerShortcutData();
|
||||
void cartDoubleClickedData(const QModelIndex &);
|
||||
void selectionChangedData(const QItemSelection &,const QItemSelection &);
|
||||
void modelResetData();
|
||||
void audioChangedData(int state);
|
||||
void macroChangedData(int state);
|
||||
void dragsChangedData(bool state);
|
||||
@ -92,7 +93,7 @@ class MainWidget : public RDWidget
|
||||
const QDateTime &end_datetime,
|
||||
const QDateTime ¤t_datetime);
|
||||
void SetCaption(QString user);
|
||||
int SingleSelectedLine() const;
|
||||
int SingleSelectedCartLine() const;
|
||||
QString GeometryFile();
|
||||
void LoadGeometry();
|
||||
void SaveGeometry();
|
||||
@ -101,7 +102,7 @@ class MainWidget : public RDWidget
|
||||
void SendNotification(RDNotification::Action action,unsigned cartnum);
|
||||
RDCartFilter *lib_cart_filter;
|
||||
// LibListView *lib_cart_list;
|
||||
QTableView *lib_cart_view;
|
||||
QTreeView *lib_cart_view;
|
||||
RDLibraryModel *lib_cart_model;
|
||||
QString lib_filter_text;
|
||||
QString lib_search_text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user