Skip to content

Commit

Permalink
Shell|GUI: Mirrored map outline on Y axis, various fixes
Browse files Browse the repository at this point in the history
The Preferences dialog is a bit clearer now, too.
  • Loading branch information
skyjake committed Feb 13, 2013
1 parent 73f3a30 commit 5f59ff1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
8 changes: 6 additions & 2 deletions doomsday/tools/shell/shell-gui/src/guishellapp.cpp
Expand Up @@ -40,6 +40,7 @@ struct GuiShellApp::Instance
QMenu *localMenu;
#ifdef MACOSX
QAction *stopAction;
QAction *disconnectAction;
#endif
QList<LinkWindow *> windows;

Expand Down Expand Up @@ -78,8 +79,9 @@ GuiShellApp::GuiShellApp(int &argc, char **argv)
QMenu *menu = d->menuBar->addMenu(tr("Connection"));
menu->addAction(tr("Connect..."), this, SLOT(connectToServer()),
QKeySequence(tr("Ctrl+O", "Connection|Connect")));
menu->addAction(tr("Disconnect"), this, SLOT(disconnectFromServer()),
QKeySequence(tr("Ctrl+D", "Connection|Disconnect")));
d->disconnectAction = menu->addAction(tr("Disconnect"), this, SLOT(disconnectFromServer()),
QKeySequence(tr("Ctrl+D", "Connection|Disconnect")));
d->disconnectAction->setDisabled(true);
menu->addSeparator();
menu->addAction(tr("Close Window"), this, SLOT(closeActiveWindow()),
QKeySequence(tr("Ctrl+W", "Connection|Close Window")));
Expand All @@ -91,6 +93,7 @@ GuiShellApp::GuiShellApp(int &argc, char **argv)
svMenu->addSeparator();
svMenu->addMenu(d->localMenu);

connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
connect(svMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));

// These will appear in the application menu:
Expand Down Expand Up @@ -281,6 +284,7 @@ void GuiShellApp::updateMenu()
#ifdef MACOSX
LinkWindow *win = dynamic_cast<LinkWindow *>(activeWindow());
d->stopAction->setEnabled(win && win->isConnected());
d->disconnectAction->setEnabled(win && win->isConnected());
#endif
updateLocalServerMenu();
}
Expand Down
10 changes: 7 additions & 3 deletions doomsday/tools/shell/shell-gui/src/linkwindow.cpp
Expand Up @@ -205,20 +205,22 @@ LinkWindow::LinkWindow(QWidget *parent)
QIcon icon(":/images/toolbar_placeholder.png");

QToolBar *tools = addToolBar(tr("View"));
tools->setMovable(false);
tools->setFloatable(false);

d->statusButton = new QToolButton;
d->statusButton->setIcon(icon);
//d->statusButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
d->statusButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
d->statusButton->setFocusPolicy(Qt::NoFocus);
d->statusButton->setText(tr("Status"));
d->statusButton->setIcon(icon);
d->statusButton->setCheckable(true);
d->statusButton->setChecked(true);
connect(d->statusButton, SIGNAL(pressed()), this, SLOT(switchToStatus()));
tools->addWidget(d->statusButton);

d->consoleButton = new QToolButton;
d->consoleButton->setIcon(icon);
//d->consoleButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
d->consoleButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
d->consoleButton->setFocusPolicy(Qt::NoFocus);
d->consoleButton->setText(tr("Console"));
d->consoleButton->setCheckable(true);
Expand Down Expand Up @@ -266,6 +268,7 @@ bool LinkWindow::isConnected() const

void LinkWindow::closeEvent(QCloseEvent *event)
{
/*
if(isConnected())
{
if(QMessageBox::question(
Expand All @@ -278,6 +281,7 @@ void LinkWindow::closeEvent(QCloseEvent *event)
return;
}
}
*/

closeConnection();
event->accept();
Expand Down
6 changes: 2 additions & 4 deletions doomsday/tools/shell/shell-gui/src/opendialog.cpp
Expand Up @@ -182,10 +182,8 @@ void OpenDialog::updateLocalList(bool autoselect)
// Remove servers no longer present.
for(int i = d->firstFoundIdx; i < d->address->count(); )
{
Q_ASSERT(d->address->itemData(i).canConvert<Address>());

Address sv = d->address->itemData(i).value<Address>();
if(!finder.foundServers().contains(sv))
if(!d->address->itemData(i).canConvert<Address>() ||
!finder.foundServers().contains(d->address->itemData(i).value<Address>()))
{
d->address->removeItem(i);
continue;
Expand Down
23 changes: 12 additions & 11 deletions doomsday/tools/shell/shell-gui/src/preferences.cpp
Expand Up @@ -10,7 +10,7 @@

DENG2_PIMPL(Preferences)
{
QCheckBox *useDefaultIwad;
QCheckBox *useCustomIwad;
FolderSelection *iwadFolder;

Instance(Public &i) : Base(i)
Expand All @@ -27,16 +27,17 @@ DENG2_PIMPL(Preferences)
QGroupBox *group = new QGroupBox(tr("IWAD Folder"));
mainLayout->addWidget(group);

useDefaultIwad = new QCheckBox(tr("Use Doomsday's configured IWAD folder"));
useDefaultIwad->setChecked(st.value("Preferences/defaultIwad", true).toBool());
useDefaultIwad->setToolTip(tr("Doomsday's IWAD folder can be configured using "
"configuration files or environment variables."));
useCustomIwad = new QCheckBox(tr("Use a custom IWAD folder"));
useCustomIwad->setChecked(st.value("Preferences/customIwad", false).toBool());
useCustomIwad->setToolTip(tr("Doomsday's default IWAD folder can be configured\n"
"using configuration files, environment variables,\n"
"or command line options."));

iwadFolder = new FolderSelection(tr("Select IWAD Folder"));
iwadFolder->setPath(st.value("Preferences/iwadFolder").toString());

QVBoxLayout *bl = new QVBoxLayout;
bl->addWidget(useDefaultIwad);
bl->addWidget(useCustomIwad);
bl->addWidget(iwadFolder);
group->setLayout(bl);

Expand All @@ -58,7 +59,7 @@ DENG2_PIMPL(Preferences)
Preferences::Preferences(QWidget *parent) :
QDialog(parent), d(new Instance(*this))
{
connect(d->useDefaultIwad, SIGNAL(toggled(bool)), this, SLOT(validate()));
connect(d->useCustomIwad, SIGNAL(toggled(bool)), this, SLOT(validate()));
connect(this, SIGNAL(accepted()), this, SLOT(saveState()));
validate();
}
Expand All @@ -70,7 +71,7 @@ Preferences::~Preferences()

de::NativePath Preferences::iwadFolder() const
{
if(!d->useDefaultIwad->isChecked())
if(d->useCustomIwad->isChecked())
{
return d->iwadFolder->path();
}
Expand All @@ -80,11 +81,11 @@ de::NativePath Preferences::iwadFolder() const
void Preferences::saveState()
{
QSettings st;
st.setValue("Preferences/defaultIwad", d->useDefaultIwad->isChecked());
st.setValue("Preferences/iwadFolder", iwadFolder().toString());
st.setValue("Preferences/customIwad", d->useCustomIwad->isChecked());
st.setValue("Preferences/iwadFolder", d->iwadFolder->path().toString());
}

void Preferences::validate()
{
d->iwadFolder->setDisabled(d->useDefaultIwad->isChecked());
d->iwadFolder->setEnabled(d->useCustomIwad->isChecked());
}
4 changes: 2 additions & 2 deletions doomsday/tools/shell/shell-gui/src/statuswidget.cpp
Expand Up @@ -92,8 +92,8 @@ void StatusWidget::setMapOutline(shell::MapOutlinePacket const &outline)
shell::MapOutlinePacket::Line const &ln = outline.line(i);
painter.setPen(ln.type == shell::MapOutlinePacket::OneSidedLine? Qt::black : Qt::gray);

QPoint a(ln.start.x, ln.start.y);
QPoint b(ln.end.x, ln.end.y);
QPoint a(ln.start.x, -ln.start.y);
QPoint b(ln.end.x, -ln.end.y);

painter.drawLine(a, b);

Expand Down

0 comments on commit 5f59ff1

Please sign in to comment.