コード例 #1
0
SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog)
    : SettingsPage(dialog),
      network_(new NetworkAccessManager(this)),
      ui_(new Ui_SpotifySettingsPage),
      service_(InternetModel::Service<SpotifyService>()),
      validated_(false)
{
    ui_->setupUi(this);

    setWindowIcon(QIcon(":/icons/svg/spotify.svg"));

    QFont bold_font(font());
    bold_font.setBold(true);
    ui_->blob_status->setFont(bold_font);

    connect(ui_->download_blob, SIGNAL(clicked()), SLOT(DownloadBlob()));
    connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
    connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(Logout()));
    connect(ui_->login_state, SIGNAL(LoginClicked()), SLOT(Login()));

    connect(service_, SIGNAL(LoginFinished(bool)), SLOT(LoginFinished(bool)));
    connect(service_, SIGNAL(BlobStateChanged()), SLOT(BlobStateChanged()));

    ui_->login_state->AddCredentialField(ui_->username);
    ui_->login_state->AddCredentialField(ui_->password);
    ui_->login_state->AddCredentialGroup(ui_->account_group);

    BlobStateChanged();
}
コード例 #2
0
void GroupedIconView::DrawHeader(const QModelIndex& index,
                                 const QRect& rect, QPainter* painter) {
  painter->save();

  // Bold font
  QFont bold_font(font());
  bold_font.setBold(true);
  QFontMetrics metrics(bold_font);

  // Draw text
  const QString category = header_text_.arg(index.data(Role_Group).toString());
  painter->setFont(bold_font);
  painter->drawText(rect, category);

  // Draw a line underneath
  const QPoint start(rect.left(), rect.top() + metrics.height());
  const QPoint end(rect.right(), start.y());

  painter->setRenderHint(QPainter::Antialiasing, true);
  painter->setPen(QPen(palette().color(QPalette::Disabled, QPalette::Text),
                       kBarThickness, Qt::SolidLine, Qt::RoundCap));
  painter->setOpacity(0.5);
  painter->drawLine(start, end);

  painter->restore();
}
コード例 #3
0
SpotifySettingsPage::SpotifySettingsPage(SettingsDialog* dialog)
  : SettingsPage(dialog),
    ui_(new Ui_SpotifySettingsPage),
    service_(InternetModel::Service<SpotifyService>()),
    validated_(false)
{
  ui_->setupUi(this);

  setWindowIcon(QIcon(":/icons/48x48/spotify.png"));

  QFont bold_font(font());
  bold_font.setBold(true);
  ui_->blob_status->setFont(bold_font);

  connect(ui_->download_blob, SIGNAL(clicked()), SLOT(DownloadBlob()));
  connect(ui_->login, SIGNAL(clicked()), SLOT(Login()));
  connect(ui_->login_state, SIGNAL(LogoutClicked()), SLOT(Logout()));
  connect(ui_->login_state, SIGNAL(LoginClicked()), SLOT(Login()));

  connect(service_, SIGNAL(LoginFinished(bool)), SLOT(LoginFinished(bool)));
  connect(service_, SIGNAL(BlobStateChanged()), SLOT(BlobStateChanged()));

  ui_->login_state->AddCredentialField(ui_->username);
  ui_->login_state->AddCredentialField(ui_->password);
  ui_->login_state->AddCredentialGroup(ui_->account_group);

  ui_->bitrate->addItem("96 " + tr("kbps"), pb::spotify::Bitrate96k);
  ui_->bitrate->addItem("160 " + tr("kbps"), pb::spotify::Bitrate160k);
  ui_->bitrate->addItem("320 " + tr("kbps"), pb::spotify::Bitrate320k);

  BlobStateChanged();
}
コード例 #4
0
ファイル: loggers.cpp プロジェクト: stahta01/codeAdapt_IDE
void ListCtrlLogger::UpdateSettings()
{
    if (!control)
        return;

    ConfigManager* cfgman = Manager::Get()->GetConfigManager(_T("message_manager"));
    int size = cfgman->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8);
    wxFont default_font(size, fixed ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
    wxFont bold_font(default_font);
    wxFont italic_font(default_font);

    bold_font.SetWeight(wxFONTWEIGHT_BOLD);

    wxFont bigger_font(bold_font);
    bigger_font.SetPointSize(size + 2);

    wxFont small_font(default_font);
    small_font.SetPointSize(size - 4);

    italic_font.SetStyle(wxFONTSTYLE_ITALIC);

    wxColour default_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
    for(unsigned int i = 0; i < num_levels; ++i)
    {
        style[i].font = default_font;
        style[i].colour = default_text_colour;
    }

    ColourManager *colours = Manager::Get()->GetColourManager();

    style[caption].font = bigger_font;
    style[success].colour = colours->GetColour(wxT("logs_success_text"));
    style[failure].colour = colours->GetColour(wxT("logs_failure_text"));

    style[warning].font = italic_font;
    style[warning].colour = colours->GetColour(wxT("logs_warning_text"));

    style[error].colour = colours->GetColour(wxT("logs_error_text"));

    style[critical].font = bold_font;
    style[critical].colour = colours->GetColour(wxT("logs_critical_text_listctrl"));

    style[spacer].font = small_font;
    style[pagetitle] = style[caption];

    // Tell control and items about the font change
    control->SetFont(default_font);
    for (int i = 0; i < control->GetItemCount(); ++i)
    {
        wxFont font = control->GetItemFont(i);
        font.SetPointSize(size);
        control->SetItemFont( i, font );
    }//for
} // end of UpdateSettings
コード例 #5
0
ファイル: dlgtagfetcher.cpp プロジェクト: dot-Sean/mixxx
void DlgTagFetcher::addDivider(const QString& text, QTreeWidget* parent) const {
    QTreeWidgetItem* item = new QTreeWidgetItem(parent);
    item->setFirstColumnSpanned(true);
    item->setText(0, text);
    item->setFlags(Qt::NoItemFlags);
    item->setForeground(0, palette().color(QPalette::Disabled, QPalette::Text));

    QFont bold_font(font());
    bold_font.setBold(true);
    item->setFont(0, bold_font);
}
コード例 #6
0
LoginStateWidget::LoginStateWidget(QWidget* parent)
    : QWidget(parent), ui_(new Ui_LoginStateWidget), state_(LoggedOut) {
  ui_->setupUi(this);
  ui_->signed_in->hide();
  ui_->expires->hide();
  ui_->account_type->hide();
  ui_->busy->hide();

  ui_->sign_out->setIcon(IconLoader::Load("list-remove", IconLoader::Base));

  QFont bold_font(font());
  bold_font.setBold(true);
  ui_->signed_out_label->setFont(bold_font);

  connect(ui_->sign_out, SIGNAL(clicked()), SLOT(Logout()));
}
コード例 #7
0
ファイル: App.cpp プロジェクト: glindsey/GamePlan
App::App(std::string name)
  : impl(new Impl())
{
  // Create the random number generator.
  impl->rng.reset(new boost::random::mt19937(static_cast<unsigned int>(std::time(0))));

  // Create and open the main window.
  // GSL TODO: Window should not be resizable... probably
  impl->app_window.reset(new sf::RenderWindow(sf::VideoMode(1066, 600), name));

  // Set the app window size.
  impl->app_window_size = impl->app_window->getSize();

  // Create the default fonts.
  /// @todo Font names should be moved into ConfigSettings.
  std::shared_ptr<sf::Font> normal_font(new sf::Font());
  std::shared_ptr<sf::Font> bold_font(new sf::Font());
  std::shared_ptr<sf::Font> mono_font(new sf::Font());

  if (normal_font->loadFromFile("resources/fonts/" + Settings.font_name_default + ".ttf") == false)
  {
    FATAL_ERROR("Could not load the default font (" + Settings.font_name_default + ".ttf)");
  }

  if (bold_font->loadFromFile("resources/fonts/" + Settings.font_name_bold + ".ttf") == false)
  {
    FATAL_ERROR("Could not load the default bold font (" + Settings.font_name_bold + ".ttf)");
  }

  if (mono_font->loadFromFile("resources/fonts/" + Settings.font_name_mono + ".ttf") == false)
  {
    FATAL_ERROR("Could not load the default monospace font (" + Settings.font_name_mono + ".ttf)");
  }

  impl->default_font.reset(new GUI::Font(normal_font, bold_font));
  impl->default_mono_font.reset(new GUI::Font(mono_font));

  // Create the texture atlas.
  impl->texture_atlas.reset(new TextureAtlas());

  // Create the main state machine.
  impl->state_machine.reset(new StateMachine("app_state_machine"));

  // Set "window has focus" boolean to true.
  impl->has_window_focus = true;
}
コード例 #8
0
void RheiaTextLogger::UpdateSettings()
{
    RheiaConfigurationManager* cfg = RheiaManager::Get()->GetConfigurationManager( wxT("RheiaTextLogger") );
    bool isFirstTime = true;

    isFirstTime = (bool) cfg->ReadInt( wxT("/first_time") , (int) true );

    if( isFirstTime )
    {
        int size = 10;
        wxFont default_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
        wxFont bold_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
        wxFont italic_font(size, wxFONTFAMILY_SWISS , wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL);

        bold_font.SetWeight(wxFONTWEIGHT_BOLD);

        wxFont bigger_font(bold_font);
        bigger_font.SetPointSize(size + 1);

        wxFont small_font(default_font);
        small_font.SetPointSize(size - 4);

        for(unsigned int i = 0; i < (unsigned int) RheiaLogging::RheiaLogLevelNumber ; ++i)
        {
            m_textattr[i].SetFlags( wxTEXT_ATTR_FONT | wxTEXT_ATTR_ALIGNMENT );
            m_textattr[i].SetFont(default_font);
            m_textattr[i].SetAlignment(wxTEXT_ALIGNMENT_LEFT);
            m_textattr[i].SetTextColour(*wxBLACK);
            m_textattr[i].SetBackgroundColour(*wxWHITE);
        }

        m_textattr[RheiaLogging::warning].SetFont(italic_font);
        m_textattr[RheiaLogging::warning].SetTextColour(*wxBLUE);

        m_textattr[RheiaLogging::success].SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
        bigger_font.SetUnderlined(true);
        m_textattr[RheiaLogging::success].SetFont(bigger_font);
        m_textattr[RheiaLogging::success].SetTextColour(*wxBLUE);

        m_textattr[RheiaLogging::error].SetFont(bold_font);
        m_textattr[RheiaLogging::error].SetTextColour(*wxRED);

        m_textattr[RheiaLogging::fatalerror].SetFont(bold_font);
        m_textattr[RheiaLogging::fatalerror].SetTextColour(*wxWHITE);
        m_textattr[RheiaLogging::fatalerror].SetBackgroundColour(*wxRED);

        m_textattr[RheiaLogging::syserror].SetFont(bold_font);
        m_textattr[RheiaLogging::syserror].SetTextColour(*wxWHITE);
        m_textattr[RheiaLogging::syserror].SetBackgroundColour(*wxBLUE);

        m_textattr[RheiaLogging::info].SetFont(italic_font);

        m_textattr[RheiaLogging::status].SetFont(bold_font);
        m_textattr[RheiaLogging::status].SetTextColour(*wxGREEN);

        m_textattr[RheiaLogging::debug].SetFont(italic_font);
        m_textattr[RheiaLogging::debug].SetTextColour(*wxGREEN);

        m_textattr[RheiaLogging::trace].SetFont(italic_font);
        m_textattr[RheiaLogging::trace].SetTextColour(*wxGREEN);

        if( cfg != NULL )
        {
            cfg->Write( wxT("/message") , m_textattr[RheiaLogging::message] );
            cfg->Write( wxT("/warning") , m_textattr[RheiaLogging::warning] );
            cfg->Write( wxT("/success") , m_textattr[RheiaLogging::success] );
            cfg->Write( wxT("/error") , m_textattr[RheiaLogging::error] );
            cfg->Write( wxT("/fatalerror") , m_textattr[RheiaLogging::fatalerror] );
            cfg->Write( wxT("/info") , m_textattr[RheiaLogging::info] );
            cfg->Write( wxT("/status") , m_textattr[RheiaLogging::status] );
            cfg->Write( wxT("/syserror") , m_textattr[RheiaLogging::syserror] );
            cfg->Write( wxT("/debug") , m_textattr[RheiaLogging::debug] );
            cfg->Write( wxT("/trace") , m_textattr[RheiaLogging::trace] );
            cfg->Write( wxT("/first_time") , (int) false );
        }

        return;
    }

    m_textattr[RheiaLogging::message] = cfg->ReadTextAttr( wxT("/message") );
    m_textattr[RheiaLogging::warning] = cfg->ReadTextAttr( wxT("/warning") );
    m_textattr[RheiaLogging::success] = cfg->ReadTextAttr( wxT("/success") );
    m_textattr[RheiaLogging::error] = cfg->ReadTextAttr( wxT("/error") );
    m_textattr[RheiaLogging::fatalerror] = cfg->ReadTextAttr( wxT("/fatalerror") );
    m_textattr[RheiaLogging::info] = cfg->ReadTextAttr( wxT("/info") );
    m_textattr[RheiaLogging::status] = cfg->ReadTextAttr( wxT("/status") );
    m_textattr[RheiaLogging::syserror] = cfg->ReadTextAttr( wxT("/syserror") );
    m_textattr[RheiaLogging::debug] = cfg->ReadTextAttr( wxT("/debug") );
    m_textattr[RheiaLogging::trace] = cfg->ReadTextAttr( wxT("/trace") );
}
コード例 #9
0
BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
{
    BOARD_ITEM* item;

    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();

    // Assign to scanList the proper item types desired based on tool type
    // or hotkey that is in play.

    const KICAD_T* scanList = NULL;

    if( aHotKeyCode )
    {
        // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
        // when searching is needed from a hotkey handler
    }
    else if( GetToolId() == ID_NO_TOOL_SELECTED )
    {
        if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) )
            scanList = GENERAL_COLLECTOR::ModuleItems;
        else
            scanList = (DisplayOpt.DisplayZonesMode == 0) ?
                       GENERAL_COLLECTOR::AllBoardItems :
                       GENERAL_COLLECTOR::AllButZones;
    }
    else
    {
        switch( GetToolId() )
        {
        case ID_PCB_SHOW_1_RATSNEST_BUTT:
            scanList = GENERAL_COLLECTOR::PadsOrModules;
            break;

        case ID_TRACK_BUTT:
            scanList = GENERAL_COLLECTOR::Tracks;
            break;

        case ID_PCB_MODULE_BUTT:
            scanList = GENERAL_COLLECTOR::ModuleItems;
            break;

        case ID_PCB_ZONES_BUTT:
        case ID_PCB_KEEPOUT_AREA_BUTT:
            scanList = GENERAL_COLLECTOR::Zones;
            break;

        default:
            scanList = DisplayOpt.DisplayZonesMode == 0 ?
                       GENERAL_COLLECTOR::AllBoardItems :
                       GENERAL_COLLECTOR::AllButZones;
        }
    }

    m_Collector->Collect( m_Pcb, scanList, RefPos( true ), guide );

#if 0
    // debugging: print out the collected items, showing their priority order too.
    for( int i = 0; i<m_Collector->GetCount();  ++i )
        (*m_Collector)[i]->Show( 0, std::cout );
#endif

    /* Remove redundancies: sometime, legacy zones are found twice,
     * because zones can be filled by overlapping segments (this is a fill option)
     * Trigger the selection of the current edge for new-style zones
     */
    time_t timestampzone = 0;

    for( int ii = 0;  ii < m_Collector->GetCount(); ii++ )
    {
        item = (*m_Collector)[ii];

        switch( item->Type() )
        {
        case PCB_ZONE_T:
            // Found a TYPE ZONE
            if( item->GetTimeStamp() == timestampzone )    // Remove it, redundant, zone already found
            {
                m_Collector->Remove( ii );
                ii--;
            }
            else
            {
                timestampzone = item->GetTimeStamp();
            }
            break;

        case PCB_ZONE_AREA_T:
            {
                /* We need to do the selection now because the menu text
                 * depends on it */
                ZONE_CONTAINER *zone = static_cast<ZONE_CONTAINER*>( item );
                zone->SetSelectedCorner( RefPos( true ) );
            }
            break;

        default:
            break;
        }
    }

    if( m_Collector->GetCount() <= 1 )
    {
        item = (*m_Collector)[0];
        SetCurItem( item );
    }

    // If the count is 2, and first item is a pad or module text, and the 2nd item is its
    // parent module:
    else if( m_Collector->GetCount() == 2
             && ( (*m_Collector)[0]->Type() == PCB_PAD_T || (*m_Collector)[0]->Type() ==
                 PCB_MODULE_TEXT_T )
             && (*m_Collector)[1]->Type() == PCB_MODULE_T && (*m_Collector)[0]->GetParent()==
             (*m_Collector)[1] )
    {
        item = (*m_Collector)[0];
        SetCurItem( item );
    }
    // if all are modules, find the smallest one among the primary choices
    else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
    {
        SetCurItem( item );
    }

    else    // we can't figure out which item user wants, do popup menu so user can choose
    {
        wxMenu itemMenu;

        // Give a title to the selection menu. This is also a cancel menu item
        wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );

#ifdef __WINDOWS__
        wxFont bold_font( *wxNORMAL_FONT );
        bold_font.SetWeight( wxFONTWEIGHT_BOLD );
        bold_font.SetStyle( wxFONTSTYLE_ITALIC );
        item_title->SetFont( bold_font );
#endif

        itemMenu.Append( item_title );
        itemMenu.AppendSeparator();

        int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );

        for( int i = 0;  i<limit;  ++i )
        {
            wxString    text;
            item = (*m_Collector)[i];

            text = item->GetSelectMenuText();

            BITMAP_DEF xpm = item->GetMenuImage();

            AddMenuItem( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, KiBitmap( xpm ) );
        }

        /* @todo: rather than assignment to true, these should be increment and decrement
         * operators throughout _everywhere_.
         *  That way we can handle nesting.
         *  But I tried that and found there cases where the assignment to true (converted to
         * a m_IgnoreMouseEvents++ )
         *  was not balanced with the -- (now m_IgnoreMouseEvents=false), so I had to revert.
         *  Somebody should track down these and make them balanced.
         *  m_canvas->SetIgnoreMouseEvents( true );
         */

        // this menu's handler is void PCB_BASE_FRAME::ProcessItemSelection()
        // and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
        m_canvas->SetAbortRequest( true );   // changed in false if an item is selected
        PopupMenu( &itemMenu );

        m_canvas->MoveCursorToCrossHair();

        // The function ProcessItemSelection() has set the current item, return it.
        if( m_canvas->GetAbortRequest() )     // Nothing selected
            item = NULL;
        else
            item = GetCurItem();
    }

    return item;
}
コード例 #10
0
ファイル: loggers.cpp プロジェクト: stahta01/codeAdapt_IDE
void TextCtrlLogger::UpdateSettings()
{
    if (!control)
        return;

    control->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

    ConfigManager* cfgman = Manager::Get()->GetConfigManager(_T("message_manager"));
    int size = cfgman->ReadInt(_T("/log_font_size"), platform::macosx ? 10 : 8);

    wxFont default_font(size, fixed ? wxFONTFAMILY_MODERN : wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
    wxFont bold_font(default_font);
    wxFont italic_font(default_font);

    bold_font.SetWeight(wxFONTWEIGHT_BOLD);

    wxFont bigger_font(bold_font);
    bigger_font.SetPointSize(size + 2);

    wxFont small_font(default_font);
    small_font.SetPointSize(size - 4);

    italic_font.SetStyle(wxFONTSTYLE_ITALIC);

    // might try alternatively
    //italic_font.SetStyle(wxFONTSTYLE_SLANT);

    wxColour default_text_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
    for(unsigned int i = 0; i < num_levels; ++i)
    {
        style[i].SetFont(default_font);
        style[i].SetAlignment(wxTEXT_ALIGNMENT_DEFAULT);
        style[i].SetTextColour(default_text_colour);
        style[i].SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));

        // is it necessary to do that?
        //style[i].SetFlags(...);
    }

    style[caption].SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
    bigger_font.SetUnderlined(true);
    style[caption].SetFont(bigger_font);

    ColourManager *colours = Manager::Get()->GetColourManager();

    style[success].SetTextColour(colours->GetColour(wxT("logs_success_text")));

    style[warning].SetFont(italic_font);
    style[warning].SetTextColour(colours->GetColour(wxT("logs_warning_text")));

    style[error].SetFont(bold_font);
    style[error].SetTextColour(colours->GetColour(wxT("logs_error_text")));

    style[critical].SetFont(bold_font);
    style[critical].SetTextColour(colours->GetColour(wxT("logs_critical_text")));     // we're setting both fore and background colors here
    style[critical].SetBackgroundColour(colours->GetColour(wxT("logs_critical_back"))); // so we don't have to mix in default colors
    style[spacer].SetFont(small_font);

    // Tell control about the font change
    control->SetFont(default_font);
} // end of UpdateSettings
コード例 #11
0
ファイル: modedit.cpp プロジェクト: JOE-JOE-NGIGI/kicad
BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
    BOARD_ITEM* item = GetCurItem();

    if( GetBoard()->m_Modules == NULL )
        return NULL;

    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();

    // Assign to scanList the proper item types desired based on tool type
    // or hotkey that is in play.

    const KICAD_T* scanList = NULL;

    if( aHotKeyCode )
    {
        // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
        // int aHotKeyCode ) when searching is needed from a hotkey handler
    }
    else
    {
        scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
    }

    m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );

    // Remove redundancies: when an item is found, we can remove the module from list
    if( m_Collector->GetCount() > 1 )
    {
        for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
        {
            item = (*m_Collector)[ii];

            if( item->Type() != PCB_MODULE_T )
                continue;

            m_Collector->Remove( ii );
            ii--;
        }
    }

    if( m_Collector->GetCount() <= 1 )
    {
        item = (*m_Collector)[0];
        SetCurItem( item );
    }
    else    // we can't figure out which item user wants, do popup menu so user can choose
    {
        wxMenu      itemMenu;

        // Give a title to the selection menu. It also allow to close the popup menu without any action
        wxMenuItem* item_title = new wxMenuItem( &itemMenu, wxID_NONE, _( "Selection Clarification" ) );

#ifdef __WINDOWS__
        wxFont      bold_font( *wxNORMAL_FONT );
        bold_font.SetWeight( wxFONTWEIGHT_BOLD );
        bold_font.SetStyle( wxFONTSTYLE_ITALIC );
        item_title->SetFont( bold_font );
#endif

        itemMenu.Append( item_title );
        itemMenu.AppendSeparator();

        int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );

        for( int ii = 0; ii<limit; ++ii )
        {
            item = (*m_Collector)[ii];

            wxString    text = item->GetSelectMenuText();
            BITMAP_DEF  xpm  = item->GetMenuImage();

            AddMenuItem( &itemMenu,
                         ID_POPUP_PCB_ITEM_SELECTION_START + ii,
                         text,
                         KiBitmap( xpm ) );
        }

        // this menu's handler is void
        // PCB_BASE_FRAME::ProcessItemSelection()
        // and it calls SetCurItem() which in turn calls DisplayInfo() on the
        // item.
        m_canvas->SetAbortRequest( true );   // changed in false if an item
        PopupMenu( &itemMenu );              // m_AbortRequest = false if an item is selected

        m_canvas->MoveCursorToCrossHair();
        m_canvas->SetIgnoreMouseEvents( false );

        // The function ProcessItemSelection() has set the current item, return it.
        item = GetCurItem();
    }

    if( item )
    {
        SetMsgPanel( item );
    }

    return item;
}
コード例 #12
0
GlassWidget::GlassWidget(const QString &instance_name,QWidget *parent)
    : QFrame(parent)
{
    gw_process=NULL;
    gw_auto_start=false;

    setFrameStyle(QFrame::Box|QFrame::Raised);
    setMidLineWidth(2);

    //
    // Fonts
    //
    QFont bold_font(font().family(),font().pointSize(),QFont::Bold);

    //
    // Dialogs
    //
    gw_server_dialog=new ServerDialog(this);
    gw_codec_dialog=new CodecDialog(this);
    gw_source_dialog=new SourceDialog(this);
    connect(gw_source_dialog,SIGNAL(updated()),this,SLOT(checkArgs()));
    gw_stream_dialog=new StreamDialog(this);
    gw_config_dialog=new ConfigDialog(instance_name,gw_server_dialog,
                                      gw_codec_dialog,gw_stream_dialog,
                                      gw_source_dialog,this);
    connect(gw_server_dialog,SIGNAL(typeChanged(Connector::ServerType,bool)),
            this,SLOT(serverTypeChangedData(Connector::ServerType,bool)));
    connect(gw_server_dialog,SIGNAL(settingsChanged()),this,SLOT(checkArgs()));

    for(int i=0; i<2; i++) {
        gw_meters[i]=new PlayMeter(SegMeter::Right,this);
        gw_meters[i]->setRange(-3000,0);
        gw_meters[i]->setHighThreshold(-800);
        gw_meters[i]->setClipThreshold(-100);
        gw_meters[i]->setMode(SegMeter::Peak);
    }
    gw_meters[0]->setLabel(tr("L"));
    gw_meters[1]->setLabel(tr("R"));


    gw_status_frame_widget=new QLabel(this);
    gw_status_frame_widget->setFrameStyle(QFrame::Box|QFrame::Raised);
    gw_status_widget=new StatusWidget(this);

    gw_name_label=new QLabel(instance_name,this);
    gw_name_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    gw_name_label->setFont(bold_font);

    gw_message_widget=new MessageWidget(this);
    gw_message_widget->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);

    gw_start_button=new QPushButton(tr("Start"),this);
    gw_start_button->setFont(bold_font);
    connect(gw_start_button,SIGNAL(clicked()),this,SLOT(startEncodingData()));

    gw_config_button=new QPushButton(tr("Settings"),this);
    gw_config_button->setFont(bold_font);
    connect(gw_config_button,SIGNAL(clicked()),this,SLOT(configData()));

    gw_insert_button=new QPushButton(tr("Insert"),this);
    gw_insert_button->setFont(bold_font);
    gw_insert_button->setStyleSheet("background-color: yellow");
    connect(gw_insert_button,SIGNAL(clicked()),this,SLOT(insertData()));
    gw_insert_button->hide();

    gw_remove_button=new QPushButton(tr("Remove"),this);
    gw_remove_button->setFont(bold_font);
    gw_remove_button->setStyleSheet("background-color: violet");
    connect(gw_remove_button,SIGNAL(clicked()),this,SLOT(removeData()));
    gw_remove_button->hide();

    //
    // Kill Timer
    //
    gw_kill_timer=new QTimer(this);
    gw_kill_timer->setSingleShot(true);
    connect(gw_kill_timer,SIGNAL(timeout()),this,SLOT(killData()));
}