mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
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). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@37102 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5052b03d46
commit
68422fbb85
@ -1124,7 +1124,7 @@ void GuiWorkArea::updateWindowTitle()
|
||||
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 @@ void TabWorkArea::updateTabTexts()
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,10 @@ public:
|
||||
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 @@ public:
|
||||
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;
|
||||
}
|
||||
@ -188,7 +192,9 @@ public:
|
||||
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 @@ private:
|
||||
///
|
||||
QString submenuname_;
|
||||
///
|
||||
QString tooltip_;
|
||||
///
|
||||
bool optional_;
|
||||
///
|
||||
FuncStatus status_;
|
||||
@ -448,7 +456,7 @@ void MenuDefinition::read(Lexer & lex)
|
||||
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 @@ void MenuDefinition::read(Lexer & lex)
|
||||
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 @@ void MenuDefinition::expandLastfiles()
|
||||
|
||||
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 @@ void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
|
||||
} else {
|
||||
// we have a MenuItem::Command
|
||||
qMenu.addAction(new Action(view, QIcon(), label(*m),
|
||||
m->func(), QString(), &qMenu));
|
||||
m->func(), m->tooltip(), &qMenu));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,6 +159,10 @@ What's new
|
||||
|
||||
- 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user