File: Raw_image_dialog.cpp

package info (click to toggle)
cgal 6.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (57 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "Raw_image_dialog.h"
#include <QPushButton>

Raw_image_dialog::Raw_image_dialog(QWidget* parent)
  : QDialog(parent)
{
  setupUi(this);
}

void Raw_image_dialog::update_image_size() {
  std::size_t size = image_word_size() *
      dim_x->value() *
      dim_y->value() *
      dim_z->value() +
      offset->value();
  label_image_size->setText(QString("%1 B").arg(size));

  if(label_image_size->text() == label_file_size->text())
  {
    buttonBox->button(QDialogButtonBox::Open)->setEnabled(true);
    buttonBox->button(QDialogButtonBox::Open)->setToolTip(QString(""));
  }
  else
  {
    buttonBox->button(QDialogButtonBox::Open)->setEnabled(false);
    buttonBox->button(QDialogButtonBox::Open)->setToolTip(QString("The image's size must fit the File's size."));
  }
}

std::size_t Raw_image_dialog::image_word_size() const {
  if(short_bt->isChecked())
    return 2;
  if(int_bt->isChecked())
    return 4;
  else if(float_bt->isChecked())
    return 4;
  else if(double_bt->isChecked())
    return 8;
  else
    return 1;
}

WORD_KIND Raw_image_dialog::image_word_kind() const
{
  if(float_bt->isChecked() ||
     double_bt->isChecked())
    return WK_FLOAT;
  else
    return WK_FIXED;
}
SIGN Raw_image_dialog::image_sign() const
{
  if(signed_bt->isChecked())
    return SGN_SIGNED;
  else
    return SGN_UNSIGNED;
}