diff --git a/README.md b/README.md index 991532f..35718d1 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/installer/data/readme.txt b/installer/data/readme.txt index 991532f..35718d1 100644 --- a/installer/data/readme.txt +++ b/installer/data/readme.txt @@ -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 diff --git a/src/gui/configdialog.cpp b/src/gui/configdialog.cpp index 3923277..7344fe7 100644 --- a/src/gui/configdialog.cpp +++ b/src/gui/configdialog.cpp @@ -18,6 +18,8 @@ ConfigDialog::ConfigDialog(QWidget* _parent, Controller* _ctrl) : setFixedSize(size()); + setWindowFlags(SimpleDialogFlag); + Settings* settings = m_ctrl->settings(); Environment* enviro = m_ctrl->enviro(); diff --git a/src/gui/errorwidget.cpp b/src/gui/errorwidget.cpp index 3ce50d1..03b4e65 100644 --- a/src/gui/errorwidget.cpp +++ b/src/gui/errorwidget.cpp @@ -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!")); } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index db284cb..b3c1d67 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -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(); } /** diff --git a/src/gui/newversiondialog.cpp b/src/gui/newversiondialog.cpp index 3de25c2..e5b987e 100644 --- a/src/gui/newversiondialog.cpp +++ b/src/gui/newversiondialog.cpp @@ -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); diff --git a/src/gui/previewdialog.cpp b/src/gui/previewdialog.cpp index f934775..10387b0 100644 --- a/src/gui/previewdialog.cpp +++ b/src/gui/previewdialog.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "previewdialog.h" @@ -33,6 +34,10 @@ PreviewDialog::PreviewDialog(QWidget* _parent, Controller* _ctrl) : setWindowTitle(tr("Active files")); + setWindowFlags(SimpleDialogFlag); + + mainLayout->setSizeConstraint(QLayout::SetFixedSize); + qxtLog->trace("PreviewDialog openned"); } @@ -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); @@ -111,8 +117,6 @@ void PreviewDialog::draw() i++; height = qMax(height, image.height()); } - - setFixedSize(QSize(i*width+22+(i-1)*6, height+100)); } /** diff --git a/src/gui/screensdialog.cpp b/src/gui/screensdialog.cpp index 2cf74d2..1734cea 100644 --- a/src/gui/screensdialog.cpp +++ b/src/gui/screensdialog.cpp @@ -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); @@ -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); diff --git a/src/gui/screensdialog.h b/src/gui/screensdialog.h index 48efb98..2fca58f 100644 --- a/src/gui/screensdialog.h +++ b/src/gui/screensdialog.h @@ -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); diff --git a/src/gui/seteditdialog.cpp b/src/gui/seteditdialog.cpp index 9e4872e..5f4ae59 100644 --- a/src/gui/seteditdialog.cpp +++ b/src/gui/seteditdialog.cpp @@ -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); diff --git a/src/main.cpp b/src/main.cpp index 7b7486c..050b295 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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[]) diff --git a/src/main.h b/src/main.h index 59621fa..8516e0a 100644 --- a/src/main.h +++ b/src/main.h @@ -1,4 +1,5 @@ #ifndef MAIN_H +#define MAIN_H #include #include @@ -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; } @@ -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