5 #include "MainWindow.h" 9 #include <QDoubleSpinBox> 11 #include <QHBoxLayout> 12 #include <QListWidgetItem> 15 #include <QPushButton> 20 #include <QToolButton> 21 #include <QVBoxLayout> 34 p_dialog->setWindowTitle(
"Blink Comparator");
43 connect(
p_listWidget, SIGNAL(itemActivated(QListWidgetItem *)),
48 p_splitter =
new QSplitter(Qt::Vertical,
p_dialog);
51 p_splitter->setCollapsible(0,
false);
52 p_splitter->setCollapsible(1,
false);
53 p_splitter->setStretchFactor(0, 0);
54 p_splitter->setStretchFactor(1, 1);
58 QVBoxLayout *layout =
new QVBoxLayout();
61 layout->addWidget(p_splitter, 1);
62 layout->addWidget(buttons, 0);
65 QToolButton *
reverse =
new QToolButton(buttons);
67 reverse->setIconSize(QSize(22, 22));
68 reverse->setShortcut(Qt::CTRL + Qt::Key_Delete);
69 reverse->setToolTip(
"Previous");
70 QString text =
"<b>Function:</b> Show previous linked viewport and \ 71 stop automatic timed blinking \ 72 <p><b>Shortcut:</b> Ctrl+Delete</p>";
76 QToolButton *
stop =
new QToolButton(buttons);
78 stop->setIconSize(QSize(22, 22));
79 stop->setToolTip(
"Stop");
80 text =
"<b>Function:</b> Stop automatic timed blinking";
81 stop->setWhatsThis(text);
82 connect(
stop, SIGNAL(released()),
this, SLOT(
stop()));
84 QToolButton *
start =
new QToolButton(buttons);
86 start->setIconSize(QSize(22, 22));
87 start->setToolTip(
"Start");
88 text =
"<b>Function:</b> Start automatic timed blinking. Cycles \ 89 through linked viewports at variable rate";
90 start->setWhatsThis(text);
91 connect(
start, SIGNAL(released()),
this, SLOT(
start()));
93 QToolButton *forward =
new QToolButton(buttons);
94 forward->setIcon(QPixmap(
toolIconDir() +
"/blinkAdvance.png"));
95 forward->setIconSize(QSize(22, 22));
96 forward->setToolTip(
"Next");
97 forward->setShortcut(Qt::Key_Delete);
98 text =
"<b>Function:</b> Show next linked viewport and stop \ 99 automatic timed blinking \ 100 <p><b>Shortcut:</b> Delete</p>";
101 forward->setWhatsThis(text);
102 connect(forward, SIGNAL(released()),
this, SLOT(
advance()));
111 text =
"<b>Function:</b> Change automatic blink rate between " +
112 QString::number(
p_timeBox->minimum()) +
" and " +
113 QString::number(
p_timeBox->maximum()) +
" seconds";
116 QPushButton *close =
new QPushButton(
"Close", buttons);
117 close->setDefault(
false);
118 close->setAutoDefault(
false);
119 connect(close, SIGNAL(released()),
p_dialog, SLOT(hide()));
120 connect(close, SIGNAL(released()),
this, SLOT(
stop()));
122 QHBoxLayout *hlayout =
new QHBoxLayout();
124 hlayout->addWidget(
stop);
125 hlayout->addWidget(
start);
126 hlayout->addWidget(forward);
128 hlayout->addStretch(1);
129 hlayout->addWidget(close);
130 buttons->setLayout(hlayout);
139 "<b>Function:</b> Opens a blink comparator for linked viewports. \ 140 <p><b>Shortcut:</b>K</p>";
179 static QIcon unlinked(unlinkedIcon);
181 static QIcon linked(linkedIcon);
185 disconnect(d, SIGNAL(linkChanging(
bool)),
this, 0);
186 disconnect(d, SIGNAL(windowTitleChanged()),
this, 0);
187 QListWidgetItem *item =
new QListWidgetItem(
p_listWidget);
188 item->setText(d->parentWidget()->windowTitle());
190 item->setIcon(linked);
193 item->setIcon(unlinked);
195 connect(d, SIGNAL(linkChanging(
bool)),
this, SLOT(
updateTool()));
196 connect(d, SIGNAL(windowTitleChanged()),
this, SLOT(
updateTool()));
265 int msec = (int)(
p_timeBox->value() * 1000.0);
266 QTimer::singleShot(msec,
this, SLOT(
timeout()));
317 QSettings settings(MainWindow::settingsFileName(
"BlinkTool"), QSettings::NativeFormat);
318 settings.setValue(
"rate",
p_timeBox->value());
319 settings.setValue(
"size",
p_dialog->size());
320 settings.setValue(
"pos",
p_dialog->pos());
321 settings.setValue(
"geom",
p_dialog->saveGeometry());
322 settings.setValue(
"splitterState", p_splitter->saveState());
332 QSettings settings(MainWindow::settingsFileName(
"BlinkTool"), QSettings::NativeFormat);
333 double rate = settings.value(
"rate", 0.5).toDouble();
335 p_dialog->restoreGeometry(settings.value(
"geom").toByteArray());
336 p_splitter->restoreState(settings.value(
"splitterState").toByteArray());
338 if (!settings.value(
"pos").toPoint().isNull())
339 p_dialog->move(settings.value(
"pos").toPoint());
341 p_dialog->resize(settings.value(
"size", QSize(492, 492)).toSize());
360 if(e->type() != QEvent::Paint)
return false;
362 static QPixmap lastPixmap;
385 p.drawPixmap(x, y, lastPixmap, sx, sy, -1, -1);
Cube display widget for certain Isis MDI applications.
File name manipulation and expansion.
QPixmap pixmap()
Returns the pixmap.
void setLinked(bool b)
Change the linked state of the viewport.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
bool isLinked() const
Is the viewport linked with other viewports.
Namespace for ISIS/Bullet specific routines.