Beispiel #1
0
    void MainMenu::setVisible (bool visible)
    {
        if (visible)
            updateMenu();

        OEngine::GUI::Layout::setVisible (visible);
    }
Beispiel #2
0
TrayIcon::TrayIcon(Application *parent) : QObject(parent),
	m_icon(new QSystemTrayIcon(this))
{
	QMenu *menu = new QMenu();
	menu->addAction(tr("Show Windows"))->setData(QLatin1String("toggleVisibility"));
	menu->addSeparator();
	menu->addAction(tr("New Tab"))->setData(QLatin1String("newTab"));
	menu->addAction(tr("New Private Tab"))->setData(QLatin1String("newPrivateTab"));
	menu->addSeparator();
	menu->addAction(tr("Bookmarks"))->setData(QLatin1String("bookmarks"));
	menu->addAction(tr("Transfers"))->setData(QLatin1String("transfers"));
	menu->addAction(tr("History"))->setData(QLatin1String("history"));
	menu->addSeparator();
	menu->addAction(tr("Exit"))->setData(QLatin1String("exit"));

	m_icon->setIcon(parent->windowIcon());
	m_icon->setContextMenu(menu);
	m_icon->setToolTip(tr("Otter Browser"));
	m_icon->show();

	setParent(NULL);

	connect(Application::getInstance(), SIGNAL(aboutToQuit()), this, SLOT(hide()));
	connect(this, SIGNAL(destroyed()), menu, SLOT(deleteLater()));
	connect(parent, SIGNAL(destroyed()), this, SLOT(deleteLater()));
	connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggerAction(QAction*)));
	connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
	connect(m_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(activated(QSystemTrayIcon::ActivationReason)));
}
Beispiel #3
0
    void MainMenu::onResChange(int w, int h)
    {
        mWidth = w;
        mHeight = h;

        updateMenu();
    }
RecentFiles::RecentFiles( QMenu * menu, QAction * before, int maxfiles, const QString& settingsname )
{
	if ( maxfiles < 1 )
		qFatal( "RecentFiles::RecentFiles: maxfiles (%d) is < 1 ", maxfiles );

	m_settingsName = settingsname.isEmpty() ? "recentFileList" : settingsname;
	m_actions.resize( maxfiles );

	// Create the actions
	for ( int i = 0; i < maxfiles; ++i )
	{
		m_actions[i] = new QAction( this );
		m_actions[i]->setVisible(false);
		connect( m_actions[i], SIGNAL(triggered()), this, SLOT(actionRecent()) );
	}

	// Add them to the menu
	for ( int i = 0; i < maxfiles; ++i )
		menu->insertAction( before, m_actions[i] );

	// Add a separator after the last action
	m_separator = menu->insertSeparator( before );

	// Update the actions menu
	updateMenu();
}
Beispiel #5
0
MainMenu::MainMenu(int w, int h)
    : OEngine::GUI::Layout("openmw_mainmenu.layout")
    , mButtonBox(0), mWidth (w), mHeight (h)
    , mSaveGameDialog(NULL)
{
    updateMenu();
}
Beispiel #6
0
void QgsRendererV2DataDefinedMenus::sizeScaleFieldSelected( QAction* a )
{
  if ( a == NULL )
    return;

  QString fldName = a->text();
#if 0
  updateMenu( mSizeAttributeActionGroup, fldName );
#endif
  if ( fldName == tr( "- no field -" ) )
  {
    fldName = QString();
  }
  else if ( fldName.startsWith( tr( "- expression -" ) ) )
  {
    QString expr( fldName );
    expr.replace( 0, tr( "- expression -" ).length(), "" );
    QgsExpressionBuilderDialog dialog( mLayer, expr );
    if ( !dialog.exec() ) return;
    fldName = dialog.expressionText();
    Q_ASSERT( !QgsExpression( fldName ).hasParserError() );
    a->setText( tr( "- expression -" ) + fldName );
  }

  emit sizeScaleFieldChanged( fldName );
}
void DolphinRemoteEncoding::slotAboutToShow()
{
    if (!m_loaded) {
        loadSettings();
    }
    updateMenu();
}
int ToolBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QToolBar::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: order(); break;
        case 1: randomize(); break;
        case 2: addSpinBox(); break;
        case 3: removeSpinBox(); break;
        case 4: changeMovable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: allowLeft((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: allowRight((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 7: allowTop((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: allowBottom((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: placeLeft((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 10: placeRight((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: placeTop((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 12: placeBottom((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 13: updateMenu(); break;
        case 14: insertToolBarBreak(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Beispiel #9
0
bool MountTray::addDevice(QString dev, QString label, QString type, QString filesys){
  if(!dev.startsWith(DEVICEDIR)){ dev.prepend(DEVICEDIR); }
  
  //Check if the device is already in the list
  int tot=0;
  for(int i=0; i<deviceList.length(); i++){
    if( deviceList[i]->device == dev ){ return false; } //already exists, do nothing
    if( deviceList[i]->getDeviceName().startsWith(label) ){ tot++; }
  }
  //See if the label is unique as well, otherwise add a number to the end to make it unique
  if(tot > 0 && !label.isEmpty()){ label.append("-"+QString::number(tot)); }
 
  qDebug() << "Valid Device Connection:" << dev << type << label << filesys;
  //Create the menu item (will automount if necessary)
  MenuItem *tmp = new MenuItem(this, DCheck, dev, label, type, filesys);
  //connect the signals/slots
  connect(tmp, SIGNAL(itemMounted(QString)), this, SLOT(openMediaDir(QString)) );
  connect(tmp, SIGNAL(newMessage(QString,QString)), this, SLOT(slotDisplayPopup(QString,QString)) );
  connect(tmp, SIGNAL(itemRemoved(QString)), this, SLOT(removeDevice(QString)) );
  connect(tmp, SIGNAL(itemWorking()), this, SLOT(slotCloseMenu()) );
  connect(tmp, SIGNAL(openAVDisk(QString)), this, SLOT(slotOpenAVDisk(QString)) );
  deviceList << tmp;
  //Update the menu
  updateMenu();
  return true;
}
Beispiel #10
0
void application() {
   scene = G_sceneMenu;      // Primera escena (y la actual)
   nextScene = scene;        // Siguiente escena (siempre empieza siendo igual a la primera)
   interruptId = 0;          // Primera interrupcion

   // Initialize CPC before starting the game
   initializeCPC();

   // Inicializamos la primera escena
   initScene(&scene);

   // Main loop
   while (1) {
      // Scene updates
      switch(scene) {
         case G_sceneMenu:
            nextScene = updateMenu();
         break;
         case G_sceneGame:
            nextScene = updateGame();
         break;
      }

      // Comprobamos si vamos a cambiar de escena
      if(scene != nextScene) {
         // Cambiamos la escena actual y la inicializamos
         scene = nextScene;
         initScene(&scene);
      }
   }
}
void RecentFiles::removeRecentFile( const QString& file )
{
	QStringList files = loadRecentFiles();
	files.removeAll( file );
	saveRecentFiles( files );

	updateMenu();
}
Beispiel #12
0
void ChatWindowMenu::onStanzaSessionTerminated(const IStanzaSession &ASession)
{
	if (ASession.streamJid==streamJid() && ASession.contactJid==contactJid())
	{
		restoreSessionPrefs(contactJid());
		updateMenu();
	}
}
void MulticrewUI::disconnected( std::string error ) {
	d->core->stop();
	d->connection = 0;
	updateMenu();
	d->statusDlg->setUnconnected();	
	if( error.length()==0 )	error = "Session terminated";
	MessageBox( d->hwnd, error.c_str(), "Multicrew", MB_OK | MB_ICONINFORMATION );
}
Beispiel #14
0
void TrayIcon::pauseOrResume()
{
    _isPaused = !_isPaused;

    updateMenu();
    updateToolTip();
    updateTrayIcon();
}
void ProfileAddDialog::createProfile() {
    QString folder = QApplication::applicationDirPath() + "/profiles/" + ui->lineEdit->text();
    if(!ui->lineEdit->text().isEmpty()) {
        if(!QDir(folder).exists())
            QDir().mkdir(folder);
    }
    emit updateMenu();
}
Beispiel #16
0
void loopMainMenu(Inputs input, Map *map, Map *menu) {
	updateMenu(&input, &map);

	if (isOnMenu() != IS_IN_PRINCIPAL_MENU)
		clearWindow();
	else
		drawMenu(menu);
}
void FractalImagesFrame::OnCloseFractal(wxCommandEvent& WXUNUSED(event))
{
	int pos = m_tabs->GetSelection();

	closeTab(pos);

	updateMenu();
}
Beispiel #18
0
void updateDisplay() {
  int elapsed = 0;
  int countdown = 0;
  elapsed = s_currentTimer/2;
  countdown = s_selectedDuration - elapsed;
  
  if(s_currentTimer%2 == 0) {
    static char bUp[10];
    static char bDown[4];
    //static char bDuration[10];
    //static char bDuration[5];
    //static int elapsed = 0;
    //static int countdown = 0;
    
    //elapsed = s_currentTimer/2;
    //countdown = s_selectedDuration - elapsed;
    if(countdown > 0) {
      //printInt(s_countup, elapsed, bUp);
      printInt(s_countdown, countdown, bDown);
      //printInt(s_duration, s_selectedDuration, bDuration);
      
      snprintf(bUp, 10, "%d / %d", elapsed, s_selectedDuration);
      text_layer_set_text(s_countup, bUp);
    } else {
      printInt(s_countup, elapsed - s_selectedDuration, bUp);
      //text_layer_set_text(s_duration, "");
    }
    
     if(countdown == 10) {
      vibes_double_pulse();
    } else if(countdown == 3) {
      vibes_long_pulse();
    } else if(countdown == 2 || countdown == 1) {
      vibes_short_pulse();
    } else if(countdown == 0) {
      window_set_background_color(s_window, GColorWhite);
      vibes_long_pulse();
      s_timerActive = false;
      updateMenu(s_selectedDuration);
      text_layer_set_text(s_countdown, "");
      text_layer_set_text(s_countup, "");
      updateSets();
    }
  }
  
  if(s_timerActive) {
    if(countdown <= 10) {
       window_set_background_color(s_window, GColorRed);
    } else if (s_currentTimer < s_selectedDuration) {
      window_set_background_color(s_window, GColorGreen);
    } else {
      window_set_background_color(s_window, GColorOrange);
      if(s_currentTimer == s_selectedDuration) { // halfway point
        vibes_double_pulse();
      } 
    }
  }
}
Beispiel #19
0
void ProgramTab::setPort(const QString & newPort) {
        DebugDialog::debug(QString("Setting port to %1").arg(newPort));
        m_port = newPort;
        m_portComboBox->setCurrentIndex(m_portComboBox->findText(newPort));
		m_portComboBox->setToolTip(newPort);
        updateMenu();
		QSettings settings;
		settings.setValue("programwindow/port", newPort);
}
Beispiel #20
0
bool MythDialogBox::keyPressEvent(QKeyEvent *event)
{
    if (GetFocusWidget()->keyPressEvent(event))
        return true;

    bool handled = false;
    QStringList actions;
    handled = GetMythMainWindow()->TranslateKeyPress("qt", event, actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "ESCAPE")
        {
            SendEvent(-1, m_exittext, m_exitdata);
            if (m_exitdata == 0 && m_exittext.isEmpty())
                Close();
        }
        else if ((action == "LEFT" &&
             m_buttonList->GetLayout() == MythUIButtonList::LayoutVertical) ||
            (action == "UP" &&
             m_buttonList->GetLayout() == MythUIButtonList::LayoutHorizontal))
        {
            if (m_currentMenu && m_currentMenu->m_parentMenu)
            {
                m_currentMenu = m_currentMenu->m_parentMenu;
                updateMenu();
                return true;
            }

            SendEvent(-1, m_backtext, m_backdata);
            Close();
        }
        else if (action == "MENU")
        {
            SendEvent(-2);
            Close();
        }
        else if ((action == "RIGHT" &&
                  m_buttonList->GetLayout() == MythUIButtonList::LayoutVertical) ||
                 (action == "DOWN" &&
                  m_buttonList->GetLayout() == MythUIButtonList::LayoutHorizontal))
        {
            Select(m_buttonList->GetItemCurrent());
        }
        else
            handled = false;
    }

    if (!handled && MythScreenType::keyPressEvent(event))
        handled = true;

    return handled;
}
Beispiel #21
0
void MRU::initialise()
{
	// Construct the MRU commands and menu structure
	constructMenu();

	// Initialise the most recently used files list
	loadRecentFiles();

	updateMenu();
}
Beispiel #22
0
void FileHistoryHandler::restoreState()
{
  filePaths = atools::settings::Settings::instance().valueStrList(settings);

  // Convert all loaded paths to native
  for(int i = 0; i < filePaths.size(); i++)
    filePaths[i] = QDir::toNativeSeparators(filePaths.at(i));

  updateMenu();
}
Beispiel #23
0
TVList::TVList(bool check_channels_conf, Services services, QString filename, QWidget * parent) 
	: Favorites(filename,parent)
{
#ifndef Q_OS_WIN
	if (check_channels_conf) {
		/* f_list.clear(); */
		parse_channels_conf(services);
		updateMenu();
	}
#endif
}
Beispiel #24
0
    void MainMenu::setVisible (bool visible)
    {
        if (visible)
            updateMenu();
        else
            showBackground(
                        MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
                        MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame);

        OEngine::GUI::Layout::setVisible (visible);
    }
Beispiel #25
0
void Menu::show(sf::Vector2f pos)
{
	updateMenu();
	setVisible(true);

	if (isVerticalFlipped())
		setPosition(pos.x, pos.y - getSize().y);
	else
		setPosition(pos);

	acquireFocus();
}
Beispiel #26
0
void RecentFilesAction::addFile(const QString &fileName)
{
	if (m_recentFilesList.contains(fileName))
		m_recentFilesList.move(m_recentFilesList.indexOf(fileName), 0);
	else
	{
		if (m_recentFilesList.count() >= m_numOfRecentFiles)
			m_recentFilesList.removeLast();
		m_recentFilesList.prepend(fileName);
	}
	updateMenu();
}
Beispiel #27
0
void MainState::play () {
    if(_state == PLAYING && _messages.empty()) {
        log().warning("Turn");
        if(_fight->game_over()) {
            _state = GAME_OVER;
        } else if(_fight->tick_fight()) {
            _state = BOSS_TURN;
            updateMenu();
            openMenu(_mainMenu.get());
        }
        updateHealthBars();
    }
}
void LastRecentFileList::remove(int index) 
{
	if (_size == 0 || _locked)
		return;
	if (index > -1 && index < (int)_lrfl.size())
	{
		::RemoveMenu(_hMenu, _lrfl.at(index)._id, MF_BYCOMMAND);
		setAvailable(_lrfl.at(index)._id);
		_lrfl.erase(_lrfl.begin() + index);
		--_size;
		updateMenu();
	}
};
Beispiel #29
0
void MountTray::removeDevice(QString dev){
  if(!dev.startsWith(DEVICEDIR)){ dev.prepend(DEVICEDIR); }
  
  //Find the device in the list
  int index = findDeviceInList(dev);
  if( index == -1 ){ return; } //does not exist, do nothing
  //Remove the menu entry from the list
  deviceList[index]->cleanup(); //make sure it is unmounted with mountpoint removed
  deviceList.removeAt(index);
  //Update the menu
  updateMenu();
  qDebug() << "Valid Device Removal:" <<  dev;
}
VstEffectControls::VstEffectControls( VstEffect * _eff ) :
	EffectControls( _eff ),
	m_effect( _eff ),
	m_subWindow( NULL ),
	knobFModel( NULL ),
	vstKnobs( NULL ),
	ctrHandle( NULL ),
	lastPosInMenu (0)
//	m_presetLabel ( NULL )
{
	menu = new QMenu;
	connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) );
}