This commit is contained in:
Igor malinovskiy
2015-02-14 14:21:44 +02:00
parent a199890ff4
commit b7ba400877
6 changed files with 157 additions and 141 deletions
+12
View File
@@ -1,6 +1,7 @@
#include <QtXml>
#include <QDebug>
#include <QAbstractItemModel>
#include <easylogging++.h>
#include "modules/connections-tree/items/serveritem.h"
#include "modules/redisclient/connectionconfig.h"
#include "modules/value-editor/viewmodel.h"
@@ -34,6 +35,17 @@ void ConnectionsManager::addNewConnection(const RedisClient::ConnectionConfig &c
//add connection to internal container
m_connections.push_back(connection);
//set logger
QObject::connect(connection.data(), &RedisClient::Connection::log, this, [this](const QString& info){
QString msg = QString("Connection: %1").arg(info);
LOG(INFO) << msg.toStdString();
});
QObject::connect(connection.data(), &RedisClient::Connection::error, this, [this](const QString& error){
QString msg = QString("Connection: %1").arg(error);
LOG(ERROR) << msg.toStdString();
});
//add connection to view container
using namespace ConnectionsTree;
+2
View File
@@ -4,7 +4,9 @@
#include <QSettings>
#include <QFontDatabase>
#ifndef RDM_VERSION
#include "version.h"
#endif
#include "modules/crashhandler/crashhandler.h"
#include "app/dialogs/mainwindow.h"
+2 -3
View File
@@ -39,10 +39,9 @@ public:
void handle(const el::LogDispatchData* data) {
if (m_tab)
m_tab.toStrongRef()->print(QString("%1 : %2 (%3)")
m_tab.toStrongRef()->print(QString("%1 : %2")
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
.arg(QString::fromStdString(data->logMessage()->message()))
.arg(QString::fromStdString(data->logMessage()->func()))
.arg(QString::fromStdString(data->logMessage()->message()))
);
}
private:
+3 -1
View File
@@ -216,7 +216,7 @@ void RedisClient::Connection::commandAddedToTransporter()
void RedisClient::Connection::auth()
{
// todo: check is socket succesufully connected before run this method
m_connected = true;
m_connected = true;
if (config.useAuth()) {
Command authCmd(QStringList() << "auth" << config.auth());
@@ -232,8 +232,10 @@ void RedisClient::Connection::auth()
m_serverInfo = ServerInfo::fromString(infoResult.getValue().toString());
setConnectedState();
emit log("AUTH OK");
emit authOk();
} else {
emit error("AUTH ERROR");
emit authError("Redis server require password or password invalid");
m_connected = false;
}
+137 -136
View File
@@ -1,136 +1,137 @@
#-------------------------------------------------
#
# Redis Desktop Manager
#
#-------------------------------------------------
QT += core gui network xml concurrent widgets quick quickwidgets
TARGET = rdm
TEMPLATE = app
# Skip version file
!exists( $$PWD/version.h ) {
write_file( $$PWD/version.h )
DEFINES += RDM_VERSION=\\\"0.8.0.0\\\"
}
SOURCES += \
$$PWD/main.cpp \
$$PWD/app/dialogs/*.cpp \
$$PWD/app/models/*.cpp \
$$PWD/app/models/key-models/*.cpp \
$$PWD/app/widgets/*.cpp \
$$PWD/modules/connections-tree/*.cpp \
$$PWD/modules/connections-tree/items/*.cpp \
$$PWD/modules/console/*.cpp \
$$PWD/modules/value-editor/*.cpp \
$$PWD/modules/redisclient/*.cpp \
$$PWD/modules/redisclient/ssh/*.cpp \
$$PWD/modules/redisclient/transporters/*.cpp \
$$PWD/modules/crashhandler/*.cpp \
$$PWD/modules/updater/*.cpp \
HEADERS += \
$$PWD/version.h \
$$PWD/app/dialogs/*.h \
$$PWD/app/models/*.h \
$$PWD/app/models/key-models/*.h \
$$PWD/app/widgets/*.h \
$$PWD/modules/connections-tree/*.h \
$$PWD/modules/connections-tree/items/*.h \
$$PWD/modules/console/*.h \
$$PWD/modules/value-editor/*.h \
$$PWD/modules/redisclient/*.h \
$$PWD/modules/redisclient/ssh/*.h \
$$PWD/modules/redisclient/transporters/*.h \
$$PWD/modules/crashhandler/*.h \
$$PWD/modules/updater/*.h \
$$PWD/modules/*.h \
FORMS += \
$$PWD/app/forms/*.ui \
THIRDPARTYDIR = $$PWD/../3rdparty/
include($$THIRDPARTYDIR/3rdparty.pri)
#win32-msvc* {
win32 {
CONFIG += c++11
LIBS += -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32
RC_FILE += $$PWD/resources/rdm.rc
release: DESTDIR = ./../bin/windows/release
debug: DESTDIR = ./../bin/windows/debug
}
unix:macx { # OSX
CONFIG += c++11 #release
#CONFIG -= debug
debug {
CONFIG-=app_bundle
}
release: DESTDIR = ./../bin/linux/release
debug: DESTDIR = ./../bin/linux/debug
#deployment
QMAKE_INFO_PLIST = $$PWD/resources/Info.plist
ICON = $$PWD/resources/rdm.icns
release {
CRASHREPORTER_APP.files = $$DESTDIR/crashreporter
CRASHREPORTER_APP.path = Contents/MacOS
QMAKE_BUNDLE_DATA += CRASHREPORTER_APP
}
}
unix:!macx { # ubuntu & debian
CONFIG += static release
CONFIG -= debug
#Qt static linked on Ubuntu/Debian
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
release: DESTDIR = ./../bin/linux/release
debug: DESTDIR = ./../bin/linux/debug
#deployment
target.path = /usr/share/redis-desktop-manager/bin
target.files = $$DESTDIR/rdm $$DESTDIR/crashreporter $$PWD/resources/qt.conf $$PWD/resources/rdm.png $$PWD/resources/rdm.sh
INSTALLS += target
data.path = /usr/share/redis-desktop-manager/lib
data.files = $$PWD/lib/*
INSTALLS += data
deskicon.path = /usr/share/applications
deskicon.files = $$PWD/resources/rdm.desktop
INSTALLS += deskicon
}
UI_DIR = $$DESTDIR/ui
OBJECTS_DIR = $$DESTDIR/obj
MOC_DIR = $$DESTDIR/obj
RCC_DIR = $$DESTDIR/obj
INCLUDEPATH += $$PWD/ \
$$PWD/modules/ \
$$UI_DIR/ \
RESOURCES += \
$$PWD/resources/rdm.qrc \
$$PWD/resources/fonts.qrc \
OTHER_FILES += \
qt.conf \
Info.plist \
qml\*.qml \
#-------------------------------------------------
#
# Redis Desktop Manager
#
#-------------------------------------------------
QT += core gui network xml concurrent widgets quick quickwidgets
TARGET = rdm
TEMPLATE = app
# Skip version file
!exists( $$PWD/version.h ) {
DEFINES += RDM_VERSION=\\\"0.8.0.0\\\"
}
DEFINES += ELPP_QT_LOGGING ELPP_STL_LOGGING
SOURCES += \
$$PWD/main.cpp \
$$PWD/app/dialogs/*.cpp \
$$PWD/app/models/*.cpp \
$$PWD/app/models/key-models/*.cpp \
$$PWD/app/widgets/*.cpp \
$$PWD/modules/connections-tree/*.cpp \
$$PWD/modules/connections-tree/items/*.cpp \
$$PWD/modules/console/*.cpp \
$$PWD/modules/value-editor/*.cpp \
$$PWD/modules/redisclient/*.cpp \
$$PWD/modules/redisclient/ssh/*.cpp \
$$PWD/modules/redisclient/transporters/*.cpp \
$$PWD/modules/crashhandler/*.cpp \
$$PWD/modules/updater/*.cpp \
HEADERS += \
$$PWD/version.h \
$$PWD/app/dialogs/*.h \
$$PWD/app/models/*.h \
$$PWD/app/models/key-models/*.h \
$$PWD/app/widgets/*.h \
$$PWD/modules/connections-tree/*.h \
$$PWD/modules/connections-tree/items/*.h \
$$PWD/modules/console/*.h \
$$PWD/modules/value-editor/*.h \
$$PWD/modules/redisclient/*.h \
$$PWD/modules/redisclient/ssh/*.h \
$$PWD/modules/redisclient/transporters/*.h \
$$PWD/modules/crashhandler/*.h \
$$PWD/modules/updater/*.h \
$$PWD/modules/*.h \
FORMS += \
$$PWD/app/forms/*.ui \
THIRDPARTYDIR = $$PWD/../3rdparty/
include($$THIRDPARTYDIR/3rdparty.pri)
#win32-msvc* {
win32 {
CONFIG += c++11
LIBS += -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32
RC_FILE += $$PWD/resources/rdm.rc
release: DESTDIR = ./../bin/windows/release
debug: DESTDIR = ./../bin/windows/debug
}
unix:macx { # OSX
CONFIG += c++11 #release
#CONFIG -= debug
debug {
CONFIG-=app_bundle
}
release: DESTDIR = ./../bin/linux/release
debug: DESTDIR = ./../bin/linux/debug
#deployment
QMAKE_INFO_PLIST = $$PWD/resources/Info.plist
ICON = $$PWD/resources/rdm.icns
release {
CRASHREPORTER_APP.files = $$DESTDIR/crashreporter
CRASHREPORTER_APP.path = Contents/MacOS
QMAKE_BUNDLE_DATA += CRASHREPORTER_APP
}
}
unix:!macx { # ubuntu & debian
CONFIG += static release
CONFIG -= debug
#Qt static linked on Ubuntu/Debian
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
release: DESTDIR = ./../bin/linux/release
debug: DESTDIR = ./../bin/linux/debug
#deployment
target.path = /usr/share/redis-desktop-manager/bin
target.files = $$DESTDIR/rdm $$DESTDIR/crashreporter $$PWD/resources/qt.conf $$PWD/resources/rdm.png $$PWD/resources/rdm.sh
INSTALLS += target
data.path = /usr/share/redis-desktop-manager/lib
data.files = $$PWD/lib/*
INSTALLS += data
deskicon.path = /usr/share/applications
deskicon.files = $$PWD/resources/rdm.desktop
INSTALLS += deskicon
}
UI_DIR = $$DESTDIR/ui
OBJECTS_DIR = $$DESTDIR/obj
MOC_DIR = $$DESTDIR/obj
RCC_DIR = $$DESTDIR/obj
INCLUDEPATH += $$PWD/ \
$$PWD/modules/ \
$$UI_DIR/ \
RESOURCES += \
$$PWD/resources/rdm.qrc \
$$PWD/resources/fonts.qrc \
OTHER_FILES += \
qt.conf \
Info.plist \
qml\*.qml \
@@ -103,7 +103,7 @@ void TestConnection::testRetriveCollection()
QCOMPARE(result.canConvert(QMetaType::QVariantList), true);
callbackCalled = true;
});
wait(10000);
wait(2000);
//then - part 2
QCOMPARE(callbackCalled, true);