LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){ PLUGID=id; prefix = id.replace("/","_")+"/"; //qDebug() << "ID:" << PLUGID << prefix; settings = LSession::handle()->DesktopPluginSettings(); //Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...) this->setObjectName(id.section("---",0,0).section("::",0,0)); connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) ); }
LClock::LClock(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ button = new QToolButton(this); //RotateToolButton(this); button->setAutoRaise(true); button->setToolButtonStyle(Qt::ToolButtonTextOnly); button->setStyleSheet("font-weight: bold;"); button->setPopupMode(QToolButton::DelayedPopup); //make sure it runs the update routine first button->setMenu(new QMenu()); //button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); //this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); connect(button, SIGNAL(clicked()), this, SLOT(openMenu())); connect(button->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); calendar = new QCalendarWidget(this); calAct = new QWidgetAction(this); calAct->setDefaultWidget(calendar); TZMenu = new QMenu(this); connect(TZMenu, SIGNAL(triggered(QAction*)), this, SLOT(ChangeTZ(QAction*)) ); //Now assemble the menu button->menu()->addAction(calAct); button->menu()->addMenu(TZMenu); this->layout()->setContentsMargins(0,0,0,0); //reserve some space on left/right this->layout()->addWidget(button); //Setup the timer timer = new QTimer(); //Load all the initial settings updateFormats(); LocaleChange(); ThemeChange(); OrientationChange(); //Now connect/start the timer connect(timer,SIGNAL(timeout()), this, SLOT(updateTime()) ); connect(QApplication::instance(), SIGNAL(SessionConfigChanged()), this, SLOT(updateFormats()) ); timer->start(); }
void LPanel::UpdateLocale(){ //The panel itself has no text to translate, just forward the signal to all the plugins for(int i=0; i<PLUGINS.length(); i++){ QTimer::singleShot(1,PLUGINS[i], SLOT(LocaleChange())); } }