Work on many things.
This commit is contained in:
parent
772a871ba7
commit
2c9074b2e8
@ -290,6 +290,7 @@ set(APP_SOURCES
|
||||
src/gui/formcategorydetails.cpp
|
||||
src/gui/plaintoolbutton.cpp
|
||||
src/gui/lineeditwithstatus.cpp
|
||||
src/gui/messagebox.cpp
|
||||
|
||||
# CORE sources.
|
||||
src/core/debugging.cpp
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "qtsingleapplication/qtsingleapplication.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QSessionManager>
|
||||
#include <QRect>
|
||||
#include <QDesktopWidget>
|
||||
|
@ -16,7 +16,11 @@ class LineEditWithStatus : public QWidget {
|
||||
explicit LineEditWithStatus(QWidget *parent = 0);
|
||||
virtual ~LineEditWithStatus();
|
||||
|
||||
|
||||
// TODO: napsat metodu setStatus(enum-statusu, qstring)
|
||||
// kde enum-statusu bude Ok, Warning, Error a qstring bude text kerej se objevi jako
|
||||
// tooltip na toolbuttonu
|
||||
// pak bude proste navazani na textEdited() a tam si bude uzivatel
|
||||
// widgetu nastavovat pres to setStatus co chce on
|
||||
|
||||
private:
|
||||
BaseLineEdit *m_txtInput;
|
||||
|
49
src/gui/messagebox.cpp
Normal file
49
src/gui/messagebox.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include "gui/messagebox.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QtGlobal>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
MessageBox::MessageBox() {
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton MessageBox::showMessageBox(QWidget *parent,
|
||||
QMessageBox::Icon icon,
|
||||
const QString &title,
|
||||
const QString &text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton) {
|
||||
QMessageBox msgBox(icon, title, text, QMessageBox::NoButton, parent);
|
||||
QDialogButtonBox *buttonBox = msgBox.findChild<QDialogButtonBox*>();
|
||||
|
||||
uint mask = QMessageBox::FirstButton;
|
||||
while (mask <= QMessageBox::LastButton) {
|
||||
uint sb = buttons & mask;
|
||||
mask <<= 1;
|
||||
if (!sb)
|
||||
continue;
|
||||
|
||||
// TODO: tady podle hodnoty masky switchnout prave pridanej button a podle toho mu dat ikonu.
|
||||
// neco jako
|
||||
switch (mask) {
|
||||
case QMessageBox::Ok:
|
||||
// TODO: nastav ikonu "ok"
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QPushButton *button = msgBox.addButton((QMessageBox::StandardButton)sb);
|
||||
|
||||
// Choose the first accept role as the default
|
||||
if (msgBox.defaultButton())
|
||||
continue;
|
||||
if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
|| (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton)))
|
||||
msgBox.setDefaultButton(button);
|
||||
}
|
||||
if (msgBox.exec() == -1)
|
||||
return QMessageBox::Cancel;
|
||||
return msgBox.standardButton(msgBox.clickedButton());
|
||||
}
|
23
src/gui/messagebox.h
Normal file
23
src/gui/messagebox.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef MESSAGEBOX_H
|
||||
#define MESSAGEBOX_H
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
class MessageBox {
|
||||
private:
|
||||
// Constructors and destructors.
|
||||
explicit MessageBox();
|
||||
|
||||
public:
|
||||
// TODO: tudle metodu udelat private a udelat public
|
||||
// metody information, warning atd a ty budou tudle volat
|
||||
// se spravnejma parametrama
|
||||
static QMessageBox::StandardButton showMessageBox(QWidget *parent,
|
||||
QMessageBox::Icon icon,
|
||||
const QString& title, const QString& text,
|
||||
QMessageBox::StandardButtons buttons,
|
||||
QMessageBox::StandardButton defaultButton);
|
||||
};
|
||||
|
||||
#endif // MESSAGEBOX_H
|
@ -4,6 +4,7 @@
|
||||
#include "core/messagesmodel.h"
|
||||
#include "core/settings.h"
|
||||
#include "gui/formmain.h"
|
||||
#include "gui/messagebox.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QScrollBar>
|
||||
@ -220,6 +221,9 @@ void MessagesView::openSelectedSourceArticlesExternally() {
|
||||
"%1").toString();
|
||||
|
||||
if (browser.isEmpty() || arguments.isEmpty()) {
|
||||
MessageBox::showMessageBox(this, QMessageBox::Information,
|
||||
"aa", "bb", QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
QMessageBox::critical(this,
|
||||
tr("External browser not set"),
|
||||
tr("External browser is not set, head to application settings and set it up to use this feature."),
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <QWidgetAction>
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QToolButton>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user