<commit_before>//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, <NAME>
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "LDesktopSwitcher.h"
#include <LSession.h>

LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal) {
  iconOld = -1;
  this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{padding: 0px;}");
  //Setup the widget
  label = new QToolButton(this);
  label->setPopupMode(QToolButton::DelayedPopup);
  label->setAutoRaise(true);
  label->setToolButtonStyle(Qt::ToolButtonIconOnly);
  label->setIcon( LXDG::findIcon("format-view-carousel", "preferences-desktop-display") );
  label->setToolTip(QString("Workspace 1"));
  connect(label, SIGNAL(clicked()), this, SLOT(openMenu()));
  menu = new QMenu(this);
  connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(menuActionTriggered(QAction*)));
  connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  label->setMenu(menu);
  this->layout()->addWidget(label);

  // Maybe a timer should be set to set the toolTip of the button,
  // becasue the workspace could be switched via Keyboard-shortcuts ...

  QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time
  QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust icon size

  //Process the signal which is sent when the workspace is changed via keyboard-shortcuts
  connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(updateWorkspaceMenu()));
}

LDesktopSwitcher::~LDesktopSwitcher(){
}
/*  MOVED THESE FUNCTIONS TO LIBLUMINA (LuminaX11.h) -- <NAME> 5/9/14
void LDesktopSwitcher::setNumberOfDesktops(int number) {
  Display *display = QX11Info::display();
  Window rootWindow = QX11Info::appRootWindow();

  Atom atom = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False);
  XEvent xevent;
  xevent.type                 = ClientMessage;
  xevent.xclient.type         = ClientMessage; 
  xevent.xclient.display      = display;<commit_msg>Set default tooltip to be translateable in case issues arise<commit_after>//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, <NAME>
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "LDesktopSwitcher.h"
#include <LSession.h>

LDesktopSwitcher::LDesktopSwitcher(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal) {
  iconOld = -1;
  this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{padding: 0px;}");
  //Setup the widget
  label = new QToolButton(this);
  label->setPopupMode(QToolButton::DelayedPopup);
  label->setAutoRaise(true);
  label->setToolButtonStyle(Qt::ToolButtonIconOnly);
  label->setIcon( LXDG::findIcon("format-view-carousel", "preferences-desktop-display") );
  label->setToolTip(QString(tr("Workspace 1")));
  connect(label, SIGNAL(clicked()), this, SLOT(openMenu()));
  menu = new QMenu(this);
  connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(menuActionTriggered(QAction*)));
  connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  label->setMenu(menu);
  this->layout()->addWidget(label);

  // Maybe a timer should be set to set the toolTip of the button,
  // becasue the workspace could be switched via Keyboard-shortcuts ...

  QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time
  QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust icon size

  //Process the signal which is sent when the workspace is changed via keyboard-shortcuts
  connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(updateWorkspaceMenu()));
}

LDesktopSwitcher::~LDesktopSwitcher(){
}
/*  MOVED THESE FUNCTIONS TO LIBLUMINA (LuminaX11.h) -- <NAME> 5/9/14
void LDesktopSwitcher::setNumberOfDesktops(int number) {
  Display *display = QX11Info::display();
  Window rootWindow = QX11Info::appRootWindow();

  Atom atom = XInternAtom(display, "_NET_NUMBER_OF_DESKTOPS", False);
  XEvent xevent;
  xevent.type                 = ClientMessage;
  xevent.xclient.type         = ClientMessage; 
  xevent.xclient.display      = display;
{'fraction_non_alphanumeric': 0.17131203263086336, 'fraction_numerical': 0.00997054158169046, 'mean_word_length': 5.305714285714286, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2500331', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1357, 'n_words': 332}