Example #1
0
// winMgr is used to store the currently loaded image (application wide)
// and is where we send our new image when the user clicks "Process",
// among other things.
colorChooser::colorChooser(windowManager* winMgr)
  : imageZoomWindow("", winMgr), processMode_(), clickedDock_(NULL) {

  imageLabel_ = new imageLabel(this);
  connect(imageLabel_, SIGNAL(announceImageClick(QMouseEvent* )),
          this, SLOT(processColorAdd(QMouseEvent* )));

  imageScroll_ = new QScrollArea(this);
  imageScroll_->installEventFilter(this);
  imageScroll_->viewport()->installEventFilter(this);
  imageScroll_->setWidget(imageLabel_);
  setCentralWidget(imageScroll_);

  constructMenuObjects();
  constructProcessingObjects();
  popDock();
  processProcessChange(0); // set processMode_ to the first box entry

  setStatus(tr("Click the left folder icon to open a new image or "
               "the right folder icon to open a saved project."));
  setPermanentStatus(tr("Click 'Choose colors' to continue."));
  setPermanentStatusEnabled(false);

  setWidgetActive(false);
  winManager()->addColorChooserWindow(this);
}
Example #2
0
patternWindow::patternWindow(windowManager* winMgr)
  : imageSaverWindow(tr("Symbols"), winMgr), pdfSymbolDim_(0),
    curImage_(patternImagePtr(NULL)),
    fontMetrics_(QFontMetrics(font())) {

  installEventFilter(this);
  imageLabel_ = new patternImageLabel(this);
  imageLabel_->setGridColor(Qt::black);
  connect(imageLabel_, SIGNAL(announceImageClick(QMouseEvent* )),
          this, SLOT(imageClickSlot(QMouseEvent* )));
  scroll_ = new QScrollArea(this);
  scroll_->installEventFilter(this);
  scroll_->viewport()->installEventFilter(this);
  scroll_->setWidget(imageLabel_);
  setCentralWidget(scroll_);

  dockImageHolder_ = new QDockWidget(this);
  dockImageHolder_->setFeatures(QDockWidget::NoDockWidgetFeatures);
  dockImage_ = new dockImage(winManager()->originalImage(), this);
  dockImageHolder_->setWidget(dockImage_);
  addDockWidget(Qt::RightDockWidgetArea, dockImageHolder_);
  connect(scroll_->horizontalScrollBar(), SIGNAL(valueChanged(int )),
          this, SLOT(labelScrollChange( )));
  connect(scroll_->verticalScrollBar(), SIGNAL(valueChanged(int )),
          this, SLOT(labelScrollChange( )));
  connect(dockImage_, SIGNAL(viewportUpdated(qreal , qreal, bool , bool )),
          this, SLOT(processDockImageUpdate(qreal , qreal, bool , bool )));

  const QFontMetrics metrics(font());
  basePatternDim_ = (metrics.width("@") > metrics.height()) ?
    metrics.width("@") : metrics.height();
  basePatternDim_ = qMax(basePatternDim_, 30);
  listDock_ = new patternDockWidget(basePatternDim_, this);
  setListDockWidget(listDock_);
  connect(listDock_, SIGNAL(changeSymbol(const triC& )),
          this, SLOT(changeSymbolSlot(const triC& )));

  constructActions();
  constructMenus();
  constructToolbar();
  constructPdfViewerDialog();

  setPermanentStatus(tr("Click the 'To pdf' button to save the pattern as a pdf."));
  setStatus(tr("left click: change symbol; right click: switch between square and symbol images"));
}