Пример #1
0
void KIGPDialog::writeConfig()
{
 KConfigGroup group = m_config->group("Look");
 group.writeEntry("ImagesPerRow", getImagesPerRow());
 group.writeEntry("ImageName", printImageName());
 group.writeEntry("ImageSize", printImageSize());
 group.writeEntry("ImageProperty", printImageProperty());
 group.writeEntry("FontName", getFontName());
 group.writeEntry("FontSize", getFontSize());
 group.writeEntry("ForegroundColor", getForegroundColor().name() );
 group.writeEntry("BackgroundColor", getBackgroundColor().name());

 group =m_config->group("Directory");
 group.writeEntry("RecurseSubDirectories", recurseSubDirectories());
 group.writeEntry("RecursionLevel", recursionLevel());
 group.writeEntry("CopyOriginalFiles", copyOriginalFiles());
 group.writeEntry("UseCommentFile", useCommentFile());

 group = m_config->group("Thumbnails");
 group.writeEntry("ThumbnailSize", getThumbnailSize());
 group.writeEntry("ColorDepth", getColorDepth());
 group.writeEntry("ColorDepthSet", colorDepthSet());
 group.writeEntry("ImageFormat", getImageFormat());
 group.sync();
}
Пример #2
0
WidgetImage::WidgetImage(QWidget *parent) : QWidget(parent), toolbar(0),
  statusbar(0), paintWnd(0), scrollArea(0), zoomBox(0) {
  toolbar = new QToolBar(tr("Image"),this);
  statusbar = new QStatusBar(this);
  paintWnd = new PaintWidget();
  scrollArea = new QScrollArea(this);
  scrollArea->setWidget(paintWnd);
  scrollArea->setWidgetResizable(true);

  QAction* action = new QAction(QIcon(":/icons/resources/save.png"),tr("Save Image"),toolbar);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(saveImage()));
  toolbar->addAction(action);
  toolbar->addSeparator();
  action = new QAction(QIcon(":/icons/resources/arrow_in.png"),tr("Fit to Window"),toolbar);
  action->setCheckable(true);
  action->setChecked(true);
  connect(action,SIGNAL(triggered(bool)),this,SLOT(toggleFitToWindow(bool)));
  connect(action,SIGNAL(triggered(bool)),paintWnd,SLOT(toggleFitToWindow(bool)));
  toolbar->addAction(action);
  action = new QAction(QIcon(":/icons/resources/zoom_100.png"),tr("Zoom 100%"),toolbar);
  action->setEnabled(false);
  connect(action,SIGNAL(triggered()),paintWnd,SLOT(zoomImage100()));
  toolbar->addAction(action);
  zoomBox = new QSpinBox(toolbar);
  zoomBox->setToolTip(tr("Zoom Image"));
  zoomBox->setRange(0,999);
  zoomBox->setSingleStep(10);
  zoomBox->setSuffix("%");
  zoomBox->setButtonSymbols(QAbstractSpinBox::PlusMinus);
  zoomBox->setEnabled(false);
  connect(zoomBox,SIGNAL(valueChanged(int)),paintWnd,SLOT(zoomImage(int)));
  connect(paintWnd,SIGNAL(setZoom(int)),zoomBox,SLOT(setValue(int)));
  toolbar->addWidget(zoomBox);

  QLabel* typeLabel = new QLabel(statusbar);
  typeLabel->setTextFormat(Qt::PlainText);
  typeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  typeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(typeLabel);
  QLabel* sizeLabel = new QLabel(statusbar);
  sizeLabel->setTextFormat(Qt::PlainText);
  sizeLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  sizeLabel->setFrameShadow(QFrame::Sunken);
  statusbar->addPermanentWidget(sizeLabel);
  QLabel* posLabel = new QLabel(statusbar);
  posLabel->setTextFormat(Qt::PlainText);
  posLabel->setTextInteractionFlags(Qt::NoTextInteraction);
  posLabel->setFrameShape(QFrame::NoFrame);
  statusbar->addWidget(posLabel,1);
  connect(paintWnd,SIGNAL(setStatusMsg(QString,int)),statusbar,SLOT(showMessage(QString,int)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageSize(QString)),sizeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImageType(QString)),typeLabel,SLOT(setText(QString)),Qt::QueuedConnection);
  connect(paintWnd,SIGNAL(printImagePos(QString)),posLabel,SLOT(setText(QString)),Qt::QueuedConnection);

  QVBoxLayout* layout = new QVBoxLayout();
  layout->addWidget(toolbar);
  layout->addWidget(scrollArea,1);
  layout->addWidget(statusbar);
  layout->setSpacing(0);
  layout->setContentsMargins(0,0,0,0);
  setLayout(layout);
}