Esempio n. 1
0
RazorAppSwitcher::AppSwitcher::AppSwitcher()
    : QWidget(0, Qt::FramelessWindowHint | Qt::Tool)
{
    setupUi(this);

    m_settings = new RazorSettings("appswitcher", this);

    installEventFilter(this);

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(close()));
    m_timer->setInterval(10000);

    m_layout = new QHBoxLayout();
    QWidget * background = new QWidget(this);
    scrollArea->setWidget(background);
    background->setLayout(m_layout);

    m_key = new QxtGlobalShortcut(this);
    m_localKey = new QShortcut(QKeySequence::fromString(DEFAULT_SHORTCUT), this, SLOT(selectNextItem()), SLOT(selectNextItem()));

    connect(m_settings, SIGNAL(settigsChanged()), this, SLOT(applySettings()));
    connect(m_key, SIGNAL(activated()), this, SLOT(handleApps()));
    
    applySettings();
}
Esempio n. 2
0
RazorPanelPrivate::RazorPanelPrivate(RazorPanel* parent):
    QObject(parent),
    q_ptr(parent),
    mScreenNum(0)
{
    // Read command line arguments ..............
    // The first argument is config file name.
    mConfigFile = "panel";
    if (qApp->arguments().count() > 1)
    {
        mConfigFile = qApp->arguments().at(1);
        if (mConfigFile.endsWith(".conf"))
            mConfigFile.chop(5);
    }

    mSettings = new RazorSettings("razor-panel/" + mConfigFile, this);

    mLayout = new RazorPanelLayout(QBoxLayout::LeftToRight, parent);
    connect(mLayout, SIGNAL(widgetMoved(QWidget*)), this, SLOT(pluginMoved(QWidget*)));

    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(screensChangeds()));
    connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChangeds()));
    //connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(screensChangeds()));

    XdgIcon::setThemeName(RazorSettings::globalSettings()->value("icon_theme").toString());
    connect(RazorSettings::globalSettings(), SIGNAL(settigsChanged()), q_ptr, SLOT(update()));
}
Esempio n. 3
0
RazorMount::RazorMount(const RazorPanelPluginStartInfo* startInfo, QWidget* parent)
    : RazorPanelPlugin(startInfo, parent)
{
    //qDebug() << "RazorMount init";
    setObjectName("RazorMount");
    m_button = new MountButton(parent, panel());
    addWidget(m_button);
    settigsChanged();
}
Esempio n. 4
0
RazorPanelPluginPrivate::RazorPanelPluginPrivate(const RazorPanelPluginStartInfo* startInfo, RazorPanelPlugin* parent):
    QObject(parent),
    q_ptr(parent),
    mSettings(new RazorSettings(startInfo->settings, startInfo->configSection, this)),
    mConfigId(startInfo->configSection),
    mAlignmentCached(false),
    mMovable(false),
    mPanel(startInfo->panel)
{
    Q_Q(RazorPanelPlugin);

    q->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    connect(mSettings, SIGNAL(settigsChanged()), q, SLOT(settigsChanged()));

    q->setWindowTitle(startInfo->pluginInfo->name());
    QBoxLayout* layout = new QBoxLayout(mPanel->isHorizontal() ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom, q);
    layout->setSpacing(0);
    layout->setMargin(0);
    layout->setContentsMargins(0, 0, 0, 0);
    q->setLayout(layout);

    q->settigsChanged();
}
Esempio n. 5
0
/**
 * @brief constructor
 */
RazorClock::RazorClock(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
        RazorPanelPlugin(startInfo, parent),
        calendarDialog(0)
{
    setObjectName("Clock");
    clockFormat = "hh:mm";
    gui = new ClockLabel(this);
    gui->setAlignment(Qt::AlignCenter);
    addWidget(gui);
    connect(gui, SIGNAL(fontChanged()), this, SLOT(updateMinWidth()));
    settigsChanged();

    clocktimer = new QTimer(this);
    connect (clocktimer, SIGNAL(timeout()), this, SLOT(updateTime()));
    clocktimer->start(1000);
}
Esempio n. 6
0
RazorTaskBar::RazorTaskBar(const RazorPanelPluginStartInfo* startInfo, QWidget* parent) :
    RazorPanelPlugin(startInfo, parent),
    mButtonStyle(Qt::ToolButtonTextBesideIcon),
    mShowOnlyCurrentDesktopTasks(false)
{
    setObjectName("TaskBar");

    QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
    sp.setHorizontalStretch(1);
    sp.setVerticalStretch(1);
    setSizePolicy(sp);
    layout()->addStretch();

    mRootWindow = QX11Info::appRootWindow();

    settigsChanged();
}
Esempio n. 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()));
}
Esempio n. 8
0
RazorMainMenu::RazorMainMenu(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
    RazorPanelPlugin(startInfo, parent),
    mMenu(0)
{
    setObjectName("MainMenu");

    addWidget(&mButton);
    connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu()));
    mPowerManager = new PowerManager(this);
    mPowerManager->setParentWidget(panel());

    mScreenSaver = new ScreenSaver(this);
    
    mShortcut = new QxtGlobalShortcut(this);
    connect(mShortcut, SIGNAL(activated()), this, SLOT(showMenu()));

    settigsChanged();

    QSizePolicy sp = mButton.sizePolicy();
    sp.setVerticalPolicy(QSizePolicy::Minimum);
    mButton.setSizePolicy(sp);

}
Esempio n. 9
0
/**
 * @brief constructor
 */
RazorClock::RazorClock(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
        RazorPanelPlugin(startInfo, parent),
        calendarDialog(0)
{
    setObjectName("Clock");
    clockFormat = "hh:mm";

    gui = new ClockLabel(this);
    gui->setAlignment(Qt::AlignCenter);
    this->layout()->setAlignment(Qt::AlignCenter);
    QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    gui->setSizePolicy(sizePolicy);
    this->setSizePolicy(sizePolicy);
    addWidget(gui);

    connect(gui, SIGNAL(fontChanged()), this, SLOT(updateMinWidth()));
    settigsChanged();

    clocktimer = new QTimer(this);
    connect (clocktimer, SIGNAL(timeout()), this, SLOT(updateTime()));
    clocktimer->start(1000);
}