Author: vfr
Date: Tue Jan  4 10:49:30 2011
New Revision: 37102
URL: http://www.lyx.org/trac/changeset/37102

Log:
branch: Fix bug #7182: LyX truncates file names in the ui.

Changes:
- let filenames to be longer in window title (see r36950);
- when hovering the lastfiles menu, the full file names are shown in the 
statusbar (see r37083);
- when hovering the tabs, the longer name is shown as a tooltip (see r37101).

Modified:
   lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/GuiWorkArea.cpp
   lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/Menus.cpp
   lyx-devel/branches/BRANCH_1_6_X/status.16x

Modified: lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/GuiWorkArea.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/GuiWorkArea.cpp   Tue Jan 
 4 10:41:27 2011        (r37101)
+++ lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/GuiWorkArea.cpp   Tue Jan 
 4 10:49:30 2011        (r37102)
@@ -1124,7 +1124,7 @@
        Buffer & buf = buffer_view_->buffer();
        FileName const fileName = buf.fileName();
        if (!fileName.empty()) {
-               maximize_title = fileName.displayName(30);
+               maximize_title = fileName.displayName(130);
                minimize_title = from_utf8(fileName.onlyFileName());
                if (buf.lyxvc().inUse()) {
                        if (buf.lyxvc().locker().empty())
@@ -1615,12 +1615,14 @@
 
        // set new tab titles
        for (It it = paths.begin(); it != paths.end(); ++it) {
-               GuiWorkArea * i_wa = dynamic_cast<GuiWorkArea 
*>(widget(it->tab()));
-               Buffer & buf = i_wa->bufferView().buffer();
+               int const tab_index = it->tab();
+               GuiWorkArea * i_wa = dynamic_cast<GuiWorkArea 
*>(widget(tab_index));
+               Buffer const & buf = i_wa->bufferView().buffer();
+               QString tab_text = it->displayString();
                if (!buf.fileName().empty() && !buf.isClean())
-                       setTabText(it->tab(), it->displayString() + "*");
-               else
-                       setTabText(it->tab(), it->displayString());
+                       tab_text += "*";
+               setTabText(tab_index, tab_text);
+               setTabToolTip(tab_index, it->abs());
        }
 }
 

Modified: lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/Menus.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/Menus.cpp Tue Jan  4 
10:41:27 2011        (r37101)
+++ lyx-devel/branches/BRANCH_1_6_X/src/frontends/qt4/Menus.cpp Tue Jan  4 
10:49:30 2011        (r37102)
@@ -151,8 +151,10 @@
        MenuItem(Kind kind,
                 QString const & label,
                 QString const & submenu = QString(),
+                QString const & tooltip = QString(),
                 bool optional = false)
-               : kind_(kind), label_(label), submenuname_(submenu), 
optional_(optional)
+               : kind_(kind), label_(label), submenuname_(submenu),
+                 tooltip_(tooltip), optional_(optional)
        {
                LASSERT(kind == Submenu, /**/);
        }
@@ -160,8 +162,10 @@
        MenuItem(Kind kind,
                 QString const & label,
                 FuncRequest const & func,
+                QString const & tooltip = QString(),
                 bool optional = false)
-               : kind_(kind), label_(label), func_(func), optional_(optional)
+               : kind_(kind), label_(label), func_(func),
+                 tooltip_(tooltip), optional_(optional)
        {
                func_.origin = FuncRequest::MENU;
        }
@@ -183,12 +187,14 @@
                return index == -1 ? QString() : label_.mid(index + 1); 
        }
        /// The complete label, with label and shortcut separated by a '|'
-       QString fulllabel() const { return label_;}
+       QString fulllabel() const { return label_; }
        /// The kind of entry
        Kind kind() const { return kind_; }
        /// the action (if relevant)
        FuncRequest const & func() const { return func_; }
-       /// returns true if the entry should be ommited when disabled
+       /// the tooltip
+       QString const & tooltip() const { return tooltip_; }
+       /// returns true if the entry should be omitted when disabled
        bool optional() const { return optional_; }
        /// returns the status of the lfun associated with this entry
        FuncStatus const & status() const { return status_; }
@@ -240,6 +246,8 @@
        ///
        QString submenuname_;
        ///
+       QString tooltip_;
+       ///
        bool optional_;
        ///
        FuncStatus status_;
@@ -448,7 +456,7 @@
                        lex.next(true);
                        string const command = lex.getString();
                        FuncRequest func = lyxaction.lookupFunc(command);
-                       add(MenuItem(MenuItem::Command, toqstr(name), func, 
optional));
+                       add(MenuItem(MenuItem::Command, toqstr(name), func, 
QString(), optional));
                        optional = false;
                        break;
                }
@@ -538,7 +546,7 @@
                        lex.next(true);
                        docstring const mname = lex.getDocString();
                        add(MenuItem(MenuItem::Submenu,
-                               toqstr(mlabel), toqstr(mname), optional));
+                               toqstr(mlabel), toqstr(mname), QString(), 
optional));
                        optional = false;
                        break;
                }
@@ -667,14 +675,15 @@
 
        for (; lfit != lf.end() && ii <= lyxrc.num_lastfiles; ++lfit, ++ii) {
                string const file = lfit->absFilename();
+               QString const short_path = toqstr(makeDisplayPath(file, 30));
+               QString const long_path = toqstr(makeDisplayPath(file));
                QString label;
                if (ii < 10)
-                       label = QString("%1. %2|%3").arg(ii)
-                               .arg(toqstr(makeDisplayPath(file, 30))).arg(ii);
+                       label = QString("%1. 
%2|%3").arg(ii).arg(short_path).arg(ii);
                else
-                       label = QString("%1. %2").arg(ii)
-                               .arg(toqstr(makeDisplayPath(file, 30)));
-               add(MenuItem(MenuItem::Command, label, 
FuncRequest(LFUN_FILE_OPEN, file)));
+                       label = QString("%1. %2").arg(ii).arg(short_path);
+               add(MenuItem(MenuItem::Command, label,
+                       FuncRequest(LFUN_FILE_OPEN, file), long_path));
        }
 }
 
@@ -1209,7 +1218,7 @@
                } else {
                        // we have a MenuItem::Command
                        qMenu.addAction(new Action(view, QIcon(), label(*m), 
-                               m->func(), QString(), &qMenu));
+                               m->func(), m->tooltip(), &qMenu));
                }
        }
 }

Modified: lyx-devel/branches/BRANCH_1_6_X/status.16x
==============================================================================
--- lyx-devel/branches/BRANCH_1_6_X/status.16x  Tue Jan  4 10:41:27 2011        
(r37101)
+++ lyx-devel/branches/BRANCH_1_6_X/status.16x  Tue Jan  4 10:49:30 2011        
(r37102)
@@ -159,6 +159,10 @@
 
 - Allow to undo the insertion of math macros (bug 7125).
 
+- Add some visual aids to distinguish opened files: full paths in
+  statusbar for recent files items; absolute paths in tooltips of
+  tabs; and longer paths in the window title (bug 7182).
+
 
 * DOCUMENTATION AND LOCALIZATION
 

Reply via email to