From dfca8be71b15bc13997110cc8777dd5a84a1fde7 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 21 Sep 2013 19:25:33 +0200 Subject: - esp reader now handles invalid files more gracefully - files moved will now also be treated as "deleted" in the old location so a newly created file with that same name is not created in overwrite - introduced a mechanism by which MO can recognize if it crashed before when attempting to load a plugin. That plugin can be blacklisted so it doesn't get loaded again - plugins can now programaticaly change their settings - plugins can now store data persistently without exposing that data as settings - requesting an unset-setting from a plugin is no longer treated as a bug - clarified warning message for when files are in overwrite directory - the proxyPython plugin will now discover if python initialization crashed MO on a previous session and give the user a chance to fix it or disable the plugin - bugfix: GetModuleFileName modified the buffer past the zero termination. While this doesn't violate the API documentation it is different from the regular windows implementation - bugfix: proxy plugins couldn't access the parent widget - bugfix: when moving a file from overwrite to a mod the in-memory file structure wasn't updated - bugfix: name input dialog for profiles allowed names that weren't valid directory names - bugfix: profile dialog wasn't able to delete profiles if the name started or ended in whitespaces - bugfix: The name-cells for plugin settings could be changed (without effect) - removed a few obsolete files from the repository --- src/executableslist.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/executableslist.cpp') diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 4e39c1a3..c486a4ca 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -172,16 +172,6 @@ void ExecutablesList::addExecutable(const QString &title, const QString &executa } } -/*void ExecutablesList::remove(const QString &executableName) -{ - for (std::vector::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) { - if (iter->m_Custom && (iter->m_BinaryInfo.absoluteFilePath() == executableName)) { - m_Executables.erase(iter); - break; - } - } -}*/ - void ExecutablesList::remove(const QString &title) { -- cgit v1.3.1 From 35fcf1c25b19b612771a2bc874df7631695e1457 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 22 Feb 2014 19:22:12 +0100 Subject: - made the indicator for drag&drop more visible - message boxes can now be made to not (re-)activate the window - executable names for starting from the command line are now case-insensitive --- src/executableslist.cpp | 2 +- src/messagedialog.cpp | 11 +++--- src/messagedialog.h | 95 +++++++++++++++++++++++++------------------------ src/moapplication.cpp | 51 ++++++++++++++++++++++++-- src/selfupdater.cpp | 2 +- 5 files changed, 104 insertions(+), 57 deletions(-) (limited to 'src/executableslist.cpp') diff --git a/src/executableslist.cpp b/src/executableslist.cpp index c486a4ca..8f2da051 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -106,7 +106,7 @@ const Executable &ExecutablesList::find(const QString &title) const Executable &ExecutablesList::find(const QString &title) { for (std::vector::iterator iter = m_Executables.begin(); iter != m_Executables.end(); ++iter) { - if (iter->m_Title == title) { + if (QString::compare(iter->m_Title, title, Qt::CaseInsensitive) == 0) { return *iter; } } diff --git a/src/messagedialog.cpp b/src/messagedialog.cpp index 8cef1b7c..62696938 100644 --- a/src/messagedialog.cpp +++ b/src/messagedialog.cpp @@ -79,12 +79,13 @@ void MessageDialog::resizeEvent(QResizeEvent *event) } -void MessageDialog::showMessage(const QString &text, QWidget *reference) +void MessageDialog::showMessage(const QString &text, QWidget *reference, bool bringToFront) { - qDebug("%s", qPrintable(text)); if (reference != NULL) { - MessageDialog *dialog = new MessageDialog(text, reference); - dialog->show(); - reference->activateWindow(); + if (bringToFront || (qApp->activeWindow() != NULL)) { + MessageDialog *dialog = new MessageDialog(text, reference); + dialog->show(); + reference->activateWindow(); + } } } diff --git a/src/messagedialog.h b/src/messagedialog.h index 846448d6..0dbc0e6e 100644 --- a/src/messagedialog.h +++ b/src/messagedialog.h @@ -17,50 +17,51 @@ You should have received a copy of the GNU General Public License along with Mod Organizer. If not, see . */ -#ifndef MESSAGEDIALOG_H -#define MESSAGEDIALOG_H - -#include - -namespace Ui { - class MessageDialog; -} - -/** - * borderless dialog used to display short messages that will automatically - * vanish after a moment - **/ -class MessageDialog : public QDialog -{ - Q_OBJECT - -public: - /** - * @brief constructor - * - * @param text the message to display - * @param reference parent widget. This will also be used to position the message at the bottom center of the dialog - **/ - - explicit MessageDialog(const QString &text, QWidget *reference); - - ~MessageDialog(); - - /** - * factory function for message dialogs. This can be used as a fire-and-forget. The message - * will automatically positioned to the reference dialog and get a reasonable view time - * - * @param text the text to display. The length of this text is used to determine how long the dialog is to be shown - * @param reference the reference widget on top of which the message should be displayed - **/ - static void showMessage(const QString &text, QWidget *reference); - -protected: - - virtual void resizeEvent(QResizeEvent *event); - -private: - Ui::MessageDialog *ui; -}; - -#endif // MESSAGEDIALOG_H +#ifndef MESSAGEDIALOG_H +#define MESSAGEDIALOG_H + +#include + +namespace Ui { + class MessageDialog; +} + +/** + * borderless dialog used to display short messages that will automatically + * vanish after a moment + **/ +class MessageDialog : public QDialog +{ + Q_OBJECT + +public: + /** + * @brief constructor + * + * @param text the message to display + * @param reference parent widget. This will also be used to position the message at the bottom center of the dialog + **/ + + explicit MessageDialog(const QString &text, QWidget *reference); + + ~MessageDialog(); + + /** + * factory function for message dialogs. This can be used as a fire-and-forget. The message + * will automatically positioned to the reference dialog and get a reasonable view time + * + * @param text the text to display. The length of this text is used to determine how long the dialog is to be shown + * @param reference the reference widget on top of which the message should be displayed + * @param true if the message should bring MO to front to ensure this message is visible + **/ + static void showMessage(const QString &text, QWidget *reference, bool bringToFront = true); + +protected: + + virtual void resizeEvent(QResizeEvent *event); + +private: + Ui::MessageDialog *ui; +}; + +#endif // MESSAGEDIALOG_H diff --git a/src/moapplication.cpp b/src/moapplication.cpp index 7e3104db..f09b2fd9 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -25,6 +25,50 @@ along with Mod Organizer. If not, see . #include #include #include +#include +#include +#include +#include + + +#include + + +class ProxyStyle : public QProxyStyle { +public: + ProxyStyle(QStyle *baseStyle = 0) + : QProxyStyle(baseStyle) + { + } + + void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { + if(element == QStyle::PE_IndicatorItemViewItemDrop) { + painter->setRenderHint(QPainter::Antialiasing, true); + + QColor col(option->palette.foreground().color()); + QPen pen(col); + pen.setWidth(2); + col.setAlpha(50); + QBrush brush(col); + + painter->setPen(pen); + painter->setBrush(brush); + if(option->rect.height() == 0) { + QPoint tri[3] = { + option->rect.topLeft(), + option->rect.topLeft() + QPoint(-5, 5), + option->rect.topLeft() + QPoint(-5, -5) + }; + painter->drawPolygon(tri, 3); + painter->drawLine(QPoint(option->rect.topLeft().x(), option->rect.topLeft().y()), option->rect.topRight()); + } else { + painter->drawRoundedRect(option->rect, 5, 5); + } + } else { + QProxyStyle::drawPrimitive(element, option, painter, widget); + } + } +}; MOApplication::MOApplication(int argc, char **argv) @@ -32,6 +76,7 @@ MOApplication::MOApplication(int argc, char **argv) { connect(&m_StyleWatcher, SIGNAL(fileChanged(QString)), SLOT(updateStyle(QString))); m_DefaultStyle = style()->objectName(); + setStyle(new ProxyStyle(style())); } @@ -79,13 +124,13 @@ bool MOApplication::notify(QObject *receiver, QEvent *event) void MOApplication::updateStyle(const QString &fileName) { if (fileName == "Plastique") { - setStyle(new QPlastiqueStyle); + setStyle(new ProxyStyle(new QPlastiqueStyle)); setStyleSheet(""); } else if (fileName == "Cleanlooks") { - setStyle(new QCleanlooksStyle); + setStyle(new ProxyStyle(new QCleanlooksStyle)); setStyleSheet(""); } else { - setStyle(m_DefaultStyle); + setStyle(new ProxyStyle(QStyleFactory::create(m_DefaultStyle))); if (QFile::exists(fileName)) { setStyleSheet(QString("file:///%1").arg(fileName)); } else { diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 3a0db83f..14df8566 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -437,7 +437,7 @@ void SelfUpdater::nxmRequestFailed(int, int, QVariant, int requestID, const QStr --m_Attempts; } else { qWarning("Failed to retrieve update information: %s", qPrintable(errorMessage)); - MessageDialog::showMessage(tr("Failed to retrieve update information: %1").arg(errorMessage), m_Parent); + MessageDialog::showMessage(tr("Failed to retrieve update information: %1").arg(errorMessage), m_Parent, false); } } } -- cgit v1.3.1