#include "CalamariWindow.h" #include "DiffWidget.h" #include <QAction> #include <QCheckBox> #include <QComboBox> #include <QLabel> #include <QLayout> #include <QSlider> #include <QStatusBar> #include <QToolBar> #include <math.h> CalamariWindow::CalamariWindow(QWidget *parent, Qt::WFlags flags, char* file1, char* file2, char* file3) : QMainWindow(parent, flags) { diffWidget = new DiffWidget( file1, file2 ); setCentralWidget( diffWidget ); initDiffToolbar(); zoomFactor = 0; diffWidget->setScale( 0 ); connect( diffWidget, SIGNAL( showMessage( QString, int ) ), statusBar(), SLOT( showMessage( QString, int ) ) ); } CalamariWindow::~CalamariWindow() { } void CalamariWindow::setAutoSize( bool a ) { if ( a ) { diffWidget->setScale( 0 ); } else { diffWidget->setScale( pow( 2.0, zoomFactor ) ); } } void CalamariWindow::setZoom( int index ) { zoomFactor = zoomList->itemData( index ).toInt(); double scale = pow( 2.0, zoomFactor ); diffWidget->setScale( scale ); } void CalamariWindow::initDiffToolbar() { QToolBar* tbar = addToolBar( "CALAMARI" ); QAction* diffMask = new QAction( QIcon( ":/icons/diff.png" ), "Diff stencil", 0x0 ); diffMask->setCheckable( true ); tbar->addAction( diffMask ); connect( diffMask, SIGNAL( toggled(bool) ), diffWidget, SLOT( setDiffMask(bool) ) ); QLabel* tl = new QLabel( "Tolerance:" ); tbar->addWidget( tl ); QSlider* tol = new QSlider; tol->setOrientation( Qt::Horizontal ); tol->setRange( 0, 5 ); tol->setTickPosition( QSlider::TicksAbove ); tol->setTickInterval( 1 ); tol->setFixedWidth( 100 ); tbar->addWidget( tol ); connect( tol, SIGNAL( valueChanged(int) ), diffWidget, SLOT( setTolerance(int) ) ); QAction* pickCol = new QAction( QIcon( ":/icons/color.png" ), "Pick stencil color", 0x0 ); tbar->addAction( pickCol ); connect( pickCol, SIGNAL( triggered() ), diffWidget, SLOT( chooseMaskColor() ) ); connect( diffMask, SIGNAL( toggled(bool) ), tl, SLOT( setEnabled(bool) ) ); connect( diffMask, SIGNAL( toggled(bool) ), tol, SLOT( setEnabled(bool) ) ); connect( diffMask, SIGNAL( toggled(bool) ), pickCol, SLOT( setEnabled(bool) ) ); tl->setEnabled( false ); tol->setEnabled( false ); pickCol->setEnabled( false ); tbar->addSeparator(); QLabel* zLabel = new QLabel( "Zoom:" ); tbar->addWidget( zLabel ); zoomList = new QComboBox; tbar->addWidget( zoomList ); int d; int off = 3; zoomList->setInsertPolicy( QComboBox::InsertAtBottom ); for ( int z = -3 ; z <= 3 ; z++ ) { if ( z < 0 ) { d = pow( 2, -z ); zoomList->insertItem( z + off, "1/" + QString::number( d ) + " x", z ); } else { d = pow( 2, z ); zoomList->insertItem( z + off, QString::number( d ) + " x", z ); } } zoomList->setCurrentIndex( 0 + off ); connect( zoomList, SIGNAL(activated(int)), this, SLOT(setZoom(int)) ); QCheckBox* asize = new QCheckBox( "Fit to window" ); tbar->addWidget( asize ); connect( asize, SIGNAL( toggled(bool) ), this, SLOT( setAutoSize(bool) ) ); connect( asize, SIGNAL( toggled(bool) ), zoomList, SLOT( setDisabled(bool) ) ); asize->setChecked( true ); QWidget* s = new QWidget; s->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); tbar->addWidget( s ); tbar->setMovable( false ); tbar->toggleViewAction()->setEnabled( false ); setMinimumWidth( tbar->sizeHint().width() ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#14 | 6281 | Sam Stafford | CALAMARI now builds with VS2005 and Qt 4.3.3. | ||
#13 | 5539 | Sam Stafford | Kick off another window to merge alpha channels, if present. | ||
#12 | 5534 | Sam Stafford |
A brand new help file, a bit of cosmetic sprucing, one critical bug fix, and a partridge in a pear tree. |
||
#11 | 5527 | Sam Stafford |
Diff options in merge mode, and an "export stencils" command for people who like that sort of thing. Also, a fresh build. |
||
#10 | 5524 | Sam Stafford | Eraser and spraypaint tools, and "Save" command. | ||
#9 | 5520 | Sam Stafford |
Configurable brush sizes, complete with procedurally generated icons. Spiffy. |
||
#8 | 5519 | Sam Stafford |
Added the paintbrush tool. Now we're getting somewhere. |
||
#7 | 5516 | Sam Stafford | The M is for Merge. | ||
#6 | 5515 | Sam Stafford |
A little more groundwork for merging. Color options are now saved automatically, and may include alpha channels (semitransparent stencils are nifty). |
||
#5 | 5512 | Sam Stafford | UI reshuffling - pushed stencil-related options into a dialog. | ||
#4 | 5511 | Sam Stafford | Continued infrastructure work. | ||
#3 | 5505 | Sam Stafford | Add "diff stencil". | ||
#2 | 5502 | Sam Stafford |
Status bar with handy information, and infrastructure to allow ImageProjectors to have frames. |
||
#1 | 5501 | Sam Stafford |
Codename CALAMARI. Built with Qt 4.1.3 - needs QtCore4.dll and QtGui4.dll to run. |