Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugins/aspeller/aspeller.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import "../UreenPlugin.qbs" as UreenPlugin

UreenPlugin {
pluginTags: 'linux'
Depends { name: "aspell" }
cpp.dynamicLibraries: ["aspell"]
condition: qbs.targetOS.contains("linux")

//Depends { name: "aspell" }
// condition: aspell.found // Doesn't work for now
}
2 changes: 1 addition & 1 deletion plugins/aspeller/src/aspellchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void ASpellChecker::loadSettings(const QString &lang)

AspellCanHaveError * possible_err = new_aspell_speller(m_config);
if (aspell_error_number(possible_err) != 0) {
warning()<< "Error : "<< aspell_error_message(possible_err);
qWarning() << "Error : " << aspell_error_message(possible_err);
} else {
m_speller = to_aspell_speller(possible_err);
}
Expand Down
5 changes: 4 additions & 1 deletion plugins/aspeller/src/aspellplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ using namespace qutim_sdk_0_3;

class ASpellPlugin : public Plugin
{
Q_OBJECT
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qutim.Plugin")
Q_CLASSINFO("DebugName", "ASpell")
Q_CLASSINFO("Uses", "ChatLayer")
public:
explicit ASpellPlugin();
virtual void init();
Expand Down
5 changes: 4 additions & 1 deletion plugins/blogimprover/src/blogimproverhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ void BlogImproverHandler::loadSettings()

MessageHandlerAsyncResult BlogImproverHandler::doHandle(Message &message)
{
if (message.isIncoming())
qutim_sdk_0_3::MessageHandler::traceHandlers();


if (!message.isIncoming())
return makeAsyncResult(Accept, QString());

ChatSession *session = ChatLayer::get(message.chatUnit(), false);
Expand Down
3 changes: 2 additions & 1 deletion plugins/hunspeller/hunspeller.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import "../UreenPlugin.qbs" as UreenPlugin

UreenPlugin {
pluginTags: 'linux'
Depends { name: "hunspell" }
cpp.dynamicLibraries: ["hunspell"]
condition: qbs.targetOS.contains("linux")
}
2 changes: 1 addition & 1 deletion plugins/hunspeller/src/hunspellchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void HunSpellChecker::storeReplacement(const QString &bad, const QString &good)
{
Q_UNUSED(bad);
Q_UNUSED(good);
debug() << "HunSpellChecker::storeReplacement not implemented";
qDebug() << "HunSpellChecker::storeReplacement not implemented";
}

QStringList HunSpellChecker::languages() const
Expand Down
5 changes: 4 additions & 1 deletion plugins/hunspeller/src/hunspellplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ using namespace qutim_sdk_0_3;

class HunSpellPlugin : public Plugin
{
Q_OBJECT
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qutim.Plugin")
Q_CLASSINFO("DebugName", "HunSpell")
Q_CLASSINFO("Uses", "ChatLayer")
public:
explicit HunSpellPlugin();
virtual void init();
Expand Down
5 changes: 5 additions & 0 deletions plugins/metamenu/metamenu.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "../UreenPlugin.qbs" as UreenPlugin

UreenPlugin {
condition: qbs.getenv("XDG_CURRENT_DESKTOP") === "Unity"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What? So you think that it should be not possible to build this plugin at the build farm where there is no x11 oe Unity?

}
120 changes: 120 additions & 0 deletions plugins/metamenu/src/metamenu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/****************************************************************************
**
** qutIM - instant messenger
**
** Copyright © 2014 Nicolay Izoderov <[email protected]>
** Copyright © 2014 Ivan Vizir <[email protected]>
**
*****************************************************************************
**
** $QUTIM_BEGIN_LICENSE$
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see http://www.gnu.org/licenses/.
** $QUTIM_END_LICENSE$
**
****************************************************************************/

#include "metamenu.h"
#include <qutim/debug.h>
#include <qutim/chatsession.h>
#include <QMenuBar>
#include <QMainWindow>
#include <QTimer>

MetamenuPlugin::MetamenuPlugin ()
{
}

void MetamenuPlugin::init ()
{
qutim_sdk_0_3::ExtensionIcon icon("info");
addAuthor(QLatin1String("nicoizo"));
setInfo(QT_TRANSLATE_NOOP("Plugin", "MetaMenu"),
QT_TRANSLATE_NOOP("Plugin", "Ubuntu metamenu integration"),
PLUGIN_VERSION(0, 0, 1, 1),
icon
);
setCapabilities(Loadable);
}

bool MetamenuPlugin::load ()
{
QTimer::singleShot(2000, this, SLOT(shot()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this timer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this timer i'll get null pointer of QMenuBar, because QMainWindow needs some time to be created

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it's better to make "chatWidgets" a Qt's property to be able to listen signals about it's changes? So you will be able to create a QMenuBar per each widget separatly with common MenuController

m_menu = new MetaMenuController(this);
return true;
}

bool MetamenuPlugin::unload ()
{
return true;
}

/*!
* \brief MetamenuPlugin::oneOfChatWindows
* \author viv
* \return QMainWindow
*/
QWidget* MetamenuPlugin::oneOfChatWindows()
{
QObject* obj = ServiceManager::getByName("ChatForm");
QWidget *widget = 0;
bool metZero = false;
QWidgetList list;
QMetaObject::invokeMethod(obj, "chatWidgets", Q_RETURN_ARG(QWidgetList, list));
if(!list.size())
return 0;
foreach (QWidget *w, list)
if (w) {
widget = w->window();
break;
} else
metZero = true;
if (metZero) // TODO: this block should dissapear sometimes as well as variables used here
qWarning() << "Zeros still appear in ChatForm's chatWidgets list.";
return widget;
}

void MetamenuPlugin::shot() {
QWidget* window = oneOfChatWindows();

if(!m_menuBar && window)
QMetaObject::invokeMethod(window, "getMenuBar", Q_RETURN_ARG(QMenuBar*, m_menuBar));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not obvious that you set result value to m_menuBar, may you introduce a temporary variable here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that this change will add contact list's menu bar to chat window at every system, not only for Unity or other systems with global menu? May be you should to add an configuration for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, in .qbs file I limit plugin to Unity only.
Okay, I will introduce temporary variable.


QMenu* mainMenu = m_menu->menu(false);

mainMenu->setTitle("&qutIM");

if(m_menuBar && !m_added) {
qDebug() << mainMenu;
m_menuBar->addMenu(mainMenu);
m_added = true;
}

if(!m_added)
QTimer::singleShot(1000, this, SLOT(shot()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to run this method infinitive times?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as there is no mainwindow

else
connect(window, SIGNAL(destroyed()), this, SLOT(onDestroyed()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there is no window?

}

void MetamenuPlugin::onDestroyed()
{
m_added = false;
m_menuBar = 0;
delete m_menu;
m_menu = new MetaMenuController(this);
QTimer::singleShot(1000, this, SLOT(shot()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have single QTimer instead of a lot of singleShots, at least it will be possible to stop it in case of plugin's unload

}



QUTIM_EXPORT_PLUGIN(MetamenuPlugin)
70 changes: 70 additions & 0 deletions plugins/metamenu/src/metamenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/****************************************************************************
**
** qutIM - instant messenger
**
** Copyright © 2014 Nicolay Izoderov <[email protected]>
**
*****************************************************************************
**
** $QUTIM_BEGIN_LICENSE$
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see http://www.gnu.org/licenses/.
** $QUTIM_END_LICENSE$
**
****************************************************************************/

#ifndef METAMENU_METAMENU_H
#define METAMENU_METAMENU_H

#include <qutim/plugin.h>
#include <qutim/servicemanager.h>
#include <qutim/menucontroller.h>
#include <qutim/chatsession.h>
#include <QMenuBar>

using namespace qutim_sdk_0_3;

class MetaMenuController : public MenuController
{
Q_OBJECT
public:
MetaMenuController(QObject *parent) : MenuController(parent)
{
if (MenuController *contactList = ServiceManager::getByName<MenuController *>("ContactList"))
setMenuOwner(contactList);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I will change ContactList's implemenation plugin? You should add binding to update menu owner.

}
};

class MetamenuPlugin : public qutim_sdk_0_3::Plugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qutim.Plugin")
Q_CLASSINFO("DebugName", "Metamenu")
Q_CLASSINFO("Uses", "ChatLayer")
public:
explicit MetamenuPlugin ();
virtual void init();
virtual bool load();
virtual bool unload();
public slots:
void shot();
void onDestroyed();
private:
QWidget* oneOfChatWindows();
QMenuBar* m_menuBar = 0;
MenuController* m_menu;
bool m_added = false;
};

#endif /* end of include guard: METAMENU_METAMENU_H */

5 changes: 4 additions & 1 deletion plugins/plugins.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ Project {
"quickcontactlist/quickcontactlist.qbs",
"indicator/indicator.qbs",
"winintegration/winintegration.qbs",
"metamenu/metamenu.qbs",
"aspeller/aspeller.qbs",
"hunspeller/hunspeller.qbs",
"keychain/keychain.qbs",
"quickchat/quickchat.qbs",
"quickchat/quickchat.qbs"
]
}
82 changes: 82 additions & 0 deletions plugins/quickchat/qml/chatstyle/gajim/ActionMessage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import QtQuick 2.3
import org.qutim 0.4
import org.qutim.quickchat 0.4
import "../default" as Default


MessageBase {
id: root
height: messageItem.height

readonly property var message: messages[0]

Default.SelectableText {
id: messageItem
anchors {
top: parent.top
left: parent.left
margins: 4
}
renderType: Text.NativeRendering
textFormat: Text.RichText
wrapMode: Text.WrapAtWordBoundaryOrAnywhere



readonly property string timeText: Qt.formatDateTime(message.time, '[hh:mm:ss]')
readonly property string timeColor: {
var incoming = message.incoming;
var success = messageReceipts[message.id];
var history = message.property("history", false);
var color = undefined;
if (history)
color = "gray";
else if (incoming || success === true)
color = "black";
else if (success === false)
color = "red";
else
color = "orange";
return color;
}

readonly property string timeHtml: "<span style=\"color:" + timeColor + ";\">" + timeText + "</span>";


property variant nickColorsArray: ["#4e9a06", "#f57900", "#ce5c00", "#3465a4", "#204a87", "#75507b", "#5c3566", "#c17d11", "#8f5902", "#ef2929", "#cc0000", "#a40000"]
readonly property string incomingNickColor: {
return nickColorsArray[root.session.hashOf(nick, nickColorsArray.length)];
}
readonly property string nick: message.unitData.title
readonly property url appendNickUrl: session.appendNickUrl(nick) + "#do-not-style"
readonly property string nickHtml: {
return "<b><a href=\"" + appendNickUrl + "\"" +
" style=\"text-decoration: none; color:" + nickColor + "; font-weight:" + fontWeight + ";\">" +
session.htmlEscape(nick) + "</a></b>";
}

readonly property string fontWeight: {
return message.property("mention", false) ? "bold" : "normal";
}

readonly property string nickColor: message.incoming ? incomingNickColor : "#437ee0"

readonly property string messageFormattedHtml: "<span style=\"color:" + messageColor + "; font-weight: " + fontWeight + ";\" >" + message.formattedHtml().substr(4) + "</span>";
readonly property string messageColor: {
return nickColor
}

text: timeHtml + " " + nickHtml + " " + messageFormattedHtml

property AnchorsHighlighter highlighter: AnchorsHighlighter {
Component.onCompleted: {
// TextEdit.textDocument is non-notifyable property
textDocument = messageItem.textDocument;
hoverColor = "#07A";
activeColor = "#09C";
}
}
}


}
Loading