2020-05-21 Fred Gleason <fredg@paravelsystems.com>

* Added image size and type data to the 'View Image' dialog in
	rdadmin(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-05-21 13:07:05 -04:00
parent de6288285d
commit 68d707566d
11 changed files with 121 additions and 24 deletions

View File

@ -19976,3 +19976,8 @@
superfeed setups to be saved with no member subfeeds.
* Fixed a bug in the 'Edit Feed' dialog in rdadmin(1) that allowed
a per-item default image to be configured for superfeeds.
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
* Added a file-type field to the image attributes line in rdadmin(1).
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
* Added image size and type data to the 'View Image' dialog in
rdadmin(1).

View File

@ -85,15 +85,17 @@ void RDImagePickerModel::update(int row)
RDSqlQuery *q=NULL;
sql=QString("select ")+
"DESCRIPTION,"+ // 00
"WIDTH,"+ // 01
"HEIGHT "+ // 02
"DESCRIPTION,"+ // 00
"FILE_EXTENSION,"+ // 01
"WIDTH,"+ // 02
"HEIGHT "+ // 03
"from FEED_IMAGES where "+
QString().sprintf("ID=%d",c_image_ids.at(row));
q=new RDSqlQuery(sql);
if(q->first()) {
c_descriptions[row]=q->value(0).toString()+
QString().sprintf("\n [%dx%d]",q->value(1).toInt(),q->value(2).toInt());
c_descriptions[row]=q->value(0).toString()+"\n"+
+"["+q->value(1).toString().toUpper()+", "+
QString().sprintf("%dx%d]",q->value(2).toInt(),q->value(3).toInt());
emit dataChanged(createIndex(row,0),createIndex(row,0));
}
delete q;
@ -178,11 +180,12 @@ void RDImagePickerModel::LoadRows(int cat_id,const QSize &img_size)
// Load new data
//
sql=QString("select ")+
"ID,"+ // 00
"DESCRIPTION,"+ // 01
"WIDTH,"+ // 02
"HEIGHT,"+ // 03
"DATA "+ // 04
"ID,"+ // 00
"DESCRIPTION,"+ // 01
"FILE_EXTENSION,"+ // 02
"WIDTH,"+ // 02
"HEIGHT,"+ // 03
"DATA "+ // 04
"from "+c_table_name+" where "+
c_category_column+QString().sprintf("=%d ",cat_id)+
"order by DESCRIPTION";
@ -192,10 +195,11 @@ void RDImagePickerModel::LoadRows(int cat_id,const QSize &img_size)
while(q->next()) {
c_image_ids.push_back(q->value(0).toUInt());
c_descriptions.
push_back(q->value(1).toString()+
QString().sprintf("\n [%dx%d]",
q->value(2).toInt(),q->value(3).toInt()));
img.loadFromData(q->value(4).toByteArray());
push_back(q->value(1).toString()+"\n"+
"["+q->value(2).toString().toUpper()+", "+
QString().sprintf("%dx%d]",
q->value(3).toInt(),q->value(4).toInt()));
img.loadFromData(q->value(5).toByteArray());
c_images.push_back(new QPixmap(QPixmap::fromImage(img.scaled(img_size,
Qt::KeepAspectRatio,Qt::SmoothTransformation))));
}

View File

@ -36,9 +36,22 @@ EditImage::EditImage(QWidget *parent)
c_image_label=new QLabel(this);
c_description_label=new QLabel(tr("Description")+":",this);
c_description_label->setAlignment(Qt::AlignRight);
c_description_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
c_description_label->setFont(labelFont());
c_description_edit=new QLineEdit(this);
c_description_edit->setMaxLength(191);
c_size_label=new QLabel(tr("Native Size")+":",this);
c_size_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
c_size_label->setFont(labelFont());
c_size_value_label=new QLabel(this);
c_size_value_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
c_extension_label=new QLabel(tr("Type")+":",this);
c_extension_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
c_extension_label->setFont(labelFont());
c_extension_value_label=new QLabel(this);
c_extension_value_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
c_ok_button=new QPushButton(tr("OK"),this);
c_ok_button->setFont(buttonFont());
@ -47,6 +60,8 @@ EditImage::EditImage(QWidget *parent)
c_cancel_button=new QPushButton(tr("Cancel"),this);
c_cancel_button->setFont(buttonFont());
connect(c_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
setMinimumSize(sizeHint());
}
@ -62,7 +77,7 @@ EditImage::~EditImage()
QSize EditImage::sizeHint() const
{
return QSize(400,300);
return QSize(600,700);
}
@ -74,25 +89,31 @@ int EditImage::exec(int img_id)
c_image_id=img_id;
sql=QString("select ")+
"DESCRIPTION,"+ // 00
"WIDTH,"+ // 01
"HEIGHT,"+ // 02
"DEPTH,"+ // 03
"DATA "+ // 04
"DESCRIPTION,"+ // 00
"FILE_EXTENSION,"+ // 01
"WIDTH,"+ // 02
"HEIGHT,"+ // 03
"DEPTH,"+ // 04
"DATA "+ // 05
"from FEED_IMAGES where "+
QString().sprintf("ID=%d",img_id);
q=new RDSqlQuery(sql);
if(q->first()) {
c_description_edit->setText(q->value(0).toString());
c_extension_value_label->setText(q->value(1).toString().toUpper());
c_size_value_label->
setText(QString().sprintf("%dx%d",q->value(2).toInt(),
q->value(3).toInt()));
c_image=QImage();
c_image.loadFromData(q->value(4).toByteArray());
c_image.loadFromData(q->value(5).toByteArray());
QSize fsize=FittedSize(c_image.size());
c_image_label->setPixmap(QPixmap::fromImage(c_image.
scaled(fsize,
Qt::KeepAspectRatio)));
resize(EDIT_IMAGE_WIDTH_OFFSET+fsize.width(),
EDIT_IMAGE_HEIGHT_OFFSET+fsize.height());
// resize(EDIT_IMAGE_WIDTH_OFFSET+fsize.width(),
// EDIT_IMAGE_HEIGHT_OFFSET+fsize.height());
resize(sizeHint());
}
delete q;
@ -136,6 +157,13 @@ void EditImage::resizeEvent(QResizeEvent *e)
c_description_label->setGeometry(10,h-87,120,20);
c_description_edit->setGeometry(135,h-87,w-145,20);
c_size_label->
setGeometry(140,h-65,80,20);
c_size_value_label->setGeometry(225,h-65,80,20);
c_extension_label->setGeometry(300,h-65,50,20);
c_extension_value_label->setGeometry(355,h-65,100,20);
c_ok_button->setGeometry(w-180,h-60,80,50);
c_cancel_button->setGeometry(w-90,h-60,80,50);
}

View File

@ -56,6 +56,10 @@ class EditImage : public RDDialog
QLabel *c_image_label;
QLabel *c_description_label;
QLineEdit *c_description_edit;
QLabel *c_size_label;
QLabel *c_size_value_label;
QLabel *c_extension_label;
QLabel *c_extension_value_label;
QPushButton *c_ok_button;
QPushButton *c_cancel_button;
QImage c_image;

View File

@ -2001,6 +2001,14 @@ Stále ještě chcete uložit?</translation>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -1879,6 +1879,14 @@ Do you still want to save?</source>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -2003,6 +2003,14 @@ Do you still want to save?</source>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -1549,6 +1549,14 @@ Do you still want to save?</source>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -1846,6 +1846,14 @@ Vil du framleis lagra?</translation>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -1846,6 +1846,14 @@ Vil du framleis lagra?</translation>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>

View File

@ -1852,6 +1852,14 @@ Você ainda quer salvar?</translation>
<source>Image Viewer</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Native Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Type</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditJack</name>