Esempio n. 1
0
ShortcutsModel::ShortcutsModel(const QHash<QString, ActionCollection *> &actionCollections, QObject *parent)
  : QAbstractItemModel(parent),
  _changedCount(0)
{
  _showIcons=!QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
  for(int r = 0; r < actionCollections.values().count(); r++) {
    ActionCollection *coll = actionCollections.values().at(r);
    Item *item = new Item();
    item->row = r;
    item->collection = coll;
    for(int i = 0; i < coll->actions().count(); i++) {
      Action *action = qobject_cast<Action *>(coll->actions().at(i));
      if(!action)
        continue;
      Item *actionItem = new Item();
      actionItem->parentItem = item;
      actionItem->row = i;
      actionItem->collection = coll;
      actionItem->action = action;
      actionItem->shortcut = action->shortcut();
      item->actionItems.append(actionItem);
    }
    _categoryItems.append(item);
  }
}
Esempio n. 2
0
SystemTray::SystemTray(QWidget* parent)
    : QObject(parent)
    , _associatedWidget(parent)
{
    Q_ASSERT(parent);

    NotificationSettings{}.initAndNotify("Systray/ChangeColor", this, &SystemTray::enableChangeColorChanged, true);
    NotificationSettings{}.initAndNotify("Systray/Animate", this, &SystemTray::enableBlinkChanged, false);
    UiStyleSettings{}.initAndNotify("Icons/InvertTray", this, &SystemTray::invertTrayIconChanged, false);

    ActionCollection* coll = QtUi::actionCollection("General");
    _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, &SystemTray::minimizeRestore);

    _trayMenu = new QMenu(associatedWidget());
    _trayMenu->setTitle("Quassel IRC");
    _trayMenu->setAttribute(Qt::WA_Hover);

    _trayMenu->addAction(coll->action("ConnectCore"));
    _trayMenu->addAction(coll->action("DisconnectCore"));
    _trayMenu->addAction(coll->action("CoreInfo"));
    _trayMenu->addSeparator();
    _trayMenu->addAction(_minimizeRestoreAction);
    _trayMenu->addAction(coll->action("Quit"));
    connect(_trayMenu, &QMenu::aboutToShow, this, &SystemTray::trayMenuAboutToShow);

    connect(QtUi::instance(), &QtUi::iconThemeRefreshed, this, &SystemTray::iconsChanged);

    _blinkTimer.setInterval(1000);
    _blinkTimer.setSingleShot(false);
    connect(&_blinkTimer, &QTimer::timeout, this, &SystemTray::onBlinkTimeout);
}
Esempio n. 3
0
void SystemTray::init()
{
    ActionCollection *coll = QtUi::actionCollection("General");
    _minimizeRestoreAction = new Action(tr("&Minimize"), this, this, SLOT(minimizeRestore()));

#ifdef HAVE_KDE
    KMenu *kmenu;
    _trayMenu = kmenu = new KMenu();
    kmenu->addTitle(_activeIcon, "Quassel IRC");
#else
    _trayMenu = new QMenu(associatedWidget());
#endif

    _trayMenu->setTitle("Quassel IRC");

#ifndef HAVE_KDE
    _trayMenu->setAttribute(Qt::WA_Hover);
#endif

    _trayMenu->addAction(coll->action("ConnectCore"));
    _trayMenu->addAction(coll->action("DisconnectCore"));
    _trayMenu->addAction(coll->action("CoreInfo"));
    _trayMenu->addSeparator();
    _trayMenu->addAction(_minimizeRestoreAction);
    _trayMenu->addAction(coll->action("Quit"));

    connect(_trayMenu, SIGNAL(aboutToShow()), SLOT(trayMenuAboutToShow()));

    NotificationSettings notificationSettings;
    notificationSettings.initAndNotify("Systray/Animate", this, SLOT(enableAnimationChanged(QVariant)), true);
}
Esempio n. 4
0
ChatViewSearchBar::ChatViewSearchBar(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);
    ui.hideButton->setIcon(QIcon::fromTheme("dialog-close"));
    ui.searchUpButton->setIcon(QIcon::fromTheme("go-up"));
    ui.searchDownButton->setIcon(QIcon::fromTheme("go-down"));
    _searchDelayTimer.setSingleShot(true);

    layout()->setContentsMargins(0, 0, 0, 0);

    hide();

    ActionCollection *coll = QtUi::actionCollection("General");

    QAction *toggleSearchBar = coll->action("ToggleSearchBar");
    connect(toggleSearchBar, SIGNAL(toggled(bool)), SLOT(setVisible(bool)));

    Action *hideSearchBar = coll->add<Action>("HideSearchBar", toggleSearchBar, SLOT(setChecked(bool)));
    hideSearchBar->setShortcutConfigurable(false);
    hideSearchBar->setShortcut(Qt::Key_Escape);

    connect(ui.hideButton, SIGNAL(clicked()), toggleSearchBar, SLOT(toggle()));
    connect(ui.searchEditLine, SIGNAL(textChanged(const QString &)), this, SLOT(delaySearch()));
    connect(&_searchDelayTimer, SIGNAL(timeout()), this, SLOT(search()));
}
Esempio n. 5
0
void BufferWidget::addActionsToMenu(QMenu *menu, const QPointF &pos) {
  Q_UNUSED(pos);
  ActionCollection *coll = QtUi::actionCollection();
  menu->addSeparator();
  menu->addAction(coll->action("ZoomInChatView"));
  menu->addAction(coll->action("ZoomOutChatView"));
  menu->addAction(coll->action("ZoomOriginalChatView"));
}
Esempio n. 6
0
/**
 * Factory function
 * \author Peter Grasch
 */
ActionCollection* ActionCollection::createActionCollection(Scenario *parent, const QDomElement& actionCollectionElem)
{
  ActionCollection *ac = new ActionCollection(parent);
  if (!ac->deSerialize(actionCollectionElem)) {
    ac->deleteLater();
    ac=0;
  }
  return ac;
}
Esempio n. 7
0
int ManageActionsDialog::exec()
{
  ActionCollection *aC = ScenarioManager::getInstance()->getCurrentScenario()->actionCollection();
  ui.lvPlugins->setModel(aC);

  configurationPages = aC->getConfigurationPages();

  foreach (CommandConfiguration *m, configurationPages) {
    registerCommandConfiguration(m);
  }
Esempio n. 8
0
Action::~Action()
{
    #ifdef QROSS_ACTION_DEBUG
        qrossdebug( QString("Action::~Action() Dtor name='%1'").arg(objectName()) );
    #endif
    finalize();
    ActionCollection *coll = qobject_cast<ActionCollection*>(parent());
    if ( coll ) {
        coll->removeAction(this);
    }
    delete d;
}
Esempio n. 9
0
void MainWin::setupMenus() {
  ActionCollection *coll = QtUi::actionCollection("General");

  _fileMenu = menuBar()->addMenu(tr("&File"));

  static const QStringList coreActions = QStringList()
    << "ConnectCore" << "DisconnectCore" << "CoreInfo";

  QAction *coreAction;
  foreach(QString actionName, coreActions) {
    coreAction = coll->action(actionName);
    _fileMenu->addAction(coreAction);
    flagRemoteCoreOnly(coreAction);
  }
Esempio n. 10
0
ActionCollection *GraphicalUi::actionCollection(const QString &category, const QString &translatedCategory)
{
    if (_actionCollections.contains(category))
        return _actionCollections.value(category);
    ActionCollection *coll = new ActionCollection(_mainWidget);

    if (!translatedCategory.isEmpty())
        coll->setProperty("Category", translatedCategory);
    else
        coll->setProperty("Category", category);

    if (_mainWidget)
        coll->addAssociatedWidget(_mainWidget);
    _actionCollections.insert(category, coll);
    return coll;
}
Esempio n. 11
0
bool TagTransactionManager::undo()
{
    kDebug() << "Undoing " << m_undoList.count() << " changes.\n";

    forget();  // Scrap our old changes (although the list should be empty
               // anyways.

    bool result = processChangeList(true);

    m_undoList.clear();
    action("edit_undo")->setEnabled(false);

    return result;
}
Esempio n. 12
0
ShortcutsModel::ShortcutsModel(const QHash<QString, ActionCollection*>& actionCollections, QObject* parent)
    : QAbstractItemModel(parent)
    , _changedCount(0)
{
    for (int r = 0; r < actionCollections.values().count(); r++) {
        ActionCollection* coll = actionCollections.values().at(r);
        auto* item = new Item();
        item->row = r;
        item->collection = coll;
        for (int i = 0; i < coll->actions().count(); i++) {
            auto* action = qobject_cast<Action*>(coll->actions().at(i));
            if (!action)
                continue;
            auto* actionItem = new Item();
            actionItem->parentItem = item;
            actionItem->row = i;
            actionItem->collection = coll;
            actionItem->action = action;
            actionItem->shortcut = action->shortcut();
            item->actionItems.append(actionItem);
        }
        _categoryItems.append(item);
    }
}
Esempio n. 13
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
{
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    setContextMenu( m_contextMenu );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );

#ifdef Q_WS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  this, SLOT( enablePlay() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    show();
}
Esempio n. 14
0
void MainWin::setupActions() {
  ActionCollection *coll = QtUi::actionCollection("General", tr("General"));
  // File
  coll->addAction("ConnectCore", new Action(SmallIcon("network-connect"), tr("&Connect to Core..."), coll,
                                             this, SLOT(showCoreConnectionDlg())));
  coll->addAction("DisconnectCore", new Action(SmallIcon("network-disconnect"), tr("&Disconnect from Core"), coll,
                                                Client::instance(), SLOT(disconnectFromCore())));
  coll->addAction("CoreInfo", new Action(SmallIcon("help-about"), tr("Core &Info..."), coll,
                                          this, SLOT(showCoreInfoDlg())));
  coll->addAction("ConfigureNetworks", new Action(SmallIcon("configure"), tr("Configure &Networks..."), coll,
                                              this, SLOT(on_actionConfigureNetworks_triggered())));
  // FIXME: use QKeySequence::Quit once we depend on Qt 4.6
  coll->addAction("Quit", new Action(SmallIcon("application-exit"), tr("&Quit"), coll,
                                     this, SLOT(quit()), Qt::CTRL + Qt::Key_Q));

  // View
  coll->addAction("ConfigureBufferViews", new Action(tr("&Configure Chat Lists..."), coll,
                                             this, SLOT(on_actionConfigureViews_triggered())));

  QAction *lockAct = coll->addAction("LockLayout", new Action(tr("&Lock Layout"), coll));
  lockAct->setCheckable(true);
  connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockLayout_toggled(bool)));

  coll->addAction("ToggleSearchBar", new Action(SmallIcon("edit-find"), tr("Show &Search Bar"), coll,
                                                0, 0, QKeySequence::Find))->setCheckable(true);
  coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll,
                                            this, SLOT(showAwayLog())));
  coll->addAction("ToggleMenuBar", new Action(SmallIcon("show-menu"), tr("Show &Menubar"), coll,
                                                0, 0, QKeySequence(Qt::CTRL + Qt::Key_M)))->setCheckable(true);

  coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
                                                0, 0))->setCheckable(true);

  // Settings
  coll->addAction("ConfigureShortcuts", new Action(SmallIcon("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
                                                  this, SLOT(showShortcutsDlg())));
  coll->addAction("ConfigureQuassel", new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
                                                  this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7)));

  // Help
  coll->addAction("AboutQuassel", new Action(SmallIcon("quassel"), tr("&About Quassel"), coll,
                                              this, SLOT(showAboutDlg())));
  coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll,
                                         qApp, SLOT(aboutQt())));
  coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll,
                                       this, SLOT(on_actionDebugNetworkModel_triggered())));
  coll->addAction("DebugBufferViewOverlay", new Action(SmallIcon("tools-report-bug"), tr("Debug &BufferViewOverlay"), coll,
                                       this, SLOT(on_actionDebugBufferViewOverlay_triggered())));
  coll->addAction("DebugMessageModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &MessageModel"), coll,
                                       this, SLOT(on_actionDebugMessageModel_triggered())));
  coll->addAction("DebugHotList", new Action(SmallIcon("tools-report-bug"), tr("Debug &HotList"), coll,
                                       this, SLOT(on_actionDebugHotList_triggered())));
  coll->addAction("DebugLog", new Action(SmallIcon("tools-report-bug"), tr("Debug &Log"), coll,
                                       this, SLOT(on_actionDebugLog_triggered())));
  coll->addAction("ReloadStyle", new Action(SmallIcon("view-refresh"), tr("Reload Stylesheet"), coll,
                                       QtUi::style(), SLOT(reload()), QKeySequence::Refresh));

  // Navigation
  coll = QtUi::actionCollection("Navigation", tr("Navigation"));

  coll->addAction("JumpHotBuffer", new Action(tr("Jump to hot chat"), coll,
                                              this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A)));

  // Jump keys
#ifdef Q_WS_MAC
  const int bindModifier = Qt::ControlModifier | Qt::AltModifier;
  const int jumpModifier = Qt::ControlModifier;
#else
  const int bindModifier = Qt::ControlModifier;
  const int jumpModifier = Qt::AltModifier;
#endif

  coll->addAction("BindJumpKey0", new Action(tr("Set Quick Access #0"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_0)))->setProperty("Index", 0);
  coll->addAction("BindJumpKey1", new Action(tr("Set Quick Access #1"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_1)))->setProperty("Index", 1);
  coll->addAction("BindJumpKey2", new Action(tr("Set Quick Access #2"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_2)))->setProperty("Index", 2);
  coll->addAction("BindJumpKey3", new Action(tr("Set Quick Access #3"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_3)))->setProperty("Index", 3);
  coll->addAction("BindJumpKey4", new Action(tr("Set Quick Access #4"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_4)))->setProperty("Index", 4);
  coll->addAction("BindJumpKey5", new Action(tr("Set Quick Access #5"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_5)))->setProperty("Index", 5);
  coll->addAction("BindJumpKey6", new Action(tr("Set Quick Access #6"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_6)))->setProperty("Index", 6);
  coll->addAction("BindJumpKey7", new Action(tr("Set Quick Access #7"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_7)))->setProperty("Index", 7);
  coll->addAction("BindJumpKey8", new Action(tr("Set Quick Access #8"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_8)))->setProperty("Index", 8);
  coll->addAction("BindJumpKey9", new Action(tr("Set Quick Access #9"), coll, this, SLOT(bindJumpKey()),
                                             QKeySequence(bindModifier + Qt::Key_9)))->setProperty("Index", 9);

  coll->addAction("JumpKey0", new Action(tr("Quick Access #0"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_0)))->setProperty("Index", 0);
  coll->addAction("JumpKey1", new Action(tr("Quick Access #1"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_1)))->setProperty("Index", 1);
  coll->addAction("JumpKey2", new Action(tr("Quick Access #2"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_2)))->setProperty("Index", 2);
  coll->addAction("JumpKey3", new Action(tr("Quick Access #3"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_3)))->setProperty("Index", 3);
  coll->addAction("JumpKey4", new Action(tr("Quick Access #4"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_4)))->setProperty("Index", 4);
  coll->addAction("JumpKey5", new Action(tr("Quick Access #5"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_5)))->setProperty("Index", 5);
  coll->addAction("JumpKey6", new Action(tr("Quick Access #6"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_6)))->setProperty("Index", 6);
  coll->addAction("JumpKey7", new Action(tr("Quick Access #7"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_7)))->setProperty("Index", 7);
  coll->addAction("JumpKey8", new Action(tr("Quick Access #8"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_8)))->setProperty("Index", 8);
  coll->addAction("JumpKey9", new Action(tr("Quick Access #9"), coll, this, SLOT(onJumpKey()),
                                         QKeySequence(jumpModifier + Qt::Key_9)))->setProperty("Index", 9);
}
Esempio n. 15
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
    , m_stopContinueAfterTrackAction( 0 )
    , m_loveTrackAction( 0 )
{
#ifdef Q_OS_MAC
    QIcon icon( RESPATH "icons/tomahawk-grayscale-icon-128x128.png" );
#else
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
#endif

    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    m_contextMenu->setFont( TomahawkUtils::systemFont() );
    setContextMenu( m_contextMenu );

    m_loveTrackAction = new QAction( this );
    m_stopContinueAfterTrackAction = new QAction( this );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( m_loveTrackAction );
    m_contextMenu->addAction( m_stopContinueAfterTrackAction );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    /*
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
    */

#ifdef Q_OS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide %applicationName Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );

    connect( m_contextMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( m_loveTrackAction, SIGNAL( triggered() ), SLOT( loveTrackTriggered() ) );
    connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onStop() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  SLOT( onPause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopAfterTrackChanged() ), SLOT( onStopContinueAfterTrackChanged() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    onStop();
    show();
}
Esempio n. 16
0
void MainWin::setupActions() {
  ActionCollection *coll = QtUi::actionCollection("General");
  // File
  coll->addAction("ConnectCore", new Action(SmallIcon("network-connect"), tr("&Connect to Core..."), coll,
                                             this, SLOT(showCoreConnectionDlg())));
  coll->addAction("DisconnectCore", new Action(SmallIcon("network-disconnect"), tr("&Disconnect from Core"), coll,
                                                Client::instance(), SLOT(disconnectFromCore())));
  coll->addAction("CoreInfo", new Action(SmallIcon("help-about"), tr("Core &Info..."), coll,
                                          this, SLOT(showCoreInfoDlg())));
  coll->addAction("ConfigureNetworks", new Action(SmallIcon("configure"), tr("Configure &Networks..."), coll,
                                              this, SLOT(on_actionConfigureNetworks_triggered())));
  coll->addAction("Quit", new Action(SmallIcon("application-exit"), tr("&Quit"), coll,
                                      this, SLOT(quit()), tr("Ctrl+Q")));

  // View
  coll->addAction("ConfigureBufferViews", new Action(tr("&Configure Chat Lists..."), coll,
                                             this, SLOT(on_actionConfigureViews_triggered())));

  QAction *lockAct = coll->addAction("LockLayout", new Action(tr("&Lock Layout"), coll));
  lockAct->setCheckable(true);
  connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockLayout_toggled(bool)));

  coll->addAction("ToggleSearchBar", new Action(SmallIcon("edit-find"), tr("Show &Search Bar"), coll,
						0, 0, QKeySequence::Find))->setCheckable(true);
  coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll,
					    this, SLOT(showAwayLog())));
  coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
                                                 0, 0))->setCheckable(true);

  // Settings
  coll->addAction("ConfigureQuassel", new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
                                                  this, SLOT(showSettingsDlg()), tr("F7")));

  // Help
  coll->addAction("AboutQuassel", new Action(SmallIcon("quassel"), tr("&About Quassel"), coll,
                                              this, SLOT(showAboutDlg())));
  coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll,
                                         qApp, SLOT(aboutQt())));
  coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll,
                                       this, SLOT(on_actionDebugNetworkModel_triggered())));
  coll->addAction("DebugBufferViewOverlay", new Action(SmallIcon("tools-report-bug"), tr("Debug &BufferViewOverlay"), coll,
                                       this, SLOT(on_actionDebugBufferViewOverlay_triggered())));
  coll->addAction("DebugMessageModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &MessageModel"), coll,
                                       this, SLOT(on_actionDebugMessageModel_triggered())));
  coll->addAction("DebugHotList", new Action(SmallIcon("tools-report-bug"), tr("Debug &HotList"), coll,
                                       this, SLOT(on_actionDebugHotList_triggered())));
  coll->addAction("DebugLog", new Action(SmallIcon("tools-report-bug"), tr("Debug &Log"), coll,
                                       this, SLOT(on_actionDebugLog_triggered())));
  coll->addAction("ReloadStyle", new Action(SmallIcon("view-refresh"), tr("Reload Stylesheet"), coll,
                                       QtUi::style(), SLOT(reload()), QKeySequence::Refresh));

  // Navigation
  coll->addAction("JumpHotBuffer", new Action(tr("Jump to hot chat"), coll,
                                              this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A)));
}
Esempio n. 17
0
TagTransactionAtom::TagTransactionAtom() : m_item(0), m_tag(0)
{
    action("edit_undo")->setEnabled(false);
}
Esempio n. 18
0
bool TagTransactionManager::processChangeList(bool undo)
{
    TagAlterationList::ConstIterator it, end;
    QStringList errorItems;

    it = undo ? m_undoList.constBegin() : m_list.constBegin();
    end = undo ? m_undoList.constEnd() : m_list.constEnd();

    emit signalAboutToModifyTags();

    for(; it != end; ++it) {
        PlaylistItem *item = (*it).item();
        Tag *tag = (*it).tag();

        QFileInfo newFile(tag->fileName());

        if(item->file().fileInfo().fileName() != newFile.fileName()) {
            if(!renameFile(item->file().fileInfo(), newFile)) {
                errorItems.append(item->text(1) + QString(" - ") + item->text(0));
                continue;
            }
        }

        if(tag->save()) {
            if(!undo)
                m_undoList.append(TagTransactionAtom(item, duplicateTag(item->file().tag())));

            item->file().setFile(tag->fileName());
            item->refreshFromDisk();
            item->repaint();
            item->playlist()->dataChanged();
            item->playlist()->update();
        }
        else {
            Tag *errorTag = item->file().tag();
            QString str = errorTag->artist() + " - " + errorTag->title();

            if(errorTag->artist().isEmpty())
                str = errorTag->title();

            errorItems.append(str);
        }

        kapp->processEvents();
    }

    undo ? m_undoList.clear() : m_list.clear();
    if(!undo && !m_undoList.isEmpty())
        action("edit_undo")->setEnabled(true);
    else
        action("edit_undo")->setEnabled(false);

    if(!errorItems.isEmpty())
        KMessageBox::errorList(static_cast<QWidget *>(parent()),
                i18n("The following files were unable to be changed."),
                errorItems,
                i18n("Error"));

    emit signalDoneModifyingTags();
    return errorItems.isEmpty();
}