Exemple #1
0
void ZoneClockPanel::addClock(const TQString &zone, const TQString &name)
{
  // add the clocks
  ZoneClock *zc = new ZoneClock(zone, name, this);
  _flow->add(zc);
  _clocks.append(zc);
  zc->show();

  realign();

  connect(zc, TQT_SIGNAL(addClock(const TQString &)), this, TQT_SLOT(addClock(const TQString &)));
  connect(zc, TQT_SIGNAL(changed()), this, TQT_SLOT(realign()));
  connect(zc, TQT_SIGNAL(removeMe(ZoneClock *)), this, TQT_SLOT(removeClock(ZoneClock *)));
}
Exemple #2
0
void VolumePopup::open(QPoint pos, Qt::Corner anchor)
{
    m_pos = pos;
    m_anchor = anchor;
    realign();
    show();
}
Exemple #3
0
void RazorPanelPrivate::screensChangeds()
{
    if (! canPlacedOn(mScreenNum, mPosition))
        mScreenNum = findAvailableScreen(mPosition);

    realign();
}
void ParallelGapRealigner::threadRealignGaps(boost::unique_lock<boost::mutex> &lock, BinData &binData, BinData::iterator &nextUnprocessed, unsigned long threadNumber)
{
//    ISAAC_THREAD_CERR << "threadRealignGaps this " << this  << std::endl;

    isaac::build::GapRealigner &realigner = threadGapRealigners_.at(threadNumber);
    isaac::alignment::Cigar &cigars = threadCigars_.at(threadNumber);
    static const std::size_t READS_AT_A_TIME = 1024;

//    int blockCount = 0;
    while (binData.indexEnd() != nextUnprocessed)
    {
        BinData::iterator ourBegin = nextUnprocessed;
        const std::size_t readsToProcess = std::min<std::size_t>(READS_AT_A_TIME, std::distance(ourBegin, binData.indexEnd()));
        nextUnprocessed += readsToProcess;
        {
            common::unlock_guard<boost::unique_lock<boost::mutex> > unlock(lock);
            for (const BinData::iterator ourEnd = ourBegin + readsToProcess; ourEnd != ourBegin; ++ourBegin)
            {
                PackedFragmentBuffer::Index &index = *ourBegin;
                io::FragmentAccessor &fragment = binData.data_.getFragment(index);
                if (binData.bin_.hasPosition(fragment.fStrandPosition_))
                {
                    cigars.clear();
                    realign(realigner, fragment, index, binData, cigars);
                }
            }
        }
//        ++blockCount;
    }

//    ISAAC_THREAD_CERR << "Thread " << threadNumber << " realigned " << blockCount << " blocks for " << binData.bin_ << std::endl;
}
void Popup::open(QPoint pos, Qt::Corner anchor)
{
    mPos = pos;
    mAnchor = anchor;
    realign();
    show();
}
Exemple #6
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()));

    connect(RazorSettings::globalSettings(), SIGNAL(settingsChanged()), q_ptr, SLOT(update()));
    connect(razorApp, SIGNAL(themeChanged()), this, SLOT(realign()));
}
Exemple #7
0
RazorPanel::RazorPanel(const QString &configFile, QWidget *parent) :
    QFrame(parent),
    mLineSize(22),
    mLineCount(1)
{
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
    setAttribute(Qt::WA_X11NetWmWindowTypeDock);
    setAttribute(Qt::WA_AlwaysShowToolTips);
    setWindowTitle("Razor Panel");
    setObjectName(QString("RazorPanel %1").arg(configFile));

    mLayout = new RazorPanelLayout(this);
    connect(mLayout, SIGNAL(pluginMoved()), this, SLOT(pluginMoved()));
    setLayout(mLayout);
    mLayout->setLineCount(mLineCount);

    mDelaySave.setSingleShot(true);
    mDelaySave.setInterval(SETTINGS_SAVE_DELAY);
    connect(&mDelaySave, SIGNAL(timeout()), this, SLOT(saveSettings()));

    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(screensChangeds()));
    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(realign()));
    connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChangeds()));
    connect(RazorSettings::globalSettings(), SIGNAL(settingsChanged()), this, SLOT(update()));
    connect(razorApp, SIGNAL(themeChanged()), this, SLOT(realign()));

    mSettings = new RazorSettings("razor-panel/" + configFile, this);
    readSettings();
    loadPlugins();
    
    show();
}
void GUIGenericCanvas::realignIfNecessary() {
  // the behavior of changedAlignment() guarantees that if this canvas
  // doesn't need to be aligned, none of its parent canvases do, either
  if (aligned_) return;
  if (source_canvas_) source_canvas_->realignIfNecessary();
  realign();
  aligned_ = true;
}
Exemple #9
0
/* Calculate one sequence's contribution to the alignment score */
double marginal_score(glam2_scorer *s, glam2_aln *aln,
		      int seq, const fasta *f) {
  double score = aln->score;
  unalign(aln, seq, f);
  score -= aln_score(s, aln);
  realign(aln, seq, f);
  return score;
}
LXQtQuickLaunch::LXQtQuickLaunch(ILXQtPanelPlugin *plugin, QWidget* parent) :
    QFrame(parent),
    mPlugin(plugin),
    mPlaceHolder(0)
{
    setAcceptDrops(true);

    mLayout = new LXQt::GridLayout(this);
    setLayout(mLayout);

    QString desktop;
    QString file;
    QString execname;
    QString exec;
    QString icon;
    for (const QMap<QString, QVariant> &app : mPlugin->settings()->readArray("apps"))
    {
        desktop = app.value("desktop", "").toString();
        file = app.value("file", "").toString();
        if (!desktop.isEmpty())
        {
            XdgDesktopFile xdg;
            if (!xdg.load(desktop))
            {
                qDebug() << "XdgDesktopFile" << desktop << "is not valid";
                continue;
            }
            if (!xdg.isSuitable())
            {
                qDebug() << "XdgDesktopFile" << desktop << "is not applicable";
                continue;
            }

            addButton(new QuickLaunchAction(&xdg, this));
        }
        else if (! file.isEmpty())
        {
            addButton(new QuickLaunchAction(file, this));
        }
        else
        {
            execname = app.value("name", "").toString();
            exec = app.value("exec", "").toString();
            icon = app.value("icon", "").toString();
            if (icon.isNull())
            {
                qDebug() << "Icon" << icon << "is not valid (isNull). Skipped.";
                continue;
            }
            addButton(new QuickLaunchAction(execname, exec, icon, this));
        }
    } // for

    if (mLayout->isEmpty())
        showPlaceHolder();

    realign();
}
Exemple #11
0
void Popup::showEvent(QShowEvent *event)
{
    mPlaceholder->setVisible(mDisplayCount == 0);
    realign();
    setFocus();
    activateWindow();
    QWidget::showEvent(event);
    emit visibilityChanged(true);
}
Exemple #12
0
void coBackground::resizeToParent(float x, float y, float z, bool shrink)
{
    //  fprintf(stderr,"coBackground::resizeToParent(%f,%f,%f,%s)\n",
    //                 x,y,z,((shrink)?"true":"false"));

    // only shrink when required
    // (quite stupid here because it is not used for own resizing,
    //  but maybe children need it...)
    if (shrink)
    {
        shrinkToMin();
    }

    myWidth = coMax(x, minWidth);
    myHeight = coMax(y, minHeight);
    myDepth = coMax(z, minDepth);

    for (list<coUIElement *>::iterator i = elements.begin(); i != elements.end(); ++i)
    {
        (*i)->resizeToParent(x, y, z);
    }

    float mw = 0;
    float mh = 0;
    float md = 0;

    for (list<coUIElement *>::iterator i = elements.begin(); i != elements.end(); ++i)
    {
        if ((*i)->getWidth() > mw)
        {
            mw = (*i)->getWidth();
        }
        if ((*i)->getHeight() > mh)
        {
            mh = (*i)->getHeight();
        }
        if ((*i)->getDepth() > md)
        {
            md = (*i)->getDepth();
        }
    }

    myWidth = coMax(mw, x);
    myHeight = coMax(mh, y);
    myDepth = coMax(md, z);
    myWidth = coMax(myWidth, minWidth);
    myHeight = coMax(myHeight, minHeight);
    myDepth = coMax(myDepth, minDepth);
    resizeGeometry();
    realign();

    // fprintf(stderr,"W/H/D = %8f,%8f,%8f\n",myWidth,myHeight,myDepth);
}
Exemple #13
0
void Dialog::showHide()
{
    if (isVisible() &&  isActiveWindow())
        hide();
    else
    {
        realign();
        show();
        QApplication::setActiveWindow(this);
        activateWindow();
    }
}
Exemple #14
0
void Dialog::showHide() {
    if (isVisible() && isActiveWindow()) {
        hide();
    } else {
        realign();
        show();
        // I do not know why but next 2 lines don't work
        // in KWIN. So we use the native X11.
        //QApplication::setActiveWindow(this);
        //activateWindow();
        LxQt::xfitMan().raiseWindow(this->effectiveWinId());
    }
}
void RazorMainMenu::settingsChanged()
{
    if (mLockCascadeChanges)
        return;

    if (settings()->value("showText", false).toBool())
    {
        mButton.setText(settings()->value("text", "Start").toString());
        mButton.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    }
    else
    {
        mButton.setText("");
        mButton.setToolButtonStyle(Qt::ToolButtonIconOnly);
    }

    mLogDir = settings()->value("log_dir", "").toString();

    QString mMenuFile = settings()->value("menu_file", "").toString();
    if (mMenuFile.isEmpty())
        mMenuFile = XdgMenu::getMenuFileName();

    mXdgMenu.setEnvironments(QStringList() << "X-RAZOR" << "Razor");
    mXdgMenu.setLogDir(mLogDir);

    bool res = mXdgMenu.read(mMenuFile);
    connect(&mXdgMenu, SIGNAL(changed()), this, SLOT(buildMenu()));
    if (res)
    {
        QTimer::singleShot(1000, this, SLOT(buildMenu()));
    }
    else
    {
        QMessageBox::warning(0, "Parse error", mXdgMenu.errorString());
        return;
    }


    QString shortcut = settings()->value("shortcut", DEFAULT_SHORTCUT).toString();
    if (shortcut.isEmpty())
        shortcut = DEFAULT_SHORTCUT;

    if (!mShortcut)
        mShortcut = GlobalKeyShortcut::Client::instance()->addAction(shortcut, QString("/panel/%1/show_hide").arg(settings()->group()), tr("Show/hide main menu"), this);
    else if (mShortcut->shortcut() != shortcut)
    {
        mShortcut->changeShortcut(shortcut);
    }

    realign();
}
Exemple #16
0
void Dialog::showHide()
{
    if (isVisible() && isActiveWindow())
    {
        hide();
    }
    else
    {
        realign();
        show();
        KWindowSystem::forceActiveWindow(windowHandle()->winId());
        ui->commandEd->setFocus();
    }
}
Exemple #17
0
void Popup::addItem(Solid::Device device)
{
    MenuDiskItem *item = new MenuDiskItem(device, this);
    connect(item, &MenuDiskItem::invalid, this, &Popup::onDeviceRemoved);
    item->setVisible(true);
    layout()->addWidget(item);

    mDisplayCount++;
    if (mDisplayCount != 0)
        mPlaceholder->hide();

    if (isVisible())
        realign();
}
void DesktopSwitch::settingsChanged()
{
    int value = settings()->value("rows", 1).toInt();
    if (mRows != value)
    {
        mRows = value;
        realign();
    }
    value = settings()->value("labelType", DesktopSwitchButton::LABEL_TYPE_NUMBER).toInt();
    if (mLabelType != static_cast<DesktopSwitchButton::LabelType>(value))
    {
        mLabelType = static_cast<DesktopSwitchButton::LabelType>(value);
        refresh();
    }
}
RazorTaskBar::RazorTaskBar(IRazorPanelPlugin *plugin, QWidget *parent) :
    QFrame(parent),
    mButtonStyle(Qt::ToolButtonTextBesideIcon),
    mShowOnlyCurrentDesktopTasks(false),
    mPlugin(plugin)
{
    mLayout = new RazorGridLayout(this);
    setLayout(mLayout);
    mLayout->setMargin(0);
    realign();

    mRootWindow = QX11Info::appRootWindow();

    settingsChanged();
}
void LXQtQuickLaunch::buttonDeleted()
{
    QuickLaunchButton *btn = qobject_cast<QuickLaunchButton*>(sender());
    if (!btn)
        return;

    mLayout->removeWidget(btn);
    btn->deleteLater();
    saveSettings();

    if (mLayout->isEmpty())
        showPlaceHolder();

    realign();
}
Exemple #21
0
void LxQtClock::settingsChanged()
{
    mTimeFormat = settings()->value("timeFormat", QLocale::system().timeFormat(QLocale::ShortFormat).toUpper().contains("AP") ? "h:mm AP" : "HH:mm").toString();

    mUseUTC = settings()->value("UTC", false).toBool();
    if (mUseUTC)
        mTimeFormat += "' Z'";

    mDateFormat = settings()->value("dateFormat", Qt::SystemLocaleShortDate).toString();

    bool dateBeforeTime = (settings()->value("showDate", "no").toString().toLower() == "before");
    bool dateAfterTime = (settings()->value("showDate", "no").toString().toLower() == "after");
    mDateOnNewLine = (settings()->value("showDate", "no").toString().toLower() == "below");

    bool autoRotate = settings()->value("autoRotate", true).toBool();
    if (autoRotate != mAutoRotate)
    {
        mAutoRotate = autoRotate;
        realign();
    }


    if (dateBeforeTime)
        mClockFormat = QString("%1 %2").arg(mDateFormat).arg(mTimeFormat);
    else if (dateAfterTime)
        mClockFormat = QString("%1 %2").arg(mTimeFormat).arg(mDateFormat);
    else
        mClockFormat = mTimeFormat;

    mDateLabel->setVisible(mDateOnNewLine);

    updateMinWidth();

    // mDateFormat usually does not contain time portion, but since it's possible to use custom date format - it has to be supported. [Kuzma Shapran]
    int updateInterval = QString(mTimeFormat + " " + mDateFormat).replace(QRegExp("'[^']*'"),"").contains("s") ? 1000 : 60000;

    QDateTime now = currentDateTime();

    showTime(now);

    if (mClockTimer->interval() != updateInterval)
    {
        mClockTimer->setInterval(updateInterval);

        restartTimer(now);
    }
}
Exemple #22
0
void stagnation_recovery(double distance_sensors_value[8], int DIST_THRESHOLD)
{
	if (align_counter < 2) // Align
	{
		printf("Realigning\n");
		align_counter = align_counter + 1;
		realign(distance_sensors_value);
	}

	else if(align_counter > 0)// Reposition
	{
		printf("Finding new spot\n");
		LED_blink();
		find_new_spot(distance_sensors_value, DIST_THRESHOLD);
	}

}
Exemple #23
0
RazorTray::RazorTray(IRazorPanelPlugin *plugin, QWidget *parent):
    QFrame(parent),
    mValid(false),
    mTrayId(0),
    mDamageEvent(0),
    mDamageError(0),
    mIconSize(TRAY_ICON_SIZE_DEFAULT, TRAY_ICON_SIZE_DEFAULT),
    mPlugin(plugin)
{
    mLayout = new RazorGridLayout(this);
    realign();

    // Init the selection later just to ensure that no signals are sent until
    // after construction is done and the creating object has a chance to connect.
    QTimer::singleShot(0, this, SLOT(startTray()));

}
Exemple #24
0
LXQtTray::LXQtTray(ILXQtPanelPlugin *plugin, QWidget *parent):
    QFrame(parent),
    mValid(false),
    mTrayId(0),
    mDamageEvent(0),
    mDamageError(0),
    mIconSize(TRAY_ICON_SIZE_DEFAULT, TRAY_ICON_SIZE_DEFAULT),
    mPlugin(plugin),
    mDisplay(QX11Info::display())
{
    mLayout = new LXQt::GridLayout(this);
    realign();
    _NET_SYSTEM_TRAY_OPCODE = XfitMan::atom("_NET_SYSTEM_TRAY_OPCODE");
    // Init the selection later just to ensure that no signals are sent until
    // after construction is done and the creating object has a chance to connect.
    QTimer::singleShot(0, this, SLOT(startTray()));
}
void LXQtQuickLaunch::addButton(QuickLaunchAction* action)
{
    mLayout->setEnabled(false);
    QuickLaunchButton* btn = new QuickLaunchButton(action, mPlugin, this);
    mLayout->addWidget(btn);

    connect(btn, SIGNAL(switchButtons(QuickLaunchButton*,QuickLaunchButton*)), this, SLOT(switchButtons(QuickLaunchButton*,QuickLaunchButton*)));
    connect(btn, SIGNAL(buttonDeleted()), this, SLOT(buttonDeleted()));
    connect(btn, SIGNAL(movedLeft()), this, SLOT(buttonMoveLeft()));
    connect(btn, SIGNAL(movedRight()), this, SLOT(buttonMoveRight()));

    mLayout->removeWidget(mPlaceHolder);
    delete mPlaceHolder;
    mPlaceHolder = 0;
    mLayout->setEnabled(true);
    realign();
}
Exemple #26
0
RazorTray::RazorTray(QWidget* parent):
  QFrame(parent),
  mValid(false),
  mTrayId(0),
  mDamageEvent(0),
  mDamageError(0),
  mIconSize(TRAY_ICON_SIZE_DEFAULT, TRAY_ICON_SIZE_DEFAULT) {

  // mLayout = new RazorGridLayout(this);
  mLayout = new QBoxLayout(QBoxLayout::LeftToRight, this);
  mLayout->setMargin(0); // make the margin 0 to make more room for tray icons
  setLayout(mLayout);
  realign();

  // Init the selection later just to ensure that no signals are sent until
  // after construction is done and the creating object has a chance to connect.
  QTimer::singleShot(0, this, SLOT(startTray()));

}
Exemple #27
0
void Dialog::applySettings()
{
    // Shortcut .................................
    QKeySequence shortcut = QKeySequence::fromString(mSettings->value("dialog/shortcut", "Alt+F2").toString());
    if (shortcut.isEmpty())
        shortcut = QKeySequence::fromString("Alt+F2");

    if (mGlobalShortcut->shortcut() != shortcut)
    {
        mGlobalShortcut->setShortcut(shortcut);
        std::cout << tr("Press \"%1\" to see dialog.").arg(shortcut.toString()).toLocal8Bit().constData() << std::endl;
    }

    mShowOnTop = mSettings->value("dialog/show_on_top", true).toBool();

    mMonitor = mSettings->value("dialog/monitor", 0).toInt();

    realign();
    mSettings->sync();
}
Exemple #28
0
int stagnation_recovery(double distance_sensors_value[8], int DIST_THRESHOLD)
{
	int stagnation = get_stagnation_state();

	if(stagnation){
	if (align_counter < 2) // Align
	{
		align_counter = align_counter + 1;
		realign(distance_sensors_value);
	}

	else if(align_counter > 0)// Reposition
	{
		LED_blink();
		find_new_spot(distance_sensors_value, DIST_THRESHOLD);
	}
	}

	return stagnation;
	
}
void RazorTaskBar::refreshTaskList()
{
    XfitMan xf = xfitMan();
    QList<Window> tmp = xf.getClientList();

    //qDebug() << "** Fill ********************************";
    //foreach (Window wnd, tmp)
    //    if (xf->acceptWindow(wnd)) qDebug() << XfitMan::debugWindow(wnd);
    //qDebug() << "****************************************";


    QMutableHashIterator<Window, RazorTaskButton*> i(mButtonsHash);
    while (i.hasNext())
    {
        i.next();
        int n = tmp.removeAll(i.key());

        if (!n)
        {
            delete i.value();
            i.remove();
        }
    }

    foreach (Window wnd, tmp)
    {
        if (xf.acceptWindow(wnd))
        {
            RazorTaskButton* btn = new RazorTaskButton(wnd, this);
            btn->setToolButtonStyle(mButtonStyle);

            mButtonsHash.insert(wnd, btn);
            mLayout->addWidget(btn);
        }
    }
    refreshButtonVisibility();
    mLayout->invalidate();
    activeWindowChanged();
    realign();
}
RazorMainMenu::RazorMainMenu(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
    RazorPanelPlugin(startInfo, parent),
    mMenu(0)
{
    setObjectName("MainMenu");

    layout()->setAlignment(Qt::AlignCenter);
    mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    mButton.setObjectName("Button");

    connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu()));
    connect(panel(), SIGNAL(panelRealigned()), this, SLOT(realign()));

    mPowerManager = new PowerManager(this);
    mScreenSaver = new ScreenSaver(this);

    mShortcut = new QxtGlobalShortcut(this);
    connect(mShortcut, SIGNAL(activated()), this, SLOT(showHideMenu()));

    addWidget(&mButton);
    settingsChanged();
}