Re: [PATCH v2 3/8] kernel-shark: Add logic for the initial path of Open-File dialogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 18, 2019 at 6:22 PM Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> wrote:
>
> If the application has been started from the source code directory,
> all OpenFile dialogs will start there. If the application has been
> started from its installation location, all Open File dialogs will
> start at ${HOME}.
>
> Suggested-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
> ---
>  kernel-shark/src/KsCaptureDialog.cpp |  6 +++---
>  kernel-shark/src/KsMainWindow.cpp    | 12 ++++++------
>  kernel-shark/src/KsUtils.hpp         | 15 +++++++++++++++
>  3 files changed, 24 insertions(+), 9 deletions(-)

[...]

> diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp
> index c8b5e88..877c62a 100644
> --- a/kernel-shark/src/KsUtils.hpp
> +++ b/kernel-shark/src/KsUtils.hpp
> @@ -111,6 +111,21 @@ inline QString Ts2String(int64_t ts, int prec)
>
>  bool matchCPUVisible(struct kshark_context *kshark_ctx,
>                               struct kshark_entry *e, int cpu);
> +
> +/**
> + * @brief Get the directory to be used when opening QFileDialog. If the
> + *       application has been started from the source code directory, all
> + *       Open File dialogs will start there. If the application has been
> + *       started from its installation location, all Open File dialogs will
> + *       start at ${HOME}.
> + */
> +inline QString dialogDir()
> +{
> +       QString path = QCoreApplication::applicationFilePath();
> +
> +       return (path.contains(KS_DIR)) ? KS_DIR : QDir::homePath();

Nit: no need for the parenthesis around `path.contains(KS_DIR)`

Reviewed-by: Slavomir Kaslev <kaslevs@xxxxxxxxxx>

As a user of KernelShark who keeps his traces in ~/tmp, I still think
that opening the last directory used and saving it between KernelShark
invocations would be a great feature. But I don't think there's any
KernelShark global config being saved atm so having this as a follow
up in the future is fine.

Cheers,

-- Slavi



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux