Skip to content

Commit

Permalink
PreviewDialog is a modal, disable ? icon on all dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Nov 10, 2014
1 parent 49c26a5 commit b8a3506
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ You will need Qt 4.8.4 and libqxt 0.6.2


## Changelog
* [1.8 (10/11/2014)](http://www.strangeplanet.fr/work/umwp-autochanger/download.php?ver=1.7)
* [1.8 (10/11/2014)](http://www.strangeplanet.fr/work/umwp-autochanger/download.php?ver=1.8)
* new: can disable wallpaper support on specific monitors
* new: choose background color of each monitor
* new: "Delete" button on "Active files" dialog
Expand Down
2 changes: 1 addition & 1 deletion installer/data/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ You will need Qt 4.8.4 and libqxt 0.6.2


## Changelog
* [1.8 (10/11/2014)](http://www.strangeplanet.fr/work/umwp-autochanger/download.php?ver=1.7)
* [1.8 (10/11/2014)](http://www.strangeplanet.fr/work/umwp-autochanger/download.php?ver=1.8)
* new: can disable wallpaper support on specific monitors
* new: choose background color of each monitor
* new: "Delete" button on "Active files" dialog
Expand Down
2 changes: 2 additions & 0 deletions src/gui/configdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ConfigDialog::ConfigDialog(QWidget* _parent, Controller* _ctrl) :

setFixedSize(size());

setWindowFlags(SimpleDialogFlag);

Settings* settings = m_ctrl->settings();
Environment* enviro = m_ctrl->enviro();

Expand Down
2 changes: 1 addition & 1 deletion src/gui/errorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ErrorWidget::ErrorWidget(QWidget* _parent, Controller* _ctrl) :
{
description->setText(tr("Can't access UltraMon API"));
}
else if (UMWP_STATE & UMWP::UNKNOWN_ERROR)
else
{
description->setText(tr("An unknown error appened!"));
}
Expand Down
5 changes: 2 additions & 3 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,8 @@ void MainWindow::openAboutDialog()
*/
void MainWindow::openPreviewDialog()
{
PreviewDialog* dialog = new PreviewDialog(this, m_ctrl);
dialog->move(geometry().left()+geometry().width()+15, geometry().top());
dialog->show();
PreviewDialog dialog(this, m_ctrl);
dialog.exec();
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/gui/newversiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ NewVersionDialog::NewVersionDialog(QWidget* _parent, Controller* _ctrl) :
{
ui->setupUi(this);

setWindowFlags(SimpleDialogFlag);

m_version = m_ctrl->enviro()->newVersion();

ui->progressBar->setVisible(false);
Expand Down
10 changes: 7 additions & 3 deletions src/gui/previewdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QVBoxLayout>
#include <QDialogButtonBox>
#include <QMessageBox>
#include <QFontMetrics>

#include "previewdialog.h"

Expand Down Expand Up @@ -33,6 +34,10 @@ PreviewDialog::PreviewDialog(QWidget* _parent, Controller* _ctrl) :

setWindowTitle(tr("Active files"));

setWindowFlags(SimpleDialogFlag);

mainLayout->setSizeConstraint(QLayout::SetFixedSize);

qxtLog->trace("PreviewDialog openned");
}

Expand Down Expand Up @@ -75,7 +80,8 @@ void PreviewDialog::draw()
}

// label with filename
QLabel* label = new QLabel(QFileInfo(*it).fileName());
QString text = fontMetrics().elidedText(QFileInfo(*it).fileName(), Qt::ElideRight, width);
QLabel* label = new QLabel(text);
label->setTextInteractionFlags(Qt::TextSelectableByMouse);
label->setCursor(Qt::IBeamCursor);

Expand Down Expand Up @@ -111,8 +117,6 @@ void PreviewDialog::draw()
i++;
height = qMax(height, image.height());
}

setFixedSize(QSize(i*width+22+(i-1)*6, height+100));
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/gui/screensdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ ScreensDialog::ScreensDialog(QWidget* _parent, Controller* _ctrl) :
m_monitors.append(m_ctrl->settings()->monitor(i));
}

initScene();
init();

setWindowFlags(SimpleDialogFlag);

layout()->setSizeConstraint(QLayout::SetFixedSize);

Expand Down Expand Up @@ -88,7 +90,7 @@ void ScreensDialog::save()
/**
* @brief Build the scenes displaying monitors
*/
void ScreensDialog::initScene()
void ScreensDialog::init()
{
m_ratio = 400.f/m_ctrl->enviro()->wpSize(-1).width();
m_viewport = m_ctrl->enviro()->wpSize(-1).scaled(m_ratio);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/screensdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ScreensDialog : public QDialog
void save();

private:
void initScene();
void init();
void addScreen(int _i, const QScreen &_screen);
void updateScreen(int _i);
void selectScreen(int _i);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/seteditdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SetEditDialog::SetEditDialog(QWidget* _parent, Set* _set, Settings* _settings) :

setFixedSize(size());

setWindowFlags(SimpleDialogFlag);

ui->selectType->addItem(QIcon(":/icon/w_monitor"), tr("One image for each monitor"), UM::W_MONITOR);
ui->selectType->addItem(QIcon(":/icon/w_desktop"), tr("One image for the whole desktop"), UM::W_DESKTOP);

Expand Down
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include "settings.h"
#include "environment.h"

extern short UMWP_STATE = 0;

/**
* @brief Global holding app state (main errors)
*/
short UMWP_STATE = 0;


int main(int argc, char *argv[])
Expand Down
8 changes: 5 additions & 3 deletions src/main.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#ifndef MAIN_H
#define MAIN_H

#include <windows.h>
#include <QtXml>
Expand All @@ -14,8 +15,8 @@ namespace UMWP {
const short OK = 0;
const short NOT_INSTALLED = 1;
const short BAD_VERSION = 2;
const short FILE_NOT_FOUND = 4;
const short SETTINGS_FILE_ERROR = 8;
const short FILE_NOT_FOUND = 4; // not used
const short SETTINGS_FILE_ERROR = 8; // not used
const short COM_ERROR = 16;
const short UNKNOWN_ERROR = 256;
}
Expand Down Expand Up @@ -62,10 +63,11 @@ struct Monitor {
Q_DECLARE_METATYPE(UM::WALLPAPER)
Q_DECLARE_METATYPE(UM::IMAGE)

// flags for dialog without help button
const Qt::WindowFlags SimpleDialogFlag = Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint;

// common functions
void setDomNodeValue(QDomDocument* _dom, QDomNode* _node, const QString &_value);
void addSimpleTextNode(QDomDocument* _dom, QDomNode* _parent, const QString &_name, const QString &_value);

#define MAIN_H
#endif // MAIN_H

0 comments on commit b8a3506

Please sign in to comment.