Example #1
0
void BattleInfo::battle(Battle const & battle)
{
    battleId_ = battle.id();

    setMapImage(battle);
    setHeaderText(battle);
}
Example #2
0
void BattleInfo::userLeftBattle(User const & user, const Battle & battle)
{
    if (battle.id() == battleId_)
    {
        setHeaderText(battle);
    }
}
Example #3
0
void
SimilarArtistsApplet::dataUpdated( const QString &source, const Plasma::DataEngine::Data &data )
{
    DEBUG_BLOCK
    QString artist = data[ "artist" ].toString();
    if( source == "similarArtists" )
    {
        setBusy( false );
        if( !artist.isEmpty() )
        {
            m_artist = artist;
            SimilarArtist::List list = data[ "similar" ].value<SimilarArtist::List>();
            if( m_similars != list )
            {
                m_similars = list;
                updateNavigationIcons();
                artistsUpdate();
            }
        }
        else
        {
            setHeaderText( i18n( "Similar Artists" ) );
            m_scroll->clear();
            m_scroll->hide();
            setCollapseOn();
        }
    }
}
Example #4
0
void BtFontSettingsPage::retranslateUi() {
    setHeaderText(tr("Fonts"));
    m_languageLabel->setText(tr("&Language:"));
    m_languageComboBox->setToolTip(tr("The font selection below will apply to all texts in this language"));
    m_languageCheckBox->setText(tr("Use custom font"));
    m_fontsGroupBox->setTitle(tr("Optionally specify a custom font for each language:"));
}
void BtLanguageSettingsPage::retranslateUi() {
    setHeaderText(tr("Languages"));

    m_languageNamesLabel->setText(tr("Language for names of Bible books:"));
    const QString toolTip(tr("The languages which can be used for the biblical book names. Translations are provided by the Sword library."));
    m_languageNamesLabel->setToolTip(toolTip);
    m_swordLocaleCombo->setToolTip(toolTip);
}
Example #6
0
void
PhotosApplet::photoAdded()
{
    setBusy( false );
    setHeaderText( i18ncp( "@title:window Number of photos of artist",
                           "1 Photo: %2",
                           "%1 Photos: %2",
                           m_widget->count(),
                           m_currentArtist ) );
}
Example #7
0
void
PhotosApplet::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    // Create label
    enableHeader( true );
    setHeaderText( i18n( "Photos" ) );

    // Set the collapse size
    setCollapseHeight( m_header->height() );
    setCollapseOffHeight( 220 );
    setMaximumHeight( 220 );
    setMinimumHeight( collapseHeight() );
    setPreferredHeight( collapseHeight() );

    // Icon
    QAction* settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setVisible( true );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    m_settingsIcon = addRightHeaderAction( settingsAction );
    connect( m_settingsIcon, SIGNAL( clicked() ), this, SLOT( showConfigurationInterface() ) );

    m_widget = new PhotosScrollWidget( this );
    m_widget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    m_widget->setContentsMargins( 0, 0, 0, 0 );
    connect( m_widget, SIGNAL(photoAdded()), SLOT(photoAdded()) );

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical, this );
    layout->addItem( m_header );
    layout->addItem( m_widget );

    // Read config and inform the engine.
    KConfigGroup config = Amarok::config("Photos Applet");
    m_nbPhotos = config.readEntry( "NbPhotos", "10" ).toInt();
    m_Animation = config.readEntry( "Animation", "Fading" );
    m_KeyWords = config.readEntry( "KeyWords", QStringList() );

    if( m_Animation == i18nc( "animation type", "Automatic" ) )
        m_widget->setMode( 0 );
    else if( m_Animation == i18n( "Interactive" ) )
        m_widget->setMode( 1 );
    else // fading
        m_widget->setMode( 2 );

    Plasma::DataEngine *engine = dataEngine( "amarok-photos" );
    engine->setProperty( "fetchSize", m_nbPhotos );
    engine->setProperty( "keywords", m_KeyWords );
    engine->connectSource( "photos", this );
}
MultiModelControlWidgetWrapper::MultiModelControlWidgetWrapper(QWidget *parent)
    :ControlWidgetWrapper(new MultiModelControlWidget(), parent), mControlWidgetCopy(NULL)
{
    mControlWidgetCopy = dynamic_cast<MultiModelControlWidget*>(mControlWidget);
    assert(mControlWidgetCopy != NULL);

    setHeaderText(tr("Graphs properties"));

    connect(mControlWidgetCopy, SIGNAL(widgetIsHiding()),
            this, SLOT(treatHidingOfInternalWidget()));
}
Example #9
0
void BattleInfo::battleChanged(const Battle & battle)
{
    if (battle.id() == battleId_)
    {
        if (currentMapImage_ != battle.mapName())
        {
            setMapImage(battle);
        }
        setHeaderText(battle);
    }
}
Example #10
0
/**
 * \brief Initialization
 *
 * Initializes the TabsApplet with default parameters
 */
void
TabsApplet::init()
{
    // applet base initialization
    Context::Applet::init();

    // create the header label
    enableHeader( true );
    setHeaderText( i18nc( "Guitar tablature", "Tabs" ) );

    // creates the tab view
    m_tabsView = new TabsView( this );

    // Set the collapse size
    setCollapseOffHeight( -1 );
    setCollapseHeight( m_header->height() );
    setMinimumHeight( collapseHeight() );
    setPreferredHeight( collapseHeight() );

    // create the reload icon
    QAction* reloadAction = new QAction( this );
    reloadAction->setIcon( KIcon( "view-refresh" ) );
    reloadAction->setVisible( true );
    reloadAction->setEnabled( true );
    reloadAction->setText( i18nc( "Guitar tablature", "Reload tabs" ) );
    m_reloadIcon = addLeftHeaderAction( reloadAction );
    m_reloadIcon.data()->setEnabled( false );
    connect( m_reloadIcon.data(), SIGNAL(clicked()), this, SLOT(reloadTabs()) );

    // create the settings icon
    QAction* settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    QWeakPointer<Plasma::IconWidget> settingsIcon = addRightHeaderAction( settingsAction );
    connect( settingsIcon.data(), SIGNAL(clicked()), this, SLOT(showConfigurationInterface()) );

    m_layout = new QGraphicsLinearLayout( Qt::Vertical );
    m_layout->addItem( m_header );
    m_layout->addItem( m_tabsView );
    setLayout( m_layout );

    // read configuration data and update the engine.
    KConfigGroup config = Amarok::config("Tabs Applet");
    m_fetchGuitar = config.readEntry( "FetchGuitar", true );
    m_fetchBass = config.readEntry( "FetchBass", true );

    Plasma::DataEngine *engine = dataEngine( "amarok-tabs" );
    engine->setProperty( "fetchGuitarTabs", m_fetchGuitar );
    engine->setProperty( "fetchBassTabs", m_fetchBass );
    engine->connectSource( "tabs", this );

    updateInterface( InitState );
}
HorizontalLevelControlWidgetWrapper::HorizontalLevelControlWidgetWrapper(QWidget *parent)
    :ControlWidgetWrapper(new HorizontalLevelControlWidget(), parent), mControlWidgetCopy(NULL)
{
    mControlWidgetCopy = dynamic_cast<HorizontalLevelControlWidget*>(mControlWidget);
    assert(mControlWidgetCopy != NULL);

    setHeaderText(tr("Horiz. level properties"));

    connect(mControlWidgetCopy, SIGNAL(widgetIsHiding()),
            this, SLOT(treatHidingOfInternalWidget()));
}
Example #12
0
void
PhotosApplet::stopped()
{
    DEBUG_BLOCK
    setHeaderText( i18n( "Photos: No Track Playing" ) );
    m_widget->clear();
    m_widget->hide();
    setBusy( false );
    setMinimumHeight( m_header->height() );
    setCollapseHeight( m_header->height() );
    setCollapseOn();
    updateConstraints();
}
void MultiModelControlWidgetWrapper::setModelVector(QVector<GraphModel *> newModelVector)
{
    if (newModelVector.size() == 1) {
        if (newModelVector[0]->graphType() == GraphModel::GraphType::Function)
            setHeaderText(tr("Graph properties"));
        else
            setHeaderText(tr("Curve properties"));
    } else {
        bool areAllModelsCurves = true;
        for (auto model : newModelVector) {
            if (model->graphType() == GraphModel::GraphType::Function) {
                areAllModelsCurves = false;
                break;
            }
        }
        if (areAllModelsCurves)
            setHeaderText(tr("Curves properties"));
        else
            setHeaderText(tr("Graphs properties"));
    }
    mControlWidgetCopy->setModelVector(newModelVector);
}
EventControlWidgetWrapper::EventControlWidgetWrapper(QWidget *parent)
    :ControlWidgetWrapper(new EventControlWidget(), parent), mControlWidgetCopy(NULL)
{
    mControlWidgetCopy = dynamic_cast<EventControlWidget*>(mControlWidget);
    assert(mControlWidgetCopy != NULL);

    setHeaderText(tr("Event properties"));

    connect(mControlWidgetCopy, SIGNAL(widgetIsHiding()),
            this, SLOT(treatHidingOfInternalWidget()));
    connect(mControlWidgetCopy, SIGNAL(arrowedTextCreationRequest(double)),
            this, SIGNAL(arrowedTextCreationRequest(double)));

}
Example #15
0
void Albums::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    enableHeader( true );
    setHeaderText( i18n( "Recently Added Albums" ) );

    setCollapseOffHeight( -1 );
    setCollapseHeight( m_header->height() );
    setMinimumHeight( collapseHeight() );

    QAction *settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setEnabled( true );
    settingsAction->setToolTip( i18n( "Settings" ) );
    addRightHeaderAction( settingsAction );
    connect( settingsAction, SIGNAL(triggered()), this, SLOT(showConfigurationInterface()) );

    QAction *filterAction = new QAction( this );
    filterAction->setIcon( KIcon( "view-filter" ) );
    filterAction->setEnabled( true );
    filterAction->setToolTip( i18n( "Filter Albums" ) );
    m_filterIcon = addLeftHeaderAction( filterAction );
    connect( filterAction, SIGNAL(triggered()), this, SLOT(showFilterBar()) );

    m_albumsView = new AlbumsView( this );
    m_albumsView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    if( m_rightAlignLength )
        m_albumsView->setLengthAlignment( Qt::AlignRight );

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical );
    layout->addItem( m_header );
    layout->addItem( m_albumsView );
    setLayout( layout );

    dataEngine( "amarok-current" )->connectSource( "albums", this );
    connect( CollectionManager::instance(), SIGNAL(collectionDataChanged(Collections::Collection*)),
             this, SLOT(collectionDataChanged(Collections::Collection*)) );

    updateConstraints();
}
Example #16
0
void pListView::constructor() {
  lostFocus = false;
  hwnd = CreateWindowEx(
    WS_EX_CLIENTEDGE, WC_LISTVIEW, L"",
    WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | LVS_NOCOLUMNHEADER,
    0, 0, 0, 0, parentWindow->p.hwnd, (HMENU)id, GetModuleHandle(0), 0
  );
  SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&listView);
  setDefaultFont();
  setHeaderText(listView.state.headerText);
  setHeaderVisible(listView.state.headerVisible);
  setCheckable(listView.state.checkable);
  for(auto &text : listView.state.text) append(text);
  for(unsigned n = 0; n < listView.state.checked.size(); n++) setChecked(n, listView.state.checked[n]);
  setImageList();
  if(listView.state.selected) setSelection(listView.state.selection);
  autoSizeColumns();
  synchronize();
}
void CAcceleratorSettingsPage::retranslateUi() {
    setHeaderText(tr("Shortcuts"));

    m_actionGroupLabel->setText(tr("Choose action group:"));

    m_application.title = tr("Main Window");
    m_general.title = tr("All text windows");
    m_bible.title = tr("Bible windows");
    m_commentary.title = tr("Commentary windows");
    m_lexicon.title = tr("Lexicon windows");
    m_book.title = tr("Book windows");

    m_typeChooser->clear();
    m_typeChooser->addItem(m_application.title);
    m_typeChooser->addItem(m_general.title);
    m_typeChooser->addItem(m_bible.title);
    m_typeChooser->addItem(m_commentary.title);
    m_typeChooser->addItem(m_lexicon.title);
    m_typeChooser->addItem(m_book.title);
}
Example #18
0
void pListView::constructor() {
  qtWidget = qtListView = new QTreeWidget;
  qtListView->setAllColumnsShowFocus(true);
  qtListView->setRootIsDecorated(false);

  connect(qtListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
  connect(qtListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(onChange(QTreeWidgetItem*)));
  connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onToggle(QTreeWidgetItem*)));

  pWidget::synchronizeState();
  setCheckable(listView.state.checkable);
  setHeaderText(listView.state.headerText.size() ? listView.state.headerText : lstring{ " " });
  setHeaderVisible(listView.state.headerVisible);
  for(auto& row : listView.state.text) append(row);
  if(listView.state.checkable) {
    for(unsigned n = 0; n < listView.state.checked.size(); n++) {
      setChecked(n, listView.state.checked[n]);
    }
  }
  setSelected(listView.state.selected);
  if(listView.state.selected) setSelection(listView.state.selection);
  autoSizeColumns();
}
Example #19
0
void
LabelsApplet::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    setBackgroundHints( Plasma::Applet::NoBackground );

    // properly set the size, asking for the whole cv size.
    resize( 500, -1 );

    // this applet has to be on top of the applet below, otherwise the completion list of the combobox will shine through the other applet
    setZValue( zValue() + 100 );

    // Create the title label
    enableHeader( true );
    setHeaderText( i18n( "Labels" ) );

    setCollapseHeight( m_header->height() );
    setMinimumHeight( collapseHeight() );

    // reload icon
    QAction *reloadAction = new QAction( this );
    reloadAction->setIcon( KIcon( "view-refresh" ) );
    reloadAction->setVisible( true );
    reloadAction->setEnabled( true );
    reloadAction->setText( i18n( "Reload" ) );
    m_reloadIcon = addLeftHeaderAction( reloadAction );
    m_reloadIcon.data()->setEnabled( false );
    connect( m_reloadIcon.data(), SIGNAL( clicked() ), this, SLOT( reload() ) );

    // settings icon
    QAction *settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setVisible( true );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    m_settingsIcon = addRightHeaderAction( settingsAction );
    connect( m_settingsIcon.data(), SIGNAL( clicked() ), this, SLOT( showConfigurationInterface() ) );

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical, this );
    layout->addItem( m_header );

    m_addLabelProxy = new QGraphicsProxyWidget( this );
    m_addLabelProxy.data()->setAttribute( Qt::WA_NoSystemBackground );
    m_addLabel = new KComboBox( this );
    m_addLabel.data()->setAttribute( Qt::WA_NoSystemBackground );
    m_addLabel.data()->setAutoFillBackground( false );
    QPalette p = m_addLabel.data()->palette();
    QColor c = p.color( QPalette::Base );
    c.setAlphaF( 0.4 );
    p.setColor( QPalette::Base, c );
    m_addLabel.data()->setPalette( p );
    m_addLabel.data()->completionObject()->setIgnoreCase( true );
    m_addLabel.data()->setCompletionMode( KGlobalSettings::CompletionPopup );
    connect( m_addLabel.data(), SIGNAL( returnPressed() ), this, SLOT( addLabelPressed() ) );
    m_addLabelProxy.data()->setWidget( m_addLabel.data() );

    // Read config
    KConfigGroup config = Amarok::config("Labels Applet");
    m_minCount = config.readEntry( "MinCount", 30 );
    m_numLabels = config.readEntry( "NumLabels", 10 );
    m_personalCount = config.readEntry( "PersonalCount", 70 );
    m_autoAdd = config.readEntry( "AutoAdd", false );
    m_minAutoAddCount = config.readEntry( "MinAutoAddCount", 60 );
    m_selectedColor = config.readEntry( "SelectedColor", PaletteHandler::highlightColor( 2.0, 0.7 ) );
    const QPalette pal;
    m_backgroundColor = config.readEntry( "BackgroundColor", pal.color( QPalette::Base ) );

    m_matchArtist = config.readEntry( "MatchArtist", true );
    m_matchTitle = config.readEntry( "MatchTitle", true );
    m_matchAlbum = config.readEntry( "MatchAlbum", true );
    m_blacklist = config.readEntry( "Blacklist", QStringList() );

    const QStringList replacementList = config.readEntry( "ReplacementList", QStringList() );
    foreach( const QString replacement, replacementList )
    {
        const QStringList parts = replacement.split( "|" );
        QString label = parts.at(0);
        label = label.replace( "%s", "|" );
        label = label.replace( "%p", "%" );
        QString replacementValue = parts.at(1);
        replacementValue = replacementValue.replace( "%s", "|" );
        replacementValue = replacementValue.replace( "%p", "%" );
        m_replacementMap.insert( label, replacementValue );
    }

    m_stoppedstate = false; // force an update
    setStoppedState( true );

    connectSource( "labels" );
    connect( dataEngine( "amarok-labels" ), SIGNAL( sourceAdded( const QString & ) ),
             this, SLOT( connectSource( const QString & ) ) );
}
Example #20
0
void Albums::dataUpdated( const QString &name, const Plasma::DataEngine::Data &data )
{
    if( name != QLatin1String("albums") )
        return;

    Meta::AlbumList albums = data[ "albums" ].value<Meta::AlbumList>();
    Meta::TrackPtr track = data[ "currentTrack" ].value<Meta::TrackPtr>();
    QString headerText = data[ "headerText" ].toString();
    setHeaderText( headerText.isEmpty() ? i18n("Albums") : headerText );

    //Don't keep showing the albums for the artist of the last track that had album in the collection
    if( (m_currentTrack == track) && (m_albums == albums) )
        return;

    if( albums.isEmpty() )
    {
        debug() << "received albums is empty";
        setCollapseOn();
        m_albums.clear();
        m_albumsView->clear();
        return;
    }

    setCollapseOff();

    m_albums = albums;
    m_currentTrack = track;
    m_albumsView->clear();
    m_albumsView->setMode( track ? AlbumsProxyModel::SortByYear : AlbumsProxyModel::SortByCreateDate );
    QStandardItem *currentItem( 0 );

    foreach( Meta::AlbumPtr albumPtr, albums )
    {
        // do not show all tracks without an album from the collection, this takes ages
        // TODO: show all tracks from this artist that are not part of an album
        if( albumPtr->name().isEmpty() )
            continue;

        Meta::TrackList tracks = albumPtr->tracks();
        if( tracks.isEmpty() )
            continue;

        AlbumItem *albumItem = new AlbumItem();
        albumItem->setIconSize( 50 );
        albumItem->setAlbum( albumPtr );
        albumItem->setShowArtist( !m_currentTrack );

        int numberOfDiscs = 0;
        int childRow = 0;

        qStableSort( tracks.begin(), tracks.end(), Meta::Track::lessThan );

        QMultiHash< int, TrackItem* > trackItems; // hash of tracks items for each disc
        foreach( Meta::TrackPtr trackPtr, tracks )
        {
            if( numberOfDiscs < trackPtr->discNumber() )
                numberOfDiscs = trackPtr->discNumber();

            TrackItem *trackItem = new TrackItem();
            trackItem->setTrack( trackPtr );

            // bold the current track to make it more visible
            if( m_currentTrack && *m_currentTrack == *trackPtr )
            {
                currentItem = trackItem;
                trackItem->bold();
            }

            // If compilation and same artist, then highlight, but only if there's a current track
            if( m_currentTrack
                && m_currentTrack->artist() && trackPtr->artist()
                && (*m_currentTrack->artist() == *trackPtr->artist())
                && albumPtr->isCompilation() )
            {
                trackItem->italicise();
            }
            trackItems.insert( trackPtr->discNumber(), trackItem );
        }

        for( int i = 0; i <= numberOfDiscs; ++i )
        {
            QList<TrackItem*> items = trackItems.values( i );
            if( !items.isEmpty() )
            {
                const TrackItem *item = items.first();
                QStandardItem *discItem( 0 );
                if( numberOfDiscs > 1 )
                {
                    discItem = new QStandardItem( i18n("Disc %1", item->track()->discNumber()) );
                    albumItem->setChild( childRow++, discItem );
                    int discChildRow = 0;
                    foreach( TrackItem *trackItem, items )
                        discItem->setChild( discChildRow++, trackItem );
                }
                else
                {
                    foreach( TrackItem *trackItem, items )
                        albumItem->setChild( childRow++, trackItem );
                }
            }
        }
        m_albumsView->appendAlbum( albumItem );
    }

    m_albumsView->sort();
    if( currentItem )
    {
        m_albumsView->setRecursiveExpanded( currentItem, true );
        m_albumsView->scrollTo( currentItem );
    }

    updateConstraints();
}
Example #21
0
void
TabsApplet::stopped()
{
    setHeaderText( i18nc( "Guitar tablature", "Tabs" ) );
    updateInterface( StoppedState );
}
Example #22
0
TablePrintDialog::TablePrintDialog(QTableView *p_tableView, QPrinter * p_printer, QWidget *parent)
  : QDialog(parent)
  , tableView(p_tableView)
  , printer(p_printer)
  , gridMode(NoGrid)
  , lines(0)
  , pages(0)
  , leftMargin(80)
  , rightMargin(80)
  , topMargin(40)
  , bottomMargin(40)
  , spacing(4)
  , headerSize(60)
  , footerSize(60)
  , sceneZoomFactor(100)
  , columnZoomFactor(0.65)
  , rowHeight(0)
  , columnMultiplier(0)
  , model(tableView->model())
  , titleFmt(NULL)
  , headerFmt(NULL)
  , fmt(NULL)
{
  //setup printer
  printer->setFullPage(true);
  switch (QLocale::system().country())
  {
  case QLocale::AnyCountry:
  case QLocale::Canada:
  case QLocale::UnitedStates:
  case QLocale::UnitedStatesMinorOutlyingIslands:
    printer->setPageSize(QPrinter::Letter);
    break;
  default:
    printer->setPageSize(QPrinter::A4);
    break;
  }


  setHeaderText("Document");
  footerText=trUtf8("Page: ");


  //get column widths
  for (int i=0; i<model->columnCount(); i++)
  {
    int colWidth=tableView->columnWidth(i);
    colSizes.append(QTextLength(QTextLength::FixedLength,colWidth));
  }

  //title font
  titleFont=tableView->font();
  titleFont.setPointSize(24);
  titleFont.setBold(false);
  titleFont.setUnderline(false);
  titleFmt =new QFontMetrics(titleFont);


  //header font
  headerFont=tableView->font();
  headerFont.setBold(true);
  headerFont.setUnderline(true);
  headerFont.setPointSize(9);
  headerFmt =new QFontMetrics(headerFont);

  //normal font
  font=tableView->font();
  headerFont.setPointSize(9);
  fmt = new QFontMetrics(font);


  QString date=QDate::currentDate().toString(QLocale().dateFormat());
  QString time=QTime::currentTime().toString(QLocale().timeFormat(QLocale::ShortFormat));
  headerStdText = date+"  "+time;

  setupPage();
  columnMultiplier=pageScene.width()/tableView->width()*columnZoomFactor;
}
Example #23
0
void
TabsApplet::dataUpdated( const QString& name, const Plasma::DataEngine::Data& data )
{
    DEBUG_BLOCK
    Q_UNUSED( name )

    // remove previously fetched stuff
    m_tabsView->clear();
    m_tabsView->clearTabBrowser();
    setBusy( false );

    if( data.empty() )
    {
        setHeaderText( i18nc( "Guitar tablature", "Tabs" ) );
        updateInterface( InitState );
        return;
    }

    const QString state      = data[ "state" ].toString();
    const QString artistName = data[ "artist" ].toString();
    const QString titleName  = data[ "title" ].toString();
    if( data.contains( "state" ) && state.contains( "Fetching" ) )
    {
        if( canAnimate() )
            setBusy( true );
        setHeaderText( i18nc( "Guitar tablature", "Tabs: Fetching..." ) );
        updateInterface( FetchingState );
        return;
    }
    else if( data.contains( "state" ) && state.contains( "Stopped" ) )
    {
        stopped();
        return;
    }
    else if( data.contains( "state" ) && state.contains( "noTabs") )
    {
        // no tabs for the current track
        setHeaderText( i18nc( "Guitar tablature", "No Tabs for %1 by %2", titleName, artistName ) );
        updateInterface( NoTabsState );
        return;
    }
    else if( data.contains( "state" ) && state.contains( "FetchError") )
    {
        setHeaderText( i18nc( "Guitar tablature", "Tabs: Fetch Error" ) );
        updateInterface( NoTabsState );
        return;
    }

    // getting the tab-data from the engine
    bool tabFound = false;
    for( int i = 0; i < data.size(); i++ )
    {
        const QString tabId = QString( "tabs:" ).append( QString::number( i ) );
        if( data.contains( tabId ) )
        {
            TabsInfo *item = data[ tabId ].value<TabsInfo *>() ;
            if( item )
            {
                TabsItem *tabsItem = new TabsItem();
                tabsItem->setTab( item );

                m_tabsView->appendTab( tabsItem );
                if( !tabFound )
                {
                    // update the applet and display the first tab in list
                    m_tabsView->showTab( tabsItem );

                    // update artist and title in the headerlabel
                    setHeaderText( i18nc( "Guitar tablature", "Tabs: %1 - %2", titleName, artistName ) );
                    updateInterface( TabState );
                    tabFound = true;
                }
            }
        }
    }
}
Example #24
0
void
PhotosApplet::dataUpdated( const QString& name, const Plasma::DataEngine::Data& data ) // SLOT
{
    if( name != QLatin1String("photos") || data.isEmpty() )
        return;

    QString text;

    if( data.contains( "message" ) )
    {
        text = data["message"].toString();
        if( text.contains( QLatin1String("Fetching") ) )
        {
            debug() << "received message: Fetching";
            setHeaderText( i18n( "Photos: %1", text ) );
            setMinimumHeight( m_header->height() );
            setCollapseHeight( m_header->height() );
            setCollapseOn();
            m_widget->clear();
            m_widget->hide();
            if( canAnimate() )
                setBusy( true );
        }
        else if( text.contains( QLatin1String("stopped") ) )
        {
            debug() << "received message: stopped";
            stopped();
        }
        else
        {
            debug() << "received message:" << text;
            setHeaderText( i18n( "Photos: %1", text ) );
            m_widget->hide();
            setMinimumHeight( m_header->height() );
            setCollapseHeight( m_header->height() );
            setCollapseOn();
            setBusy( false );
        }
    }
    else if( data.contains( "data" ) )
    {
        m_widget->clear();
        m_currentArtist = text = data["artist"].toString();
        PhotosInfo::List photos = data["data"].value< PhotosInfo::List >();
        debug() << "received data for:" << text << photos.count();
        setHeaderText( i18n( "Photos: %1", text ) );
        if( photos.isEmpty() )
        {
            setBusy( false );
            setMinimumHeight( m_header->height() );
            setCollapseHeight( m_header->height() );
            setCollapseOn();
            return;
        }
        setBusy( true );
        m_widget->setPhotosInfoList( photos );
        setMinimumHeight( 220 );
        setCollapseOff();
        m_widget->show();
        layout()->invalidate();
    }
    else
    {
        setMinimumHeight( m_header->height() );
        setCollapseHeight( m_header->height() );
        setCollapseOn();
        m_widget->clear();
        m_widget->hide();
        setBusy( false );
    }
    updateConstraints();
}
Example #25
0
TDPreviewDialog::TDPreviewDialog(QTableView *p_tableView, QPrinter * p_printer, const QString &titulo, QWidget *parent) : QDialog(parent)
{
        //variables
        titulol=titulo+" : Vista previa de Impresion";
        titulopdf=titulo;
        tableView=p_tableView;
        leftMargin=80;
        rightMargin=80;
        topMargin=40;
        bottomMargin=40;
        spacing=4;
        headerSize=60;
        footerSize=60;
        sceneZoomFactor=100;
        columnZoomFactor=0.65;
        gridMode=NoGrid;

        model= tableView->model();

        //setup printer
        printer=p_printer;
        printer->setFullPage(true);
        switch (QLocale::system().country()) {
        case QLocale::AnyCountry:
        case QLocale::UnitedStates:
        case QLocale::UnitedStatesMinorOutlyingIslands:
                printer->setPageSize(QPrinter::A4);
                break;
        default:
                printer->setPageSize(QPrinter::Letter);
                break;
        }

        setHeaderText(titulo);
        footerText=trUtf8("Pagina: ");

        //get column widths
        for (int i=0; i<model->columnCount(); i++) {
                int colWidth=tableView->columnWidth(i);
                colSizes.append(QTextLength(QTextLength::FixedLength,colWidth));
        }

        //title font
        titleFont=tableView->font();
        titleFont.setPointSize(24);
        titleFont.setBold(false);
        titleFont.setUnderline(false);
        titleFmt =new QFontMetrics(titleFont);



        //header font
        headerFont=tableView->font();
        headerFont.setBold(true);
        headerFont.setUnderline(true);
        headerFont.setPointSize(9);
        headerFmt =new QFontMetrics(headerFont);

        //normal font
        font=tableView->font();
        headerFont.setPointSize(9);
        fmt =new  QFontMetrics(font);


        QString date=QDate::currentDate().toString(QLocale().dateFormat());
        QString time=QTime::currentTime().toString(QLocale().timeFormat(QLocale::ShortFormat));
        headerStdText = date+"  "+time;

        setupPage();
        columnMultiplier=pageScene.width()/tableView->width()*columnZoomFactor;
}
Example #26
0
void
SimilarArtistsApplet::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    enableHeader( true );
    setHeaderText( i18n( "Similar Artists" ) );

    QAction* backwardAction = new QAction( this );
    backwardAction->setIcon( KIcon( "go-previous" ) );
    backwardAction->setEnabled( false );
    backwardAction->setText( i18n( "Back" ) );
    m_backwardIcon = addLeftHeaderAction( backwardAction );
    connect( m_backwardIcon, SIGNAL(clicked()), this, SLOT(goBackward()) );

    QAction* forwardAction = new QAction( this );
    forwardAction->setIcon( KIcon( "go-next" ) );
    forwardAction->setEnabled( false );
    forwardAction->setText( i18n( "Forward" ) );
    m_forwardIcon = addLeftHeaderAction( forwardAction );
    connect( m_forwardIcon, SIGNAL(clicked()), this, SLOT(goForward()) );

    QAction *currentAction = new QAction( this );
    currentAction->setIcon( KIcon( "filename-artist-amarok" ) );
    currentAction->setEnabled( true );
    currentAction->setText( i18n( "Show Similar Artists for Currently Playing Track" ) );
    m_currentArtistIcon = addRightHeaderAction( currentAction );
    connect( m_currentArtistIcon, SIGNAL(clicked()), this, SLOT(queryForCurrentTrack()) );

    QAction* settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    m_settingsIcon = addRightHeaderAction( settingsAction );
    connect( m_settingsIcon, SIGNAL(clicked()), this, SLOT(configure()) );

    setCollapseOffHeight( -1 );
    setCollapseHeight( m_header->height() );
    setMinimumHeight( collapseHeight() );
    setPreferredHeight( collapseHeight() );

    // create a scrollarea
    m_scroll = new ArtistsListWidget( this );
    m_scroll->hide();
    connect( m_scroll, SIGNAL(showSimilarArtists(QString)), SLOT(showSimilarArtists(QString)) );
    connect( m_scroll, SIGNAL(showBio(QString)), SLOT(showArtistBio(QString)) );

    m_layout = new QGraphicsLinearLayout( Qt::Vertical, this );
    m_layout->addItem( m_header );
    m_layout->addItem( m_scroll );
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    // Read config and inform the engine.
    KConfigGroup config = Amarok::config( "SimilarArtists Applet" );
    m_maxArtists = config.readEntry( "maxArtists", "5" ).toInt();

    Plasma::DataEngine *engine = dataEngine( "amarok-similarArtists" );
    connect( engine, SIGNAL(sourceAdded(QString)), SLOT(connectSource(QString)) );
    engine->setProperty( "maximumArtists", m_maxArtists );
    engine->query( "similarArtists" );
}
Example #27
0
void EditStyle::setValues()
      {
      staffUpperBorder->setValue(lstyle.value(StyleIdx::staffUpperBorder).toDouble());
      staffLowerBorder->setValue(lstyle.value(StyleIdx::staffLowerBorder).toDouble());
      staffDistance->setValue(lstyle.value(StyleIdx::staffDistance).toDouble());
      akkoladeDistance->setValue(lstyle.value(StyleIdx::akkoladeDistance).toDouble());
      minSystemDistance->setValue(lstyle.value(StyleIdx::minSystemDistance).toDouble());
      maxSystemDistance->setValue(lstyle.value(StyleIdx::maxSystemDistance).toDouble());
      lyricsDistance->setValue(lstyle.value(StyleIdx::lyricsDistance).toDouble());
      lyricsMinBottomDistance->setValue(lstyle.value(StyleIdx::lyricsMinBottomDistance).toDouble());
      lyricsLineHeight->setValue(lstyle.value(StyleIdx::lyricsLineHeight).toDouble() * 100.0);
      systemFrameDistance->setValue(lstyle.value(StyleIdx::systemFrameDistance).toDouble());
      frameSystemDistance->setValue(lstyle.value(StyleIdx::frameSystemDistance).toDouble());
      minMeasureWidth_2->setValue(lstyle.value(StyleIdx::minMeasureWidth).toDouble());

      barWidth->setValue(lstyle.value(StyleIdx::barWidth).toDouble());
      endBarWidth->setValue(lstyle.value(StyleIdx::endBarWidth).toDouble());
      endBarDistance->setValue(lstyle.value(StyleIdx::endBarDistance).toDouble());
      doubleBarWidth->setValue(lstyle.value(StyleIdx::doubleBarWidth).toDouble());
      doubleBarDistance->setValue(lstyle.value(StyleIdx::doubleBarDistance).toDouble());

      showRepeatBarTips->setChecked(lstyle.value(StyleIdx::repeatBarTips).toBool());
      showStartBarlineSingle->setChecked(lstyle.value(StyleIdx::startBarlineSingle).toBool());
      showStartBarlineMultiple->setChecked(lstyle.value(StyleIdx::startBarlineMultiple).toBool());

      measureSpacing->setValue(lstyle.value(StyleIdx::measureSpacing).toDouble());
      minNoteDistance->setValue(lstyle.value(StyleIdx::minNoteDistance).toDouble());
      barNoteDistance->setValue(lstyle.value(StyleIdx::barNoteDistance).toDouble());
      barAccidentalDistance->setValue(lstyle.value(StyleIdx::barAccidentalDistance).toDouble());
      multiMeasureRestMargin->setValue(lstyle.value(StyleIdx::multiMeasureRestMargin).toDouble());
      noteBarDistance->setValue(lstyle.value(StyleIdx::noteBarDistance).toDouble());

      showMeasureNumber->setChecked(lstyle.value(StyleIdx::showMeasureNumber).toBool());
      showFirstMeasureNumber->setChecked(lstyle.value(StyleIdx::showMeasureNumberOne).toBool());
      intervalMeasureNumber->setValue(lstyle.value(StyleIdx::measureNumberInterval).toInt());
      showIntervalMeasureNumber->setChecked(!lstyle.value(StyleIdx::measureNumberSystem).toBool());
      showAllStaffsMeasureNumber->setChecked(lstyle.value(StyleIdx::measureNumberAllStaffs).toBool());
      showEverySystemMeasureNumber->setChecked(lstyle.value(StyleIdx::measureNumberSystem).toBool());

      clefLeftMargin->setValue(lstyle.value(StyleIdx::clefLeftMargin).toDouble());
      keysigLeftMargin->setValue(lstyle.value(StyleIdx::keysigLeftMargin).toDouble());
      timesigLeftMargin->setValue(lstyle.value(StyleIdx::timesigLeftMargin).toDouble());
      clefKeyRightMargin->setValue(lstyle.value(StyleIdx::clefKeyRightMargin).toDouble());
      clefBarlineDistance->setValue(lstyle.value(StyleIdx::clefBarlineDistance).toDouble());
      staffLineWidth->setValue(lstyle.value(StyleIdx::staffLineWidth).toDouble());

      beamWidth->setValue(lstyle.value(StyleIdx::beamWidth).toDouble());
      beamDistance->setValue(lstyle.value(StyleIdx::beamDistance).toDouble() * 100.0);
      beamMinLen->setValue(lstyle.value(StyleIdx::beamMinLen).toDouble());
      beamNoSlope->setChecked(lstyle.value(StyleIdx::beamNoSlope).toBool());

      graceNoteSize->setValue(lstyle.value(StyleIdx::graceNoteMag).toDouble() * 100.0);
      smallStaffSize->setValue(lstyle.value(StyleIdx::smallStaffMag).toDouble() * 100.0);
      smallNoteSize->setValue(lstyle.value(StyleIdx::smallNoteMag).toDouble() * 100.0);
      smallClefSize->setValue(lstyle.value(StyleIdx::smallClefMag).toDouble() * 100.0);
      lastSystemFillThreshold->setValue(lstyle.value(StyleIdx::lastSystemFillLimit).toDouble() * 100.0);

      hairpinY->setValue(lstyle.value(StyleIdx::hairpinY).toDouble());
      hairpinLineWidth->setValue(lstyle.value(StyleIdx::hairpinLineWidth).toDouble());
      hairpinHeight->setValue(lstyle.value(StyleIdx::hairpinHeight).toDouble());
      hairpinContinueHeight->setValue(lstyle.value(StyleIdx::hairpinContHeight).toDouble());

      genClef->setChecked(lstyle.value(StyleIdx::genClef).toBool());
      genKeysig->setChecked(lstyle.value(StyleIdx::genKeysig).toBool());
      genTimesig->setChecked(lstyle.value(StyleIdx::genTimesig).toBool());
      genCourtesyTimesig->setChecked(lstyle.value(StyleIdx::genCourtesyTimesig).toBool());
      genCourtesyKeysig->setChecked(lstyle.value(StyleIdx::genCourtesyKeysig).toBool());
      genCourtesyClef->setChecked(lstyle.value(StyleIdx::genCourtesyClef).toBool());
      swingBox->setValue(lstyle.value(StyleIdx::swingRatio).toInt());
      QString unit(lstyle.value(StyleIdx::swingUnit).toString());
      if (unit == TDuration(TDuration::DurationType::V_EIGHT).name()) {
            swingEighth->setChecked(true);
            swingBox->setEnabled(true);
            }
      else if (unit == TDuration(TDuration::DurationType::V_16TH).name()) {
            swingSixteenth->setChecked(true);
            swingBox->setEnabled(true);
            }
      else if (unit == TDuration(TDuration::DurationType::V_ZERO).name()) {
            SwingOff->setChecked(true);
            swingBox->setEnabled(false);
      }
      QString s(lstyle.value(StyleIdx::chordDescriptionFile).toString());
      chordDescriptionFile->setText(s);
      chordsXmlFile->setChecked(lstyle.value(StyleIdx::chordsXmlFile).toBool());
      QString cstyle(lstyle.value(StyleIdx::chordStyle).toString());
      if (cstyle == "std") {
            chordsStandard->setChecked(true);
            chordDescriptionGroup->setEnabled(false);
            }
      else if (cstyle == "jazz") {
            chordsJazz->setChecked(true);
            chordDescriptionGroup->setEnabled(false);
            }
      else {
            chordsCustom->setChecked(true);
            chordDescriptionGroup->setEnabled(true);
            }
      useStandardNoteNames->setChecked(lstyle.value(StyleIdx::useStandardNoteNames).toBool());
      useGermanNoteNames->setChecked(lstyle.value(StyleIdx::useGermanNoteNames).toBool());
      useSolfeggioNoteNames->setChecked(lstyle.value(StyleIdx::useSolfeggioNoteNames).toBool());
      lowerCaseMinorChords->setChecked(lstyle.value(StyleIdx::lowerCaseMinorChords).toBool());
      concertPitch->setChecked(lstyle.value(StyleIdx::concertPitch).toBool());

      multiMeasureRests->setChecked(lstyle.value(StyleIdx::createMultiMeasureRests).toBool());
      minEmptyMeasures->setValue(lstyle.value(StyleIdx::minEmptyMeasures).toInt());
      minMeasureWidth->setValue(lstyle.value(StyleIdx::minMMRestWidth).toDouble());
      hideEmptyStaves->setChecked(lstyle.value(StyleIdx::hideEmptyStaves).toBool());
      dontHideStavesInFirstSystem->setChecked(lstyle.value(StyleIdx::dontHideStavesInFirstSystem).toBool());
      dontHideStavesInFirstSystem->setEnabled(hideEmptyStaves->isChecked());
      hideInstrumentNameIfOneInstrument->setChecked(lstyle.value(StyleIdx::hideInstrumentNameIfOneInstrument).toBool());

      accidentalNoteDistance->setValue(lstyle.value(StyleIdx::accidentalNoteDistance).toDouble());
      accidentalDistance->setValue(lstyle.value(StyleIdx::accidentalDistance).toDouble());
      dotMag->setValue(lstyle.value(StyleIdx::dotMag).toDouble() * 100.0);
      noteDotDistance->setValue(lstyle.value(StyleIdx::dotNoteDistance).toDouble());
      dotDotDistance->setValue(lstyle.value(StyleIdx::dotDotDistance).toDouble());
      stemWidth->setValue(lstyle.value(StyleIdx::stemWidth).toDouble());
      ledgerLineWidth->setValue(lstyle.value(StyleIdx::ledgerLineWidth).toDouble());
      ledgerLineLength->setValue(lstyle.value(StyleIdx::ledgerLineLength).toDouble());

      bracketWidth->setValue(lstyle.value(StyleIdx::bracketWidth).toDouble());
      bracketDistance->setValue(lstyle.value(StyleIdx::bracketDistance).toDouble());
      akkoladeWidth->setValue(lstyle.value(StyleIdx::akkoladeWidth).toDouble());
      akkoladeBarDistance->setValue(lstyle.value(StyleIdx::akkoladeBarDistance).toDouble());

      propertyDistanceHead->setValue(lstyle.value(StyleIdx::propertyDistanceHead).toDouble());
      propertyDistanceStem->setValue(lstyle.value(StyleIdx::propertyDistanceStem).toDouble());
      propertyDistance->setValue(lstyle.value(StyleIdx::propertyDistance).toDouble());
      articulationMag->setValue(lstyle.value(StyleIdx::articulationMag).toDouble() * 100.0);

      shortenStem->setChecked(lstyle.value(StyleIdx::shortenStem).toBool());
      shortStemProgression->setValue(lstyle.value(StyleIdx::shortStemProgression).toDouble());
      shortestStem->setValue(lstyle.value(StyleIdx::shortestStem).toDouble());
      arpeggioNoteDistance->setValue(lstyle.value(StyleIdx::ArpeggioNoteDistance).toDouble());
      arpeggioLineWidth->setValue(lstyle.value(StyleIdx::ArpeggioLineWidth).toDouble());
      arpeggioHookLen->setValue(lstyle.value(StyleIdx::ArpeggioHookLen).toDouble());

      // figured bass
      for(int i = 0; i < comboFBFont->count(); i++)
            if(comboFBFont->itemText(i) == lstyle.value(StyleIdx::figuredBassFontFamily).toString()) {
                  comboFBFont->setCurrentIndex(i);
                  break;
            }
      doubleSpinFBSize->setValue(lstyle.value(StyleIdx::figuredBassFontSize).toDouble());
      doubleSpinFBVertPos->setValue(lstyle.value(StyleIdx::figuredBassYOffset).toDouble());
      spinFBLineHeight->setValue(lstyle.value(StyleIdx::figuredBassLineHeight).toDouble() * 100.0);
      radioFBTop->setChecked(lstyle.value(StyleIdx::figuredBassAlignment).toInt() == 0);
      radioFBBottom->setChecked(lstyle.value(StyleIdx::figuredBassAlignment).toInt() == 1);
      radioFBModern->setChecked(lstyle.value(StyleIdx::figuredBassStyle).toInt() == 0);
      radioFBHistoric->setChecked(lstyle.value(StyleIdx::figuredBassStyle).toInt() == 1);

      for (int i = 0; i < int(ArticulationType::ARTICULATIONS); ++i) {
            QComboBox* cb = static_cast<QComboBox*>(articulationTable->cellWidget(i, 1));
            if (cb == 0)
                  continue;
            ArticulationAnchor st  = lstyle.articulationAnchor(i);
            int idx = 0;
            if (st == ArticulationAnchor::TOP_STAFF)
                  idx = 0;
            else if (st == ArticulationAnchor::BOTTOM_STAFF)
                  idx = 1;
            else if (st == ArticulationAnchor::CHORD)
                  idx = 2;
            cb->setCurrentIndex(idx);
            }

      fixNumberMeasures->setValue(lstyle.value(StyleIdx::FixMeasureNumbers).toInt());
      fixMeasureWidth->setChecked(lstyle.value(StyleIdx::FixMeasureWidth).toBool());

      slurEndLineWidth->setValue(lstyle.value(StyleIdx::SlurEndWidth).toDouble());
      slurMidLineWidth->setValue(lstyle.value(StyleIdx::SlurMidWidth).toDouble());
      slurDottedLineWidth->setValue(lstyle.value(StyleIdx::SlurDottedWidth).toDouble());
      minTieLength->setValue(lstyle.value(StyleIdx::MinTieLength).toDouble());

      QString mfont(lstyle.value(StyleIdx::MusicalSymbolFont).toString());
      int idx = 0;
      for (auto i : ScoreFont::scoreFonts()) {
            if (i.name().toLower() == mfont.toLower()) {
                  musicalSymbolFont->setCurrentIndex(idx);
                  break;
                  }
            ++idx;
            }
      musicalTextFont->clear();
      musicalTextFont->addItem("Emmentaler Text", "MScore Text");
      musicalTextFont->addItem("Bravura Text", "Bravura Text");
      QString tfont(lstyle.value(StyleIdx::MusicalTextFont).toString());
      idx = tfont == "Bravura Text" ? 1 : 0;
      musicalTextFont->setCurrentIndex(idx);

      showHeader->setChecked(lstyle.value(StyleIdx::showHeader).toBool());
      showHeaderFirstPage->setChecked(lstyle.value(StyleIdx::headerFirstPage).toBool());
      headerOddEven->setChecked(lstyle.value(StyleIdx::headerOddEven).toBool());
      toggleHeaderOddEven(lstyle.value(StyleIdx::headerOddEven).toBool());

      setHeaderText(StyleIdx::evenHeaderL, evenHeaderL);
      setHeaderText(StyleIdx::evenHeaderC, evenHeaderC);
      setHeaderText(StyleIdx::evenHeaderR, evenHeaderR);
      setHeaderText(StyleIdx::oddHeaderL, oddHeaderL);
      setHeaderText(StyleIdx::oddHeaderC, oddHeaderC);
      setHeaderText(StyleIdx::oddHeaderR, oddHeaderR);

      showFooter->setChecked(lstyle.value(StyleIdx::showFooter).toBool());
      showFooterFirstPage->setChecked(lstyle.value(StyleIdx::footerFirstPage).toBool());
      footerOddEven->setChecked(lstyle.value(StyleIdx::footerOddEven).toBool());
      toggleFooterOddEven(lstyle.value(StyleIdx::footerOddEven).toBool());

      setFooterText(StyleIdx::evenFooterL, evenFooterL);
      setFooterText(StyleIdx::evenFooterC, evenFooterC);
      setFooterText(StyleIdx::evenFooterR, evenFooterR);
      setFooterText(StyleIdx::oddFooterL, oddFooterL);
      setFooterText(StyleIdx::oddFooterC, oddFooterC);
      setFooterText(StyleIdx::oddFooterR, oddFooterR);

      voltaY->setValue(lstyle.value(StyleIdx::voltaY).toDouble());
      voltaHook->setValue(lstyle.value(StyleIdx::voltaHook).toDouble());
      voltaLineWidth->setValue(lstyle.value(StyleIdx::voltaLineWidth).toDouble());
      voltaLineStyle->setCurrentIndex(lstyle.value(StyleIdx::voltaLineStyle).toInt()-1);

      ottavaY->setValue(lstyle.value(StyleIdx::ottavaY).toDouble());
      ottavaHook->setValue(lstyle.value(StyleIdx::ottavaHook).toDouble());
      ottavaLineWidth->setValue(lstyle.value(StyleIdx::ottavaLineWidth).toDouble());
      ottavaLineStyle->setCurrentIndex(lstyle.value(StyleIdx::ottavaLineStyle).toInt()-1);
      ottavaNumbersOnly->setChecked(lstyle.value(StyleIdx::ottavaNumbersOnly).toBool());

      trillY->setValue(lstyle.value(StyleIdx::trillY).toDouble());
      harmonyY->setValue(lstyle.value(StyleIdx::harmonyY).toDouble());
      harmonyFretDist->setValue(lstyle.value(StyleIdx::harmonyFretDist).toDouble());
      minHarmonyDistance->setValue(lstyle.value(StyleIdx::minHarmonyDistance).toDouble());
      maxHarmonyBarDistance->setValue(lstyle.value(StyleIdx::maxHarmonyBarDistance).toDouble());
      capoPosition->setValue(lstyle.value(StyleIdx::capoPosition).toInt());
      fretNumMag->setValue(lstyle.value(StyleIdx::fretNumMag).toDouble()*100.0);
      radioFretNumLeft->setChecked(lstyle.value(StyleIdx::fretNumPos).toInt() == 0);
      radioFretNumRight->setChecked(lstyle.value(StyleIdx::fretNumPos).toInt() == 1);
      fretY->setValue(lstyle.value(StyleIdx::fretY).toDouble());
      pedalY->setValue(lstyle.value(StyleIdx::pedalY).toDouble());
      pedalLineWidth->setValue(lstyle.value(StyleIdx::pedalLineWidth).toDouble());
      pedalLineStyle->setCurrentIndex(lstyle.value(StyleIdx::pedalLineStyle).toInt()-1);

      clefTab1->setChecked(lstyle.value(StyleIdx::tabClef).toInt() == int(ClefType::TAB));
      clefTab2->setChecked(lstyle.value(StyleIdx::tabClef).toInt() == int(ClefType::TAB2));

      crossMeasureValues->setChecked(lstyle.value(StyleIdx::crossMeasureValues).toBool());

      radioKeySigNatNone->setChecked  (lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::NONE));
      radioKeySigNatBefore->setChecked(lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::BEFORE));
      radioKeySigNatAfter->setChecked (lstyle.value(StyleIdx::keySigNaturals).toInt() == int(KeySigNatural::AFTER));

      tupletMaxSlope->setValue(lstyle.value(StyleIdx::tupletMaxSlope).toDouble());
      tupletOutOfStaff->setChecked(lstyle.value(StyleIdx::tupletOufOfStaff).toBool());
      tupletVHeadDistance->setValue(lstyle.value(StyleIdx::tupletVHeadDistance).toDouble());
      tupletVStemDistance->setValue(lstyle.value(StyleIdx::tupletVStemDistance).toDouble());
      tupletStemLeftDistance->setValue(lstyle.value(StyleIdx::tupletStemLeftDistance).toDouble());
      tupletStemRightDistance->setValue(lstyle.value(StyleIdx::tupletStemRightDistance).toDouble());
      tupletNoteLeftDistance->setValue(lstyle.value(StyleIdx::tupletNoteLeftDistance).toDouble());
      tupletNoteRightDistance->setValue(lstyle.value(StyleIdx::tupletNoteRightDistance).toDouble());
      }
Example #28
0
void UXTEditor::open( QString filename )
{
	std::vector< STRING_MANAGER::TStringInfo > &infos = d_ptr->infos;
	QString lang = getLang( filename );
	
	infos.clear();
	STRING_MANAGER::loadStringFile( filename.toUtf8().constData(), infos, false );

	if( d_ptr->infos.size() == 0 )
	{
		// The work file cannot be found, cannot proceed
		if( filename.endsWith( "wk.uxt" ) )
		{
			QMessageBox::critical( this,
									tr( "Error opening file.." ),
									tr( "There was an error opening wk.uxt" ) );
			return;
		}

		int l = filename.lastIndexOf( "/" );
		if( l == -1 )
			return;

		QString fn = filename.left( l );		
		fn += "/wk.uxt";
		
		// The work file cannot be found, cannot proceed
		STRING_MANAGER::loadStringFile( fn.toUtf8().constData(), infos, true );
		if( d_ptr->infos.size() == 0 )
		{
			QMessageBox::critical( this,
									tr( "Error opening Uxt file" ),
									tr( "Neither the specified file nor wk.uxt could be opened." ) );
			return;
		}

		d_ptr->loadedFromWK = true;
	}

	blockTableSignals( true );

	d_ptr->t->clear();
	d_ptr->t->setColumnCount( 2 );
	d_ptr->t->setRowCount( infos.size() );

	setHeaderText( "Id", lang.toUpper() + " Text" );

	int i = 0;

	std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = infos.begin();
	while( itr != infos.end() )
	{
		const STRING_MANAGER::TStringInfo &info = *itr;

		QTableWidgetItem *name = new QTableWidgetItem( info.Identifier.c_str() );
		QTableWidgetItem *text1 = new QTableWidgetItem( info.Text.toUtf8().c_str() );
		
		d_ptr->t->setItem( i, 0, name );
		d_ptr->t->setItem( i, 1, text1 );

		if( ( info.HashValue != 0 ) && !d_ptr->loadedFromWK )
		{
			markItemTranslated( name );
			markItemTranslated( text1 );
		}
		else
		{
			markItemUntranslated( name );
			markItemUntranslated( text1 );
		}
		
		++itr;
		i++;
	}

	d_ptr->t->resizeColumnsToContents();

	blockTableSignals( false );

	setWidget( d_ptr->t );

	current_file = filename;
	setWindowTitle( filename + "[*]" );
	setWindowFilePath( filename );
}