예제 #1
0
LXQtTaskButton::LXQtTaskButton(const WId window, LXQtTaskBar * taskbar, QWidget *parent) :
    QToolButton(parent),
    mWindow(window),
    mUrgencyHint(false),
    mOrigin(Qt::TopLeftCorner),
    mDrawPixmap(false),
    mParentTaskBar(taskbar),
    mPlugin(mParentTaskBar->plugin()),
    mDNDTimer(new QTimer(this))
{
    Q_ASSERT(taskbar);

    setCheckable(true);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setMinimumWidth(1);
    setMinimumHeight(1);
    setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    setAcceptDrops(true);

    updateText();
    updateIcon();

    mDNDTimer->setSingleShot(true);
    mDNDTimer->setInterval(700);
    connect(mDNDTimer, SIGNAL(timeout()), this, SLOT(activateWithDraggable()));
    connect(LXQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(updateIcon()));
    connect(mParentTaskBar, &LXQtTaskBar::iconByClassChanged, this, &LXQtTaskButton::updateIcon);
}
예제 #2
0
TrayIcon::TrayIcon(Battery* battery, QObject *parent) :
    QSystemTrayIcon(parent),
    mBattery(battery),
    mSettings("razor-autosuspend")
{
    setUpstatusIcons();

    connect(battery, SIGNAL(batteryChanged()), this, SLOT(update()));
    connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(iconThemeChanged()));
    connect(&mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(showStatus(QSystemTrayIcon::ActivationReason)));

    checkThemeStatusIcons();
    update();
    setVisible(mSettings.value(SHOWTRAYICON_KEY, true).toBool());
}
예제 #3
0
파일: dialog.cpp 프로젝트: B-Rich/razor-qt
Dialog::Dialog(QWidget *parent) :
    QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint),
    ui(new Ui::Dialog),
    mSettings(new RazorSettings("razor-runner", this)),
    mGlobalShortcut(new QxtGlobalShortcut(this))
{
    ui->setupUi(this);
    setWindowTitle("Razor Runner");

    connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update()));

    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide()));

    connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings()));

    ui->commandEd->installEventFilter(this);

    connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
    connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand()));


    mCommandItemModel = new CommandItemModel(this);
    ui->commandList->installEventFilter(this);
    ui->commandList->setModel(mCommandItemModel);
    ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand()));
    setFilter("");

    ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList));
    connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide()));

    // Popup menu ...............................
    QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this);
    connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
    addAction(a);
    
    a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear razor-runner History"), this);
    connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory()));
    addAction(a);

    mPowerManager = new PowerManager(this);
    addActions(mPowerManager->availableActions());
    mScreenSaver = new ScreenSaver(this);
    addActions(mScreenSaver->availableActions());

    setContextMenuPolicy(Qt::ActionsContextMenu);
    
    QMenu *menu = new QMenu(this);
    menu->addActions(actions());
    ui->actionButton->setMenu(menu);
    ui->actionButton->setIcon(XdgIcon::fromTheme("configure"));
    // End of popup menu ........................

    applySettings();
    resize(mSettings->value("dialog/width", 400).toInt(), size().height());
}
예제 #4
0
IconProducer::IconProducer()
{
    mBuilt_in_wireless_signal_none      = buildIcon(":/resources/signal-strength-0.svg");
    mBuilt_in_wireless_signal_weak      = buildIcon(":/resources/signal-strength-1.svg");
    mBuilt_in_wireless_signal_ok        = buildIcon(":/resources/signal-strength-2.svg");
    mBuilt_in_wireless_signal_good      = buildIcon(":/resources/signal-strength-3.svg");
    mBuilt_in_wireless_signal_excellent = buildIcon(":/resources/signal-strength-4.svg");

    connect(LXQt::GlobalSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(onIconThemeChanged()));
    onIconThemeChanged();
}
예제 #5
0
IconProducer::IconProducer()
{
    mBuiltInDisconnected = buildIcon(":/resources/wired-disconnected.svg");
    mBuiltInWiredConnected = buildIcon(":/resources/wired-connected.svg");
    mBuiltInWirelessNone = buildIcon(":/resources/signal-strength-0.svg");
    mBuiltInWirelessWeak = buildIcon(":/resources/signal-strength-1.svg");
    mBuiltInWirelessOk = buildIcon(":/resources/signal-strength-2.svg");
    mBuiltInWirelessGood = buildIcon(":/resources/signal-strength-3.svg");
    mBuiltInWirelessExcellent = buildIcon(":/resources/signal-strength-4.svg");

    connect(LXQt::GlobalSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(onIconThemeChanged()));
    onIconThemeChanged();
}
예제 #6
0
StatusActions::StatusActions(StatusContainer *statusContainer, QObject *parent, bool commonStatusIcons) :
		QObject(parent), MyStatusContainer(statusContainer), CommonStatusIcons(commonStatusIcons)
{
	ChangeStatusActionGroup = new QActionGroup(this);
	ChangeStatusActionGroup->setExclusive(true); // HACK
	connect(ChangeStatusActionGroup, SIGNAL(triggered(QAction*)), this, SIGNAL(statusActionTriggered(QAction*)));

	createActions();

	statusChanged();
	connect(MyStatusContainer, SIGNAL(statusChanged()), this, SLOT(statusChanged()));

	connect(IconsManager::instance(), SIGNAL(themeChanged()), this, SLOT(iconThemeChanged()));
}
예제 #7
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint),
    ui(new Ui::Dialog),
    mSettings(new RazorSettings("razor-runner", this)),
    mGlobalShortcut(new QxtGlobalShortcut(this)),
    mCommandItemModel(new CommandItemModel(this))
{
    ui->setupUi(this);
    setStyleSheet(razorTheme->qss("razor-runner/razor-runner"));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide()));

    connect(mSettings, SIGNAL(settigsChanged()), this, SLOT(applySettings()));


    ui->commandEd->installEventFilter(this);
    ui->commandEd->setInsertPolicy(QComboBox::NoInsert);
    ui->commandEd->setCompleter(0);

    connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
    connect(ui->commandEd->lineEdit(), SIGNAL(returnPressed()), this, SLOT(runCommand()));


    ui->commandList->installEventFilter(this);
    ui->commandList->setModel(mCommandItemModel);
    ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand()));
    setFilter("");

    ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList));
    connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide()));

    // Popup menu ...............................
    QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure razor-runner"), this);
    connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
    addAction(a);

    setContextMenuPolicy(Qt::ActionsContextMenu);
    // End of popup menu ........................

    applySettings();
    resize(mSettings->value("dialog/width", 400).toInt(), size().height());

    XdgIcon::setThemeName(RazorSettings::globalSettings()->value("icon_theme").toString());
    connect(RazorSettings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update()));
}
BatteryWatcher::BatteryWatcher(QObject *parent) :
    Watcher(parent),
    mBatteryInfo(),
    mBattery(),
    mTrayIcon(0),
    mSettings()
{
    qDebug() << "Starting BatteryWatcher";
    if (!mBattery.haveBattery())
    {
        LxQt::Notification::notify(tr("No battery!"),
                                  tr("LXQt could not find data about any battery - monitoring disabled"),
                                  "lxqt-powermanagement");
    }



    connect(&mBattery, SIGNAL(batteryChanged()), this, SLOT(batteryChanged()));
    connect(&mSettings, SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
    connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(settingsChanged()));
    settingsChanged();
    batteryChanged();
}
예제 #9
0
Dialog::Dialog(QWidget *parent) :
    QDialog(parent, Qt::Tool | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint),
    ui(new Ui::Dialog),
    mSettings(new LxQt::Settings("lxqt-runner", this)),
    mGlobalShortcut(0),
    mLockCascadeChanges(false),
    mConfigureDialog(0)
{
    ui->setupUi(this);
    setWindowTitle("LXQt Runner");
    setAttribute(Qt::WA_TranslucentBackground);

    connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide()));
    connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings()));

    ui->commandEd->installEventFilter(this);

    connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
    connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand()));

    mCommandItemModel = new CommandItemModel(this);
    ui->commandList->installEventFilter(this);
    ui->commandList->setModel(mCommandItemModel);
    ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers);
    connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand()));
    setFilter("");
    dataChanged();

    ui->commandList->setItemDelegate(new LxQt::HtmlDelegate(QSize(32, 32), ui->commandList));

    // Popup menu ...............................
    QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure"), this);
    connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
    addAction(a);

    a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear History"), this);
    connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory()));
    addAction(a);

    mPowerManager = new LxQt::PowerManager(this);
    addActions(mPowerManager->availableActions());
    mScreenSaver = new LxQt::ScreenSaver(this);
    addActions(mScreenSaver->availableActions());

    setContextMenuPolicy(Qt::ActionsContextMenu);

    QMenu *menu = new QMenu(this);
    menu->addActions(actions());
    ui->actionButton->setMenu(menu);
    ui->actionButton->setIcon(XdgIcon::fromTheme("configure"));
    // End of popup menu ........................

    applySettings();

    connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(realign()));
    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(realign()));
    connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide()));
    connect(mGlobalShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString)));

    resize(mSettings->value("dialog/width", 400).toInt(), size().height());


    // TEST
    connect(mCommandItemModel, SIGNAL(layoutChanged()), this, SLOT(dataChanged()));
}