diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt index 66d8b055..1caa14b8 100644 --- a/src/widgets/CMakeLists.txt +++ b/src/widgets/CMakeLists.txt @@ -1,66 +1,67 @@ set(Ruqola_widgets_SRCS ruqolamainwindow.cpp ruqolacentralwidget.cpp ) set(Ruqola_widgets_dialog_SRCS dialogs/serverinfowidget.cpp dialogs/uploadfiledialog.cpp dialogs/uploadfilewidget.cpp ) set(Ruqola_channellist_SRCS channellist/channellistwidget.cpp channellist/statuscombobox.cpp channellist/channellistview.cpp ) set(Ruqola_roomwidget_SRCS room/roomwidget.cpp room/roomheaderwidget.cpp room/messagelistview.cpp room/messagelineedit.cpp room/messagelistdelegate.cpp + room/messagelinewidget.cpp ) ecm_qt_declare_logging_category(Ruqola_widgets_SRCS HEADER ruqolawidgets_debug.h IDENTIFIER RUQOLAWIDGETS_LOG CATEGORY_NAME org.kde.ruqola.widgets) add_library(libruqolawidgets ${Ruqola_widgets_SRCS} ${Ruqola_widgets_dialog_SRCS} ${Ruqola_channellist_SRCS} ${Ruqola_roomwidget_SRCS} ) generate_export_header(libruqolawidgets BASE_NAME libruqolawidgets) target_link_libraries(libruqolawidgets Qt5::Gui Qt5::Widgets KF5::I18n KF5::ConfigCore KF5::XmlGui librocketchatrestapi-qt5 libruqolacore ) if (NOT WIN32) target_link_libraries(libruqolawidgets Qt5::DBus) endif() set_target_properties(libruqolawidgets PROPERTIES OUTPUT_NAME ruqolawidgets VERSION ${RUQOLA_LIB_VERSION} SOVERSION ${RUQOLA_LIB_SOVERSION} ) if (BUILD_TESTING) add_subdirectory(autotests) add_subdirectory(tests) add_subdirectory(channellist/autotests) add_subdirectory(room/autotests) add_subdirectory(dialogs/autotests) endif() install(TARGETS libruqolawidgets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) diff --git a/src/widgets/channellist/statuscombobox.cpp b/src/widgets/channellist/statuscombobox.cpp index 993f5c07..8dea9675 100644 --- a/src/widgets/channellist/statuscombobox.cpp +++ b/src/widgets/channellist/statuscombobox.cpp @@ -1,32 +1,37 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "statuscombobox.h" StatusCombobox::StatusCombobox(QWidget *parent) : QComboBox(parent) { - + init(); } StatusCombobox::~StatusCombobox() { } + +void StatusCombobox::init() +{ + //TODO +} diff --git a/src/widgets/channellist/statuscombobox.h b/src/widgets/channellist/statuscombobox.h index 0eacd825..fb967b8d 100644 --- a/src/widgets/channellist/statuscombobox.h +++ b/src/widgets/channellist/statuscombobox.h @@ -1,36 +1,38 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef STATUSCOMBOBOX_H #define STATUSCOMBOBOX_H #include #include "libruqolawidgets_private_export.h" class LIBRUQOLAWIDGETS_TESTS_EXPORT StatusCombobox : public QComboBox { Q_OBJECT public: explicit StatusCombobox(QWidget *parent = nullptr); ~StatusCombobox(); +private: + void init(); }; #endif // STATUSCOMBOBOX_H diff --git a/src/widgets/room/autotests/CMakeLists.txt b/src/widgets/room/autotests/CMakeLists.txt index c8571a4c..5bab4797 100644 --- a/src/widgets/room/autotests/CMakeLists.txt +++ b/src/widgets/room/autotests/CMakeLists.txt @@ -1,12 +1,13 @@ macro(add_ruqolaroom_test _source) set( _test ${_source}) get_filename_component( _name ${_source} NAME_WE ) add_executable( ${_name} ${_test} ) add_test(NAME ${_name} COMMAND ${_name} ) ecm_mark_as_test(${_name}) target_link_libraries( ${_name} Qt5::Test libruqolacore libruqolawidgets) endmacro() add_ruqolaroom_test(roomwidgettest.cpp) add_ruqolaroom_test(roomheaderwidgettest.cpp) add_ruqolaroom_test(messagelineedittest.cpp) +add_ruqolaroom_test(messagelinewidgettest.cpp) diff --git a/src/widgets/channellist/statuscombobox.cpp b/src/widgets/room/autotests/messagelinewidgettest.cpp similarity index 82% copy from src/widgets/channellist/statuscombobox.cpp copy to src/widgets/room/autotests/messagelinewidgettest.cpp index 993f5c07..f020e3e2 100644 --- a/src/widgets/channellist/statuscombobox.cpp +++ b/src/widgets/room/autotests/messagelinewidgettest.cpp @@ -1,32 +1,30 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "statuscombobox.h" +#include "messagelinewidgettest.h" +#include "room/messagelinewidget.h" +#include +QTEST_MAIN(MessageLineWidgetTest) -StatusCombobox::StatusCombobox(QWidget *parent) - : QComboBox(parent) -{ - -} - -StatusCombobox::~StatusCombobox() +MessageLineWidgetTest::MessageLineWidgetTest(QObject *parent) + : QObject(parent) { } diff --git a/src/widgets/channellist/statuscombobox.h b/src/widgets/room/autotests/messagelinewidgettest.h similarity index 76% copy from src/widgets/channellist/statuscombobox.h copy to src/widgets/room/autotests/messagelinewidgettest.h index 0eacd825..81ba34bb 100644 --- a/src/widgets/channellist/statuscombobox.h +++ b/src/widgets/room/autotests/messagelinewidgettest.h @@ -1,36 +1,34 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef STATUSCOMBOBOX_H -#define STATUSCOMBOBOX_H +#ifndef MESSAGELINEWIDGETTEST_H +#define MESSAGELINEWIDGETTEST_H -#include +#include -#include "libruqolawidgets_private_export.h" - -class LIBRUQOLAWIDGETS_TESTS_EXPORT StatusCombobox : public QComboBox +class MessageLineWidgetTest : public QObject { Q_OBJECT public: - explicit StatusCombobox(QWidget *parent = nullptr); - ~StatusCombobox(); + explicit MessageLineWidgetTest(QObject *parent = nullptr); + ~MessageLineWidgetTest() = default; }; -#endif // STATUSCOMBOBOX_H +#endif // MESSAGELINEWIDGETTEST_H diff --git a/src/widgets/room/messagelineedit.cpp b/src/widgets/room/messagelineedit.cpp index aa0faffe..e8eeacd2 100644 --- a/src/widgets/room/messagelineedit.cpp +++ b/src/widgets/room/messagelineedit.cpp @@ -1,36 +1,38 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "messagelineedit.h" MessageLineEdit::MessageLineEdit(QWidget *parent) : QLineEdit(parent) { setClearButtonEnabled(true); connect(this, &MessageLineEdit::returnPressed, this, [this]() { Q_EMIT sendMessage(text()); clear(); }); } MessageLineEdit::~MessageLineEdit() { } + +//TODO add keyEvent diff --git a/src/widgets/channellist/statuscombobox.cpp b/src/widgets/room/messagelinewidget.cpp similarity index 73% copy from src/widgets/channellist/statuscombobox.cpp copy to src/widgets/room/messagelinewidget.cpp index 993f5c07..bf9559e5 100644 --- a/src/widgets/channellist/statuscombobox.cpp +++ b/src/widgets/room/messagelinewidget.cpp @@ -1,32 +1,36 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "statuscombobox.h" +#include "messagelinewidget.h" +#include -StatusCombobox::StatusCombobox(QWidget *parent) - : QComboBox(parent) +MessageLineWidget::MessageLineWidget(QWidget *parent) + : QWidget(parent) { - + QHBoxLayout *mainLayout = new QHBoxLayout(this); + mainLayout->setObjectName(QStringLiteral("mainLayout")); + mainLayout->setContentsMargins(0, 0, 0, 0); + //TODO } -StatusCombobox::~StatusCombobox() +MessageLineWidget::~MessageLineWidget() { } diff --git a/src/widgets/channellist/statuscombobox.cpp b/src/widgets/room/messagelinewidget.h similarity index 78% copy from src/widgets/channellist/statuscombobox.cpp copy to src/widgets/room/messagelinewidget.h index 993f5c07..9ec695a2 100644 --- a/src/widgets/channellist/statuscombobox.cpp +++ b/src/widgets/room/messagelinewidget.h @@ -1,32 +1,35 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "statuscombobox.h" -StatusCombobox::StatusCombobox(QWidget *parent) - : QComboBox(parent) -{ +#ifndef MESSAGELINEWIDGET_H +#define MESSAGELINEWIDGET_H -} +#include -StatusCombobox::~StatusCombobox() +class MessageLineWidget : public QWidget { + Q_OBJECT +public: + explicit MessageLineWidget(QWidget *parent = nullptr); + ~MessageLineWidget(); +}; -} +#endif // MESSAGELINEWIDGET_H