Ticket #659: empty_proj_name_in_stats_tab.patch

File empty_proj_name_in_stats_tab.patch, 2.6 KB (added by Pepo, 16 years ago)

In Manager's Stats tab, replaces empty project name with project's URL

  • clientgui/ViewStatistics.cpp

     
    380380        wxCoord y0 = 0;
    381381
    382382        if (project1) {
    383             head_name = wxString(_("Project")) + wxT(": ") + wxString(project1->project_name.c_str(), wxConvUTF8);
     383                if (project1->project_name.length() > 0)
     384                    head_name = wxString(_("Project")) + wxT(": ") + wxString(project1->project_name.c_str(), wxConvUTF8);
     385                else
     386                        head_name = wxString(_("Project")) + wxT(": ") + wxString(project1->master_url.c_str(), wxConvUTF8);
    384387            dc.GetTextExtent(head_name, &w_temp, &h_temp, &des_temp, &lead_temp);
    385388                x0 = wxCoord(m_WorkSpace_X_start + ((m_WorkSpace_X_end - m_WorkSpace_X_start - double(w_temp)) / 2.0));
    386389                y0 = wxCoord(m_WorkSpace_Y_start + 1.0);
     
    463466        for (std::vector<PROJECT*>::const_iterator i = proj->projects.begin(); i != proj->projects.end(); ++i) {
    464467                ++count;
    465468                PROJECT* state_project = pDoc->state.lookup_project((*i)->master_url);
    466                 if (state_project) head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     469                if (state_project) {
     470                        if (state_project->project_name.length() > 0)
     471                                head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     472                        else
     473                                head_name = wxString(state_project->master_url.c_str(), wxConvUTF8);
     474                }
    467475                dc.GetTextExtent(head_name, &w_temp, &h_temp, &des_temp, &lead_temp);
    468476                if (project_name_max_width < w_temp) project_name_max_width = w_temp;
    469477        }
     
    548556        ///Draw project name
    549557                head_name = wxT("?");
    550558                PROJECT* state_project = pDoc->state.lookup_project((*i)->master_url);
    551                 if (state_project) head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     559                if (state_project) {
     560                        if (state_project->project_name.length() > 0)
     561                                head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     562                        else
     563                                head_name = wxString(state_project->master_url.c_str(), wxConvUTF8);
     564                }
    552565
    553566                if (SelProj == count){
    554567                        dc.SetBrush(wxBrush(m_brush_LegendSelectColour , wxSOLID));
     
    12401253                                wxString head_name = wxT("?");
    12411254                                PROJECT* state_project = pDoc->state.lookup_project((*i)->master_url);
    12421255                                if (state_project) {
    1243                                         head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     1256                                        if (state_project->project_name.length() > 0)
     1257                                                head_name = wxString(state_project->project_name.c_str(), wxConvUTF8);
     1258                                        else
     1259                                                head_name = wxString(state_project->master_url.c_str(), wxConvUTF8);
    12441260                                }
    12451261                        //Draw heading
    12461262                                DrawMainHead(dc, head_name);