<commit_before>#include "qcan_interface_widget.hpp"

#include <QDebug>
#include <QPainter>
#include <QPaintEvent>
#include <QPalette>

#include <QMessageBox>
#include <QDir>
#include <QMenu>
#include <QPluginLoader>
#include <QPoint>

#include <QCoreApplication>
/*----------------------------------------------------------------------------*\
** Class methods                                                              **
**                                                                            **
\*----------------------------------------------------------------------------*/

//----------------------------------------------------------------------------//
// QCanInterfaceWidget()                                                      //
// constructor                                                                //
//----------------------------------------------------------------------------//
QCanInterfaceWidget::QCanInterfaceWidget(uint8_t ubIdxV)
 : QWidget()
{
   ubInterfaceIdxP = ubIdxV;
   clIconP = QIcon(QCAN_IF_VCAN_ICON);
   pclQCanInterfaceP = NULL;

   //----------------------------------------------------------------
   // check there are any plugins available
   //
   QDir pluginsDir(qApp->applicationDirPath()+"/plugins");

   clPluginPathP = pluginsDir;
   qDebug() << QString("QCanInterfaceWidget::QCanInterfaceWidget("+QString::number(ubIdxV) +","+ clPluginPathP.absolutePath()+")");

   loadPlugin();
}


//----------------------------------------------------------------------------//
// QCanInterfaceWidget::mousePressEvent()                                     //
// handle mouse press events on window areas                                  //
//----------------------------------------------------------------------------//
void QCanInterfaceWidget::mousePressEvent(QMouseEvent * pclEventV)
{
   QAction * pclActionT;
   QPoint pos(this->mapFromParent(QCursor::pos()));
   QMenu clContextMenuT(tr("CAN interface selection"), this);
   QMenu *clPluginMenuT;
   QCanInterface *pclInterfaceT;
   QString clInterfaceNameT;


   if (!loadPlugin())<commit_msg>Set path for plugins<commit_after>#include "qcan_interface_widget.hpp"

#include <QDebug>
#include <QPainter>
#include <QPaintEvent>
#include <QPalette>

#include <QMessageBox>
#include <QDir>
#include <QMenu>
#include <QPluginLoader>
#include <QPoint>

#include <QCoreApplication>
/*----------------------------------------------------------------------------*\
** Class methods                                                              **
**                                                                            **
\*----------------------------------------------------------------------------*/

//----------------------------------------------------------------------------//
// QCanInterfaceWidget()                                                      //
// constructor                                                                //
//----------------------------------------------------------------------------//
QCanInterfaceWidget::QCanInterfaceWidget(uint8_t ubIdxV)
 : QWidget()
{
   ubInterfaceIdxP = ubIdxV;
   clIconP = QIcon(QCAN_IF_VCAN_ICON);
   pclQCanInterfaceP = NULL;

   //----------------------------------------------------------------
   // check there are any plugins available
   //
   QDir clPluginsDirT(qApp->applicationDirPath());
   #if defined(Q_OS_WIN)
   clPluginsDirT.setPath(pluginsDir.path() + "/plugins");
   #elif defined(Q_OS_MAC)
   if(clPluginsDirT.dirName() == "MacOS")
   {
      clPluginsDirT.cdUp();
      clPluginsDirT.setPath(clPluginsDirT.path() + "/Plugins");
   }
   #endif
   clPluginPathP = clPluginsDirT;
   qDebug() << QString("QCanInterfaceWidget::QCanInterfaceWidget("+QString::number(ubIdxV) +","+ clPluginPathP.absolutePath()+")");

   loadPlugin();
}


//----------------------------------------------------------------------------//
// QCanInterfaceWidget::mousePressEvent()                                     //
// handle mouse press events on window areas                                  //
//----------------------------------------------------------------------------//
void QCanInterfaceWidget::mousePressEvent(QMouseEvent * pclEventV)
{
   QAction * pclActionT;
   QPoint pos(this->mapFromParent(QCursor::pos()));
   QMenu clContextMenuT(tr("CAN interface selection"), this);
   QMenu *clPluginMenuT;
   QCanInterface *pclInterfaceT;
   QString clInterfaceNameT;


   if (!loadPlugin())
{'fraction_non_alphanumeric': 0.32952764719050814, 'fraction_numerical': 0.00044772778150884264, 'mean_word_length': 1.0495412844036698, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4667103', 'n_tokens_mistral': 998, 'n_tokens_neox': 982, 'n_words': 168}